Reputation: 1
Usualy i use "barryvdh/laravel-dompdf": "^v2.0.0" in this laravel projet to create PDF from Html views, this tiny image, like logo it's work fine.
But, now i'm look for create PDF from HTML wrote directly on the App with TinyMCE, those pages can have multiple images i include by simple Copy/Paste on the WYSYWIG editor.
Thoses pages work perfectly if i juste include the HTML in my APP pages.
Now i need to create PDF from thoses pages, but it's didn't work.
Dompdf turn into an infinite loop and i realy doesn't understand why, i try to recreate a very simple test to eliminate potential bug, but nothing
I also try with "mpdf/mpdf": "^8.2", other Pdf library and it's the same problem.
This is an exemple what i do
This doesn't work
$path = storage_path('app/aide/images/220440.png');
if( file_exists($path) ){
$data = file_get_contents($path);
// base64
$base64 = 'data:image/png;base64,' . base64_encode($data);
// base64 HTML
$html = '<img src="'.$base64.'" style="width:200px; height:200px;">';
$mpdf = new Mpdf();
$mpdf->WriteHTML('<h1>'.$aide->titre.'</h1><br>'.$html);
$mpdf->Output();
} else {
return 'File not found.';
}
Upvotes: 0
Views: 71