PdfFillMode

16 Dec 20251 minute to read

Public enum to define fill mode of the PDF page.

// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Access first page
let page: PdfPage = document.getPage(0);
// Gets the graphics of the PDF page
let graphics: PdfGraphics = page.graphics;
// Create a new font
let font: PdfStandardFont = document.embedFont(PdfFontFamily.symbol, 10, PdfFontStyle.regular);
// Set the fill mode
graphics.setClip({x: 0, y: 0, width: 100, height: 100}, PdfFillMode.winding);
// Draw the text
graphics.drawString('Hello World', font, {x: 10, y: 10, width: 100, height: 40}, new PdfBrush({r: 255, g: 0, b: 0}));
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • alternate - Specifies the type of alternate.
  • winding - Specifies the type of winding.