问题描述
我正在使用laravel dompdf将html字符串转换为pdf,也尝试查看文件。但是pdf文件将某些字符显示为“?”。有趣的是,某个字符可见的地方没问题,但看不见的地方。我按照文档操作,并创建了storage / fonts /文件夹。
html:
body {
margin: 0px;
padding: 0px;
font-family: DejaVu serif;
font-size: 14px;
font-weight: 300;
font-variant: normal;
}
PHP:
public function downloadCv(Request $request)
{
$width = 992;
$height = 1000;
$html = file_get_contents('storage/cv-templates/01.html');
// $html = str_replace('fontSrc',storage_path().'/fonts/Montserrat-Light.ttf',$html);
return PDF::loadHtml($html)->setoptions([])->setPaper([0,$width,$height])->setWarnings(true)->stream();
// return PDF::loadView('cv')->setPaper([0,$height])->setWarnings(true)->stream();
// return $html;
// return view('cv');
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)