问题描述
我使用的是laravel 5.2,dompdf在本地主机上运行良好,但是当移至AWS时,它始终显示ErrorException in Cpdf.php line 3855: Undefined index:
,在此行(3855)具有字体变量.
I am using laravel 5.2, The dompdf runs fine at localhost but when moved to AWS it keeps showing ErrorException in Cpdf.php line 3855: Undefined index:
, in this line (3855) has font variable.
示例代码:
$html = "<h2>Hello</h2>";
PDF::setOptions(['dpi' => 150, 'defaultFont' => 'sans-serif']);
$pdf = PDF::loadHTML($html)->setPaper('a4', 'landscape');
return $pdf->download('pdfview.pdf');
由于在barryvdh/laravel-dompdf中没有选项,我无法在setOptions
上设置'currentFont' => 'sans-serif'
.所以我该如何解决currentFont问题.
I can not set 'currentFont' => 'sans-serif'
at setOptions
due to no options in barryvdh/laravel-dompdf. so how can I solve currentFont issue.
Localhost-Windows-运行正常.
Localhost - Windows - Runs fine.
AWS-Linux-错误.
AWS - Linux - Error.
推荐答案
通过从storage/fonts
删除dompdf_font_family_cache.php
文件来解决错误并让渲染器重新生成缓存.
Error solved by delete dompdf_font_family_cache.php
file from storage/fonts
and let the renderer regenerate the cache.
这篇关于Cpdf.php第3855行中的ErrorException:未定义的索引:在barryvdh/laravel-dompdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!