centos7 excel,图片等转PDF问题
已解决!#
- 服务器环境 :
centos7
laravel7
php7.4
Nginx
centos7 本系统带 python2.7, 我单独安装了一个 python3.6
- 2 个问题都是中文转码:
1.laravel7 里面执行 exe (“python3 /www/wwwroot/mqtt/app/test.py “中文路径”) 就会显示变错误,但是我直接使用 python3 执行就可以带中文路径参数。
2.laravel7 使用 use PhpOffice\PhpSpreadsheet\Writer\Pdf\Mpdf;
下面是代码片段
/*
Mpdf 8.2
phpoffice/phpspreadsheet: "^1.18",
*/
$pdfWriter = new Mpdf($spreadsheet);
$pdfWriter->setFont('SimSun', '', 12); // 设置字体为SimSun(中文字体)
$pdfWriter->save($pdfOutputFilePath);
把 excel 转 PDF,结果中文都是方块。
我设置字体 SimSun , 结果输出的 PDF 方块的字体还是 DejaVuSerifCondensed。没思路了,求解救!
本作品采用《CC 协议》,转载必须注明作者和本文链接
推荐文章: