6

Can I output the mpdf document as HTML string or file instead of a pdf? It will be helpful for debugging.

Example:

$mpdf->WriteHTML($page_config_css, 1);
$mpdf->SetHTMLHeader($header_first_page);
$mpdf->WriteHTML($output_first_page);
$mpdf->SetHTMLHeader($header);
$mpdf->SetHTMLFooter($footer);
$mpdf->WriteHTML($main_content);

// Can I output it at this stage as html for inspection? 

$mpdf->Output();
4
  • yes. as String $mpdf->Output('S');.. Please kindly check the docs for more information
    – Rotimi
    Commented Jan 7, 2018 at 17:54
  • @Akintunde007 I assumed its a pdf string (the docs doesnt mention html document output). I tried the following and received empty string or fatal error: $html = $mpdf->Output('S'); --> empty string. $html = $mpdf->Output('s'); --> empty string. $html = $mpdf->Output('doc.pdf',\Mpdf\Output\Destination::STRING_RETURN); --> Class 'Mpdf\Output\Destination' not found
    – ramiwi
    Commented Jan 7, 2018 at 18:19
  • 1
    @Akintunde007 $string = $mpdf->Output('somefilename', 'S') works but the output is a pdf string
    – ramiwi
    Commented Jan 7, 2018 at 18:59
  • 1
    I need to see the HTML output so I can figureout what is wrong with my PDF content Commented Feb 12, 2020 at 9:56

0

Browse other questions tagged or ask your own question.