i want to download Zip of the multiple pdf which is dynamically generate using MPDF in php/Codegniter
......
$html = $this->load->view('download_inovoice', $finaAr, true);
$mpdf = new \Mpdf\Mpdf(['tempDir' => __DIR__ . '/../../tmp']);
$mpdf->debug = true;
$mpdf->WriteHTML($html);
$mpdf->Output('Invoice_' . $order['orderId'] . '.pdf', 'F');
$name = 'Invoice_' . $order['orderId'] . '.pdf';
$data = $html;
$this->zip->add_data($name, $data);
}
$this->zip->archive('/path/to/directory/my_backup.zip');
$this->zip->download('my_backup.zip');
if(1=1){
$html = $this->load->view('download_inovoice', $finaAr, true);
$mpdf = new \Mpdf\Mpdf(['tempDir' => __DIR__ . '/../../tmp']);
$mpdf->WriteHTML($html);
$htmlArray[] = $mpdf->Output('Invoice_' . $order['orderId'] . '.pdf', 'S');
$htmlArrayIds[] = $order['orderId'];
}
foreach($htmlArray as $key => $file) {
$data = $file;
$name = 'Invoice_' . $htmlArrayIds[$key] . '.pdf';
$this->zip->add_data($name, $data);
}
$this->zip->download('Invoice_zip.zip');
its working fine