Setting a custom TTF Font in mPDF

痞子三分冷 提交于 2019-12-11 09:45:21

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!