Output Method: the different outputs Html2pdf

The method of Output Html2pdf also behaves the same way as in TCPDF.

Here are the possible uses:

Send PDF to browser without specifying a name

Default name: document.pdf $html2pdf→Output();

Send the PDF document in browser with a specific name

   $html2pdf->Output('my_doc.pdf', false);
   $html2pdf->Output('my_doc.pdf', '');
   $html2pdf->Output('my_doc.pdf', 'I');

Forcing the download of PDF via web browser, with a specific name

   $html2pdf->Output('my_doc.pdf', 'D');  

Write the contents of a PDF file on the server

Warning, use the below with caution. No checks are made on the pre-existence of the file.

   $html2pdf->Output('directory/file_xxxx.pdf', 'F');

Retrieve the contents of the PDF and then do whatever you want

   $content_PDF = $html2pdf->Output('', true);
   $content_PDF = $html2pdf->Output('', 'S');

Send PDF by email

Example of use to send by email a PDF generated without writing temporary file on the server:

This example uses the library PJ-Mail (GPL), available here: http://prgm.spipu.net/?id=30&page

   $content_PDF = $html2pdf->Output('', true);  
   $mail = new PJmail(); 
   $mail->setAllFrom('webmaster@my_site.net', "My personal site"); 
   $mail->addsubject("Example sending PDF"); 
   $mail->text = "This is an example of sending a PDF file"; 
   $mail->addbinattachement("my_document.pdf", $content_PDF); 
   $res = $mail->sendmail(); 
html2pdf/en/v4/output.txt · Last modified: d/m/Y H:i:s by nazgod
Back to top
chimeric.de = chi`s home Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0