04c92d8 Jun 16, 2017
1 contributor

Users who have contributed to this file

45 lines (27 sloc) 1.3 KB



Creating new Font

To create new font, you should use this tutorial from TCPDF:

Adding new font

To use this new font, you must add it to Html2Pdf, by using the following method:

$html2pdf->addFont($family, $style, $file);

The parameters are:

Parameter Default Description
$family Font family. The name can be chosen arbitrarily. If it is a standard family name, it will override the corresponding font.
$style Font style. Possible values are (case insensitive):
  • empty string: regular (default)
  • B: bold
  • I: italic
  • BI or IB: bold italic
$file The font definition file. By default, the name is built from the family and style, in lower case with no spaces.

If you want to add font for normal and for bold style, you must call the addFont method twice, one for each font file.

WARNING: In 4em parameter constructor of Html2pdf, you must specify whether you use a Unicode font (true) or an old font (false).

Using new font

You have just to se the new font family name in your css.

Setting the default font

You can set the default font to use with the following method: