Search results

PdfFontFamily API in JavaScript (ES5) Pdf Export API control

Specifies the font family from the standard font.

// create a new PDF document
let document : PdfDocument = new PdfDocument();
// add a new page to the document
let page1 : PdfPage = document.pages.add();
// create new standard font
let font : PdfStandardFont = new PdfStandardFont(PdfFontFamily.Helvetica, 20);
// create black brush
let blackBrush : PdfSolidBrush = new PdfSolidBrush(new PdfColor(0, 0, 0));
// draw the text
page1.graphics.drawString('Hello World', font, blackBrush, new PointF(0, 0));
// save the document
document.save('output.pdf');
  • Courier - Specifies the Courier font.
  • Helvetica - Specifies the Helvetica font.
  • Symbol - Specifies the Symbol font.
  • TimesRoman - Specifies the TimesRoman font.
  • ZapfDingbats - Specifies the ZapfDingbats font.