Skip to content

PDF Generation Template Editor

Open-source visual PDF generation engine with customizable templates and developer-friendly APIs.

View on GitHub

Set Font Family in Content Editor ​

You can edit the font family on the panel of the content editor. The following code shows you how to set the font family:

javascript
const customFonts = instance.UI.Fonts.getAnnotationFonts();

// Add a custom font
instance.UI.Fonts.addAnnotationFont({
  fontFamily: "CustomFont",
  fontName: "CustomFont"
});

// Remove the font
instance.UI.Fonts.removeAnnotationFont(customFonts[0]);

// You can also set the order of the fons
const fonts = instance.UI.Fonts.getAnnotationFonts();
const font = fonts[0];
fonts[0] = fonts[1];
fonts[1] = font;
instance.UI.Fonts.setAnnotationFonts(fonts);

Set Font Size in Content Editor ​

You can also set the font size on the panel of the content editor. The following code shows you how to set the font size:

javascript
// Get font sizes
instance.UI.Fonts.getFontSizes();

// Set font sizes
instance.UI.Fonts.setFontSizes([12, 14, 16, 18, 20]);