I use dompdf
to create pdf files from database query in ci
.
If I limit the rows to about 500 records then it works fine.
The problem is I have more than 5000 records and it gives me time out.
My controller method is as below:
public function loadPDFReports() {
ini_set ( 'memory_limit', '1024M' );
$data ['reports'] = $this->Red_model->loadPDFReports ();
$size = sizeof ( $data ['reports'] );
$all = array_chunk ( $data ['reports'], 400 );
foreach ( $all as $chunk ) {
$data1 ['reports'] = $chunk;
$data1 ['page_num'] = $PAGE_NUM;
echo "hussain: <pre>";
print_r ( $chunk );
$view = $this->load->view ( 'reports/pdf', $data1, TRUE );
pdf_create ( $view, 'filename' );
}
$view = $this->load->view ( 'reports/pdf', $data, TRUE );
pdf_create ( $view, 'filename' );
} // loadPDFReports()
As you see in the code commented, i tried to split the data into separate 400 rows each,but it works only for the first loop.
It is to mentioned that I have already loaded the dompdf
helper in autoload.php
.