'How to chunk and generate pdf using dompdf in codeigniter for large data set
I have to generate a pdf file for very large data set (more than 1M). Can anyone explain how to chunk those data set into smaller units and download all data in one single pdf file.
when i try to generate like below it gives memory exhausted error .
$html='<p>this is a test pdf chunk content - this is larger html data table 1 </p>';
$html.='<p>this is a test pdf chunk content - this is larger html data table 2</p>';
$html.='<p>this is a test pdf chunk content - this is larger html data table 3</p>';
$html.='<p>this is a test pdf chunk content - this is larger html data table 4</p>';
$this->pdfgenerator->loadHtml($html);
unset($html);
$this->pdfgenerator->render();
$nme = time() . '-' . str_replace(" ", "-", $user_name) . '-' . "-summary.pdf";
$this->pdfgenerator->stream($nme,array("Attachment"=>0));
In that case i want to chunk that html page content into smaller parts which can handle and give to DOMPDF and download single pdf.
$html='<p>this is a test pdf chunk content - this is larger html data table </p>';
for($i=0;$i<4;$i++){
$this->pdfgenerator->loadHtml($html);
}
unset($html);
$this->pdfgenerator->render();
$nme = time() . '-' . str_replace(" ", "-", $user_name) . '-' . "-summary.pdf";
$this->pdfgenerator->stream($nme,array("Attachment"=>0));
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|