I am using Laravel Dompdf on Laravel 5.5. I have an image tag like this:
<img src="{{asset('photos_soal/9/Capture.PNG')}}" alt="">
It shows up perfectly on the browser. But once I try to generate it to PDF, it gives me
"Maximum execution time of 60 seconds exceeded"
I have enabled REMOTE_URL. Even if I changed the image source to
http://127.0.0.1/photos_soal/9/Capture.PNG
it still doesn't work. It would be much appreciated if someone gives a workaround to this. The reason I want to use asset helper function is because to prevent wrong path to the image once the application is up for produciton.
This is my controller function:
$questions = Question::where('id_packet', 2)->get();
$pdf = App::make('dompdf.wrapper');
$pdf = PDF::setOptions(['isHtml5ParserEnabled' => true, 'isRemoteEnabled' => true]);
$pdf->loadView('packet-pdf.template-pdf', array('questions' => $questions));
return $pdf->stream();
The laravel-dompdf does not work well with php artisan serve. It take too long to show image links from the server. You should use XAMPP or another http server you like and you see your code will work.