/ PDF / PdfFontFamily
Search results

PdfFontFamily API in JavaScript (ES5) PDF API control

Public enum to define font family.

// 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 = new PdfStandardFont(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, [0, 180, page.size[0], 40], undefined, new PdfBrush([0, 0, 255]), format);
// Save the document
document.save('output.pdf');
// Destroy the document
document.destroy();
  • courier - Specifies the courier font family.
  • helvetica - Specifies the helvetica font family.
  • symbol - Specifies the symbol font family.
  • timesRoman - Specifies the timesRoman font family.
  • zapfDingbats - Specifies the zapfDingbats font family.