PdfFontStyle
16 Dec 20251 minute to read
Public enum to define font style.
// Load an existing PDF document
let document: PdfDocument = new PdfDocument(data, password);
// Gets the first page
let page: PdfPage = document.getPage(0) as PdfPage;
// Create a new PDF standard font
let font: PdfStandardFont = document.embedFont(PdfFontFamily.helvetica, 10, PdfFontStyle.regular);
// Create a new PDF string format
let format: PdfStringFormat = new PdfStringFormat(PdfTextAlignment.right, PdfVerticalAlignment.bottom);
// Draw the text
page.graphics.drawString('Helvetica', font, {x: 0, y: 180, width: page.size.width, height: 40}, new PdfBrush({r: 0, g: 0, b: 255}), format);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();-
bold- Specifies the font stylebold. -
italic- Specifies the font styleitalic. -
regular- Specifies the font styleregular. -
strikeout- Specifies the font stylestrikeout. -
underline- Specifies the font styleunderline.