PHP系列 | mPdf字體庫異常 Cannot find TTF TrueType font file "Eeyek.ttf" in configured font directories

今天使用MQ任務隊列導出學員的成果規劃書爲PDF格式,釘釘機器人報錯

提示信息很明顯,字體庫不存在

解決辦法

1、下載Eeyek.ttf字體庫,下載地址:https://wiot.coding.net/s/75961591-152d-49b3-a79e-d0d90525e68e

2、修改配置:https://mpdf.github.io/fonts-languages/fonts-in-mpdf-7-x.html

3、最後配置文件修改

$defaultConfig = $defaultConfig = (new Mpdf\Config\ConfigVariables())->getDefaults();
$pdfConfig = [
    "autoScriptToLang" => true,
    "autoLangToFont" => true,
    "setAutoTopMargin" => "stretch",
    "setAutoBottomMargin" => "stretch",
    "autoMarginPadding" => 10,
    'tempDir' => app()->getRuntimePath(),
    'mode' => 'UTF-8',
    'format' => 'A3',
    'default_font_size' => 14,
    'margin_right' => 12,
    'margin_left' => 12,
    'fontDir' => array_merge($defaultConfig['fontDir'], [public_path() . 'font'])
];
$mPdf = new Mpdf($pdfConfig);

 

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章