I see no reason why not. Just run the website locally on the same computer
DOMPDF Report
is it possible to generate pdf using dompdf without internet connection?
can it be load faster? or it just cant handle large table?
i generate 1500 rows and dompdf cant handle it. it always says maximum execution time error
If you local computer is very fast it might, but it depends on the computer specs.
Are you having problems? What are you trying to do? Do you get an error?
i generate pdf using dompdf. it runs smooth if its just a few rows until a couple hundreds but when it reach thousand rows, it just cant generate until i receive maximum execution time error
You can start by changing the max execution time
https://stackoverflow.com/questions/16171132/how-to-increase-maximum-execution-time-in-php
there no other way to generate large rows faster?
Perhaps if you showed some code I could give some suggestions
public function export_pdf ($startdate, $enddate)
{
$payments = Payment::whereDate('created_at','>=', $startdate)->whereDate('created_at','<=', $enddate)->where('loan_id', '!=', 0)->get();
$loan_amount = Payment::whereDate('created_at','>=', $startdate)->whereDate('created_at','<=', $enddate)->where('loan_id', '!=', 0)->sum('loan_amount');
$loan_interest = Payment::whereDate('created_at','>=', $startdate)->whereDate('created_at','<=', $enddate)->where('loan_id', '!=', 0)->sum('loan_interest');
$loan_cbu = Payment::whereDate('created_at','>=', $startdate)->whereDate('created_at','<=', $enddate)->where('loan_id', '!=', 0)->sum('loan_cbu');
$loan_penalty = Payment::whereDate('created_at','>=', $startdate)->whereDate('created_at','<=', $enddate)->where('loan_id', '!=', 0)->sum('loan_penalty');
$total = $loan_amount+$loan_interest+$loan_cbu+$loan_penalty;
$date = Carbon::now()->format('d/m/Y');
$pdf=PDF::loadView('crb.pdf',compact('clients','payments', 'date', 'loan_amount', 'loan_interest', 'loan_cbu', 'loan_penalty', 'total'));
$pdf->setPaper('legal', 'landscape');
return $pdf->stream('crb.pdf');
}
the code works fine if the rows are just a couple hundreds but if it reach more than thousands, its so slow to generate
Your code is fine. My only suggestion is to look into optimizing your database
i need to generate thousand of rows but dompdf can't
As an alternative you could look at Browsershot, and it's Laravel helper.
Browsershot runs a Chromium headless browser on your server to generate the HTML that gets turned into the PDF. This makes it a more powerful alternative to DOMPDF, which tries to compile the HTML itself.
Please or to participate in this conversation.