spipu / html2pdf

OFFICIAL PROJECT | HTML to PDF converter written in PHP
http://html2pdf.fr/en/default
Open Software License 3.0
1.68k stars 749 forks source link

Multiple PDFs in Sequence #789

Open OswaldoAranda opened 10 months ago

OswaldoAranda commented 10 months ago

Hello. I have the following scenario.

File1, which calls the GeraFile1 class

File2, which calls the GeraFile2 class

File3, which calls the GeraFile3 class

All of the above conditions work perfectly, generating PDF files.

Now, if I take File4 and in this same file I consecutively call the classes GeraFile1, GeraFile2 and GeraFile3, only GeraFile1 creates the file and I receive an exception (Too many tag closures found for [span]).

How can I generate the files in sequence?

Below is my creation code:

// GENERATE THE PDF
$content = ob_get_clean();
try {
   $dir_kits = '/app/tmp/';

   $html2pdf = new Html2Pdf('P','A4','pt', array(0, 0, 0, 0));
   $html2pdf->pdf->SetDisplayMode('real');
   $html2pdf->writeHTML($content, isset($_GET['vuehtml']));

   if($type == 'kit'){;
      //Save the PDF 
      $html2pdf->Output($dir_kits.'ASO'.$id_guia.'.pdf', 'F');
   } else {
      $html2pdf->Output('ASO '.$tipo_aso.' - '.$num_guia.' - '.$colaborador_nome.'.pdf');
   };
}
   catch(HTML2PDF_exception $e) {
   echo $e;
   exit;
}

This is the same code that is in the 3 classes and as already said, individually they work satisfactorily.

How to proceed?