hawkmaster
hawkmaster

Reputation: 21

mpdf set font arial not working

I am using mpdf 6.0 to create PDF from a html form. I want to use Arial font. In my css file there is: font-family:Arial, Helvetica, sans-serif;

in Mpdf in the "config_fonts.php" file I have activated the font directory:

define("_MPDF_SYSTEM_TTFONTS", 'C:/Windows/Fonts/');

then;

$this->backupSubsFont = array('arial','dejavusanscondensed','freeserif');

and;

$this->fonttrans = array(
'arial' => 'arial',
'times' => 'timesnewroman',
'courier' => 'couriernew',
'trebuchet' => 'trebuchetms',
'comic' => 'comicsansms',
'franklin' => 'franklingothicbook',
'ocr-b' => 'ocrb',
'ocr-b10bt' => 'ocrb',
'damase' => 'mph2bdamase');

But anyway the PDF file which is produced contains always the font dejavu sans condensed and not arial.

any ideas? thanks a lot.

regards hawk

Upvotes: 2

Views: 6840

Answers (2)

tasmaniski
tasmaniski

Reputation: 4898

This work for me:

$mpdf = new \Mpdf\Mpdf(['default_font' => 'arial']);

You can read more in the documentation: https://mpdf.github.io/fonts-languages/default-font.html

Upvotes: 1

FLX
FLX

Reputation: 2679

Download and move the Arial font TTF into the ttfonts folder and declare it manually in config_fonts.php.

Upvotes: 1

Related Questions