Versions Compared

Key

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

HostBill uses mPDF 6 8 to generate PDF documents. You can refer to its documentation for further guidance on configuration files: https://mpdf.github.io/

...

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 custom fonts - after 2023-11-20 release

Each  font that you want to use has to be added into $config array under mPDF.fontdata key in includes/config.php file:

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

Font file name (OpenSans-Regular.ttf) is case-sensitive.


Code Block
languagephp
$config['mPDF.fontdata'] = [
    'opensans' => [
        'R' => 'OpenSans-Regular.ttf',
    ]
];

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

If you specify additional variants it will allow mpdf to use correct fonts if you use font-weight or font-style properties in your CSS.

Code Block
languagephp
$config['mPDF.fontdata'] = [
    'opensans' => [
        'R' => 'OpenSans-Regular.ttf',
        'B' => 'OpenSans-Bold.ttf',
        'I' => 'OpenSans-Italic.ttf',
        'BI'=> 'OpenSans-BoldItalic.ttf'
    ]
];


Setting up custom fonts - before 2023-11-20 release


Info
titleImportant: mPDF update

Version 2023-11-20 brings major mPDF version update, the file hbf/libs/mpdf/config_fonts.php no longer works and is ignored, ensure to migrate your custom configuration into method described above


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

...