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.getCustomFonts();
// Add a custom font
customFonts.push({
  fontFamily: "CustomFont",
  fontName: "CustomFont"
});
// Remove the font
customFonts.splice(0, 1);

// You can also set the order of the fons
const font = customFonts[0];
customFonts[0] = customFonts[1];
customFonts[1] = font;

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.getFontSizes();

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