My code was just working fine until today. I did not change anything but suddenly my pdf code not working. I am using barryvdh/laravel-dompdf
this package in laravel 5.2
.
I deleted my local project and download from the live server but still, this problem occurs on my local computer. My live project works fine with this code.
Here is my code
$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');
I also try enable_html5_parser
set to true
. And after this, I am getting another error
hello friend,
It can be fixed if you delete spaces between the html, head and body tags, as shown below:
It works:
<html><head>
...
</head><body>
...
</body></html>
It fails:
<html>
<head>
...
</head>
<body>
...
</body>
</html>
I had the same problem, with the same laravel version, when I updated my php from 5.6 to 7.0 version.
When I tried to generate the pdf file the message was thrown:
No block-level parent found. Not good.
This solution was found in this github page
https://github.com/dompdf/dompdf/issues/1582#issuecomment-359448550
I hope I have been useful
Had the same issue, for me it was caused by the html
tag not being detected as a block-level parent. Had to add the following CSS to fix it:
html, body {
display: block;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.