php - I want to create multiple pdfs in a loop using dompdf? -


i want generate multiple pdf files in loop using dompdf. using dompdf_0-6-0_beta3. 1 file generated each time wehn execute code. providing code reference follows.

include 'dompdf_config.inc.php';  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();    $dompdf->stream($i.".pdf");  }  

so please me in question.

you'l have save pdfs server , redirect user 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 download pdfs client browser.  echo "<script type='text/javascript'>";  for($i=0;$i<5: $i++){       echo "window.open('/pdf/file{$i}.pdf');" ;  }  echo "</script>"; 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -