• 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);

     

     
  • 相关阅读:
    mysql安装部署
    SSH升级
    符号、特殊字符的英文读法
    用python开发视频压缩器
    VSCode配置项
    工厂模式(简单工厂模式,工厂方法模式,抽象工厂模式)
    单例模式
    Jquery 绑定事件
    中文分词 新建索引 更新索引
    微信自动回复机器人
  • 原文地址:https://www.cnblogs.com/tinywan/p/16813983.html
Copyright © 2020-2023  润新知