Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time

Font

back

Creating new Font

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

https://tcpdf.org/docs/fonts/

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:

$html2pdf->setDefaultFont($default);

back