惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

D
DataBreaches.Net
J
Java Code Geeks
有赞技术团队
有赞技术团队
H
Hackread – Cybersecurity News, Data Breaches, AI and More
The GitHub Blog
The GitHub Blog
T
The Blog of Author Tim Ferriss
Apple Machine Learning Research
Apple Machine Learning Research
量子位
D
Docker
V
Visual Studio Blog
博客园 - 司徒正美
Martin Fowler
Martin Fowler
人人都是产品经理
人人都是产品经理
WordPress大学
WordPress大学
U
Unit 42
M
MIT News - Artificial intelligence
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
G
Google Developers Blog
Engineering at Meta
Engineering at Meta
V
V2EX
大猫的无限游戏
大猫的无限游戏
雷峰网
雷峰网
Vercel News
Vercel News
C
Check Point Blog

博客园 - Tinywan

响应错误: Indirect modification of overloaded element of app\model\StudentCacheModel has no effect - Tinywan Ubuntu 22.04 编译安装 PHP 7.4.33 报错:make: *** [Makefile:749: ext/openssl/openssl.lo] Error 1 how to set mpdf HTML contains invalid UTF-8 character(s) 和 CPU 100% Redis Docekr WARNING Memory overcommit must be enabled! Without it, a background save or replication may fail under low memory condition Nginx添加第三方模块,出现“is not binary compatible in”错误的解决方案 Docker 数据库连接见解异常 SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Try again 解决mysql死锁问题 SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction Java系列 | 如何讲自己的JAR包上传至阿里云maven私有仓库【云效制品仓库】 Redis系列 | 分类树查询功能如何从2s优化到0.1s Docker系列 | docker endpoint for “default” not found Node系列 | Node版本管理工具 fnm Java系列 | IntelliJ IDEA 如何导入和使用一个Jar包 Chrome扩展插件:Console Importer(控制台导入器) PHP系列 | PHP中的stdClass是什么? 网络安全 | 记录一次acme.sh更新证书 Error add txt for domain:_acme-challenge.tinywan.com 大数据系列 | 阿里云datav数据可视化(使用json文件生成可视化动态图标) Docker系列 | SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Try again768 Java系列 | Linux系统中运行JMeter脚本 PHP系列 | TP6使用表达式设置数据 Db::raw('end_time')
PHP系列 | mPdf字体库异常 Cannot find TTF TrueType font fi...
Tinywan · 2022-10-21 · via 博客园 - Tinywan

今天使用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);