问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/42317162/setting-a-custom-ttf-font-in-mpdf