🔥 Gravity PDF v3 end of life was 2017-06-20 and this version is no longer supported. This legacy documentation is kept for reference only.
Available FontsAlong with the standard fonts available to all PDF documents, mPDF ships with a four unicode font faces which covers most worldwide languages. The exception to this is CJK (Chinese, Japanese and Korean) font support, however CJK language-supporting-fonts can be manually installed.
|Available Fonts||CSS Declaration|
|Arial / Helvetica (default PDF font)|
|Times New Roman|
|DejaVu Sans DejaVu Sans Condensed DejaVu Serif DejaVu Serif Condensed DejaVu Sans Mono|
|Indic (Punjabi / Gurmuhki)|
|Additionally, any character from the Symbols or Zapf Dingbats fonts can be used in your PDF without any |
Installing Custom FontsUsers can install their own font files and use them in their PDFs, however there are a couple of restrictions, including:
- Only support for Truetype fonts (.ttf font files)
- Fonts must follow the Truetype specification and use Unicode mapping to the characters.
Note: Font file names should contain only alphanumeric English characters (A-Z and 0-9), spaces or hyphens. Rename font files before uploading if not a valid name.To install a custom font you should upload the .TTF font file to the
/fonts/directory in your site's PDF_EXTENDED_TEMPLATES folder. To complete the installation you need to navigate to the Gravity PDF settings page in your admin area - Forms -> Settings -> PDF - and select the
Initialise Fontsbutton. Once the TTF font file has been uploaded to the server you'll need to install it.
UsageAfter installation you can use the new font in your PDF templates by setting the
font-familyCSS property. Your font-family name will be the name of your TTF file without the .tff extension.
* Apply custom font to your PDF
* Note: It's important to include a font-family type at the end of your font chain (in this example it is sans-serif) in case your font is missing characters.
* By default, the plugin will substitute missing characters from a fallback font.
/* File Name: Menfis.ttf */
font-family: Mefis, sans-serif;
/* File Name: Dite Alla Giovine.ttf */
font-family: "Dite Alla Giovine", sans-serif;
/* File Name: Lato-Black */
font-family: Lato-Black, sans-serif;
CJK Font SupportGravity PDF doesn't support Chinese, Japanese or Korean languages out of the box due to licensing restrictions (or rather lack of a license).
If you need CJK support you will need to manually download Sun-ExtA, Sun-ExtB and UnBatang. After the fonts are installed you can use them like any other custom font:
font-family: UnBatang, sans-serif;
font-family: Sun-ExtA, sans-serif;
font-family: Sun-ExtB, sans-serif;