I want to generate multiple pdf files in loop using dompdf. I am using dompdf_0-6-0_beta3. But only one file get generated each time wehn I execute the code. I am providing
You'l have to save your all PDFs to server and then redirect User to download these PDFs.
include 'dompdf_config.inc.php';
$file_to_save = '/path/to/your/public_html/pdf/';
for($i=0; $i<5; $i++)
{
if ( get_magic_quotes_gpc() )
$old_limit = ini_set("memory_limit", "16M");
$dompdf = new DOMPDF();
$dompdf->load_html($i);
$dompdf->set_paper('a4', 'portrait');
$dompdf->render();
//Save PDF in server.
file_put_contents($file_to_save."file".$i.".pdf", $dompdf->output());
}
//open popup window to download all PDFs to client browser.
echo "<script type='text/javascript'>";
for($i=0;$i<5: $i++){
echo "window.open('/pdf/file{$i}.pdf');" ;
}
echo "</script>";