Change Font in a PDF Form

Edit in →

Any PDF document supports a set of standard 14 fonts. They are available in most PDF viewers and ensure consistent document representation on any device. The standard 14 fonts include the following fonts and their variants:

  • Helvetica | Helvetica-Bold | Helvetica-BoldOblique | Helvetica-Oblique
  • Courier | Courier-Bold | Courier-BoldOblique | Courier-Oblique
  • Times-Roman | Times-Bold | Times-Italic | Times-BoldItalic
  • Symbol
  • ZapfDingbats

SurveyJS PDF Generator supports these fonts out of the box. To apply one of them, specify the fontName property in the IDocOptions object.

You can also use custom fonts in your PDF document. Unlike the standard fonts, custom fonts are embedded in the document and increase its size. To add a custom font, call the DocController.addFont(fontName, base64, fontStyle) method with the following parameters:

  • fontName: string
    A custom name that you will use to apply a custom font.
  • base64: string
    The custom font as a Base64-encoded string. To encode your font to Base64, obtain it as a TTF file and use any TTF-to-Base64 online converter.
  • fontStyle: "normal" | "bold" | "italic" | "bolditalic"
    The style of the custom font.

To apply a custom font to a PDF document, assign its name to the fontName property in the IDocOptions object. This setting applies a custom font to all survey questions except HTML. To include HTML questions too, enable the useCustomFontInHtml property. This demo applies the Roboto font to a PDF document that contains HTML questions among others.

Your cookie settings

We use cookies on our site to make your browsing experience more convenient and personal. In some cases, they are essential to making the site work properly. By clicking "Accept All", you consent to the use of all cookies in accordance with our Terms of Use & Privacy Statement. However, you may visit "Cookie settings" to provide a controlled consent.

Your renewal subscription expires soon.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.

Your renewal subscription has expired.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.