4lcapwned
4lcapwned

Reputation: 127

Setting a custom TTF Font in mPDF

i installed mPDF 6.0 via zip file (not composer), put a font into the ttfonts folder and added the file in config_fonts.php like this:

"eurostyle" => array(   /* Custom */
    'R' => "eurostyle-normal.ttf"
    )

Now i tried adding the font to my mPDF object like this:

$mpdf = new mPDF('c', 'A4-L');
$mpdf -> SetFont('eurostyle');

but nothing changes. There is no error message, the output PDF simpy stays the same.

Does anybody know why?

Upvotes: 1

Views: 4849

Answers (1)

Finwe
Finwe

Reputation: 6725

Create your mPDF object without c as mode parameter. Use an empty string or eg. UTF-8.

$mpdf = new mPDF('', 'A4-L');

c mode means the PDF will only use core PDF fonts - therefore it will not use any custom external fonts.

See also the Fonts & Languages/Choosing a configuration page of the manual.

Upvotes: 6

Related Questions