I'm getting the following error when I try and generate a PDF using the mPDF class:
TTF file "C:/wamp/www/inc/mpdf/ttfonts/verdana.ttf": invalid checksum 20f65173c11 table: DSIG (expected 65173c11)
I've uploaded the font files to my ttfonts
directory and defined the font in config_fonts.php
like this:
"verdana" => array(
'R' => "verdana.ttf",
'B' => "verdanab.ttf",
'I' => "verdanai.ttf",
'BI' => "verdanaz.ttf",
),
I only see the error when I turn on font error reporting in the config settings. When I turn error reporting off, the PDF is generated, but the font being used is not Verdana.
Any idea on what I'm doing wrong?
Following are the steps to add new font family in mpdf library:
newFont.ttf
font file(s) to this location /mpdf/ttfonts
folder.Edit /mpdf/config_fonts.php
OR /mpdf/src/config/FontVariables.php
to add an entry to the $this->fontdata
array for the new font file(s). Like:
$this->fontdata = array(
"newFont" => array(
'R' => "newFont-Regular.ttf",
'B' => "newFont-Bold.ttf",
'I' => "newFont-Italic.ttf",
'BI' => "newFont-BoldItalic.ttf",
),
font-family: 'newFont';
is now available in the stylesheets.
$mpdfObj = new mPDF('', '', 'newFont');
$mpdfObj->SetFont('newFont');
Now your new font is added.