Md.*_*ain 7 php pdf dompdf laravel laravel-5.2
我的代码工作正常,直到今天.我没有改变任何东西,但突然我的PDF代码无法正常工作.我正在使用barryvdh/laravel-dompdf这个包laravel 5.2.
我删除了本地项目并从实时服务器下载但仍然在我的本地计算机上出现此问题.我的实时项目可以正常使用此代码.
这是我的代码
$pdf = App::make('dompdf.wrapper');
$pdf->loadView('back_end.pdf_template.make_invoice', ['order_info' =>$order_info, 'order_details' => $order_details]);
return $pdf->stream('inv-' . $order_info->invoice_id . '.pdf');
Run Code Online (Sandbox Code Playgroud)
Ger*_*ais 10
你好朋友,
如果删除html,head和body标签之间的空格,可以修复它,如下所示:
有用:
<html><head>
...
</head><body>
...
</body></html>
Run Code Online (Sandbox Code Playgroud)
它失败:
<html>
<head>
...
</head>
<body>
...
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
我有同样的问题,使用相同的laravel版本,当我将我的PHP从5.6更新到7.0版本.
当我尝试生成pdf文件时,抛出了消息:
找不到块级父级.不好.
在这个github页面中找到了这个解决方案
https://github.com/dompdf/dompdf/issues/1582#issuecomment-359448550
我希望我有用