Using 4.7.22 and Drupal 7, I'm suddenly getting the fatal error "No block-level parent found. Not good" on various pdf generation screens (for example: when hitting Print Invoice button):
It started after a recent update to my OS (Centos6).
CiviCRM Stack Exchange is a question and answer site for administrators and users of the CiviCRM Constituent Relationship Management software. It only takes a minute to sign up.Sign up to join this community
That error is coming from dompdf, bundled with CiviCRM.
Here are a couple of references to that error outside of CiviCRM:
The error happens for both 4.6 and 4.7, different php, so the trigger to the issue appears to be somewhat removed.
I fixed one case using the pdf setting (here: /civicrm/admin/setting/misc?reset=1). Using the wkhtmltopdf binary instead of the dompdf bundled with CiviCRM solved the issue.
I upgraded to the latest 4.7.27 version with an updated dompdf, and that did not solve the issue, but instead generated a new problem of running out of memory.
I did a bit more research and fixed the 4.6 version of the problem by removing whitespace in the html that is being fed into dompdf, in the file CRM/Utils/PDF/Utils.php, as per the suggestion by benabbotnz in the second issue linked above.
If you’re running out of memory, as per the comment in the other answer, apply this patch to dompdf (a project external to CiviCRM which you’ll find in the CiviCRM vendor directory).
Note: this patch has been merged into dompdf master, so it will be included in the CiviCRM code base in an upcoming release.
The patch above fixed the out-of-memory-problem for 4.7.27 (can now hit Print Invoice again).