Uncaught Exception 'Dompdf_exception' with message 'No block-level Parent found. Not good. '

Asked

Viewed 731 times

1

am having a problem generating a pdf file from an html string.

the error reported is as follows::

Uncaught exception 'DOMPDF_Exception' with message 'No block-level parent found. Not good.'

The PDF generation code is below:

$dompdf = new DOMPDF();
$dompdf->load_html(stripslashes($html));
$dompdf->set_paper("a4");
$dompdf->render();
$out = $dompdf->output();

1 answer

5


I’ve had this problem in the past and this code saved my day. Try to check for spaces between HTML tags. Try to use this code, it removes any space between the TAGS

$html = preg_replace('/>\s+</', '><', $html);

before the line $dompdf->load_html(stripslashes($html));

  • 2

    It worked here! Thank you :)

  • Saved my day Hahaha

  • Saved here too, thank you!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.