Version: 3
🔥 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.
Fonts/Language Support
Available Fonts
Along 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) | font-family: Arial, Helvetica, sans-serif; |
Times New Roman | font-family: "Times New Roman", Times, serif; |
Courier | font-family: Courier, monospace; |
DejaVu Sans DejaVu Sans Condensed DejaVu Serif DejaVu Serif Condensed DejaVu Sans Mono | font-family: "DejaVu Sans", sans-serif; font-family: "DejaVu Sans Condensed", sans-serif; font-family: "DejaVu Serif", serif; font-family: "DejaVu Serif Condensed", serif; font-family: "DejaVu Sans Mono", monospace; |
Garuda | font-family: Garuda, sans-serif; |
Norasi | font-family: Norasi, serif; |
XB Zar | font-family: "XB Zar", serif; |
XB Riyaz | font-family: "XB Riyaz", sans-serif; |
Indic (Bengali) | font-family: ind_bn_1_001; |
Indic (Devanagari) | font-family: ind_hi_1_001; |
Indic (Malayalam) | font-family: ind_ml_1_001; |
Indic (Kannada) | font-family: ind_kn_1_001; |
Indic (Oriya) | font-family: ind_or_1_001; |
Indic (Punjabi / Gurmuhki) | font-family: ind_pa_1_001; |
Indic (Tamil) | font-family: ind_ta_1_001; |
Indic (Telugu) | font-family: ind_te_1_001; |
Additionally, any character from the Symbols or Zapf Dingbats fonts can be used in your PDF without any font-family declaration. |
Installing Custom Fonts
Users 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.
Installation
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 Fonts
button.
Usage
After installation you can use the new font in your PDF templates by setting thefont-family
CSS 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 */
body {
font-family: Mefis, sans-serif;
}
/* File Name: Dite Alla Giovine.ttf */
body {
font-family: "Dite Alla Giovine", sans-serif;
}
/* File Name: Lato-Black */
body {
font-family: Lato-Black, sans-serif;
}
CJK Font Support
Gravity 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;