Skip to main content
Version: 3

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.
The default and fall-back font is DejaVu Sans Condensed
Available FontsCSS Declaration
Arial / Helvetica (default PDF font)font-family: Arial, Helvetica, sans-serif;
Times New Romanfont-family: "Times New Roman", Times, serif;
Courierfont-family: Courier, monospace;
DejaVu Sans DejaVu Sans Condensed DejaVu Serif DejaVu Serif Condensed DejaVu Sans Monofont-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;
Garudafont-family: Garuda, sans-serif;
Norasifont-family: Norasi, serif;
XB Zarfont-family: "XB Zar", serif;
XB Riyazfont-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:
  1. Only support for Truetype fonts (.ttf font files)
  2. 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 Fontsbutton.Once the TTF font file has been uploaded to the server you'll need to install it. Once the TTF font file has been uploaded to the server you'll need to install it.

Usage

After installation you can use the new font in your PDF templates by setting the font-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;

DOWNLOAD