barryvdh / laravel-dompdf

A DOMPDF Wrapper for Laravel
MIT License
6.79k stars 978 forks source link

Gateway Timeout #993

Open bienadnet opened 1 year ago

bienadnet commented 1 year ago

I have error Gateway Timeout when download. when i save file, it size is 2.59M $pdf = \App::make('dompdf.wrapper'); $pdf->getDomPDF()->set_option("enable_php", true); $pdf->loadView('shop.invoice.print', $this->data); return $pdf->download($fileName);

tommica commented 1 year ago

Doubt it is an issue with the dompdf - change the $pdf->getDomPDF()->set_option("enable_php", true); to $pdf->getDomPDF()->set_option("enable_php", false); first and try and download the file - if the error goes away, that means that the PHP code in the file is to blame.

Without being able to see the template itself, I would guess you have a N+1 problem, probably a product line in your invoice is calling a relationship, which is not lazy loaded, so it has to call the database to get the data, and this happens for each of the lines.