laravel-dompdf
laravel-dompdf copied to clipboard
Is it possible pass data to loadHTML method ?
Hello, I would like to ask everyone. I want to pass data from my code to html content with loadHTML method without use loadView .
example : show list of (Model result inside pdf).
Thank You
No
@parallels999 can you give me un example please , i tried this but isn't working
$pdf->loadHTML($template->content, ['test' => 'test']);
https://github.com/barryvdh/laravel-dompdf/blob/7516caab940796d31267da9b30b548a56bef50cb/src/PDF.php#L81-L92
the second paramter is for encoding not for data @parallels999 can you give me a real example ?
While you cannot pass data directly to loadHTML()
, you can build html from a blade view manually and then pass that in
// create a view, pass data, and get the html content
$html = response()->view($view, ['test' => 'test'])->getContent();
// pass html to pdf
PDF::loadHTML($html);
@jameswagoner yes , that what i did as solution, thank you :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Any issues with PDF rendering itself that are not directly related to this package, should be reported on https://github.com/dompdf/dompdf instead. When having doubts, please try to reproduce the issue with just dompdf. If you believe this is an actual issue with the latest version of laravel-dompdf, please reply to this issue so we can investigate further. Thank you for your contribution! Apologies for any delayed response on our side.