Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

Hostbill HostBill uses mPDF 5 to generate pdf PDF documents, you . You can refer to its documentation for further guidance on configuration files.: http://www.mpdfonline.com/repos/mpdfmanual.pdf

Uploading font files

To be able to use custom fonts in pdf documents you will have to upload those font files to  hbf/libs/mpdf/ttfonts directory.

...

In this guide we will use Open Sans font with four styles (bold, italic, ...), if . If your font has only one file you should treat it as a "regular" style.

In case of Open Sans fonts you should have this the following file structure:

Code Block
hbf/libs/mpdf/ttfonts/OpenSans-Regular.ttf
hbf/libs/mpdf/ttfonts/OpenSans-Bold.ttf
hbf/libs/mpdf/ttfonts/OpenSans-Italic.ttf
hbf/libs/mpdf/ttfonts/OpenSans-BoldItalic.ttf

Setting up fonts

Each font that you want to use has to be added in hbf/libs/mpdf/config_fonts.php configuration file.

Font family name (array key) used in configuration has to be lower case, without spaces, if . If you use "OpenSans" as your css font-familly hostbill HostBill will look for "opensans".

...

You can define 4 font styles under the same name, the R (Regular) variant is required for each font famillyfamily, B (Bold), I (Italic), BI (Bold Italic) are optional.

...

Note
titleNote

If you are using auto upgrade, you should add hbf/libs/mpdf/config_fonts.php to excluded file list. Otherwise your changes will be overwritten when upgrading.

Accessing fonts

You will have to define font-family directly in html when editing invoice template, to . To do that click on "html" button available in formatting tools, this will open a popup with html source for you to edit.

If you want to apply your font to the whole document, add or replace your style at the beginning with this code: 

...