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();
ramiwi
  • 902
  • 2
  • 10
  • 28
  • yes. as String `$mpdf->Output('S');`.. Please kindly check the docs for more information – Rotimi Jan 07 '18 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 Jan 07 '18 at 18:19
  • 1
    @Akintunde007 $string = $mpdf->Output('somefilename', 'S') works but the output is a pdf string – ramiwi Jan 07 '18 at 18:59
  • 1
    I need to see the HTML output so I can figureout what is wrong with my PDF content – ahmednawazbutt Feb 12 '20 at 09:56

0 Answers0