1

We are on CiviCRM 5.15.1

In trying to pdf print a member list ('Print to PDF') we get the error below.

An error of type E_ERROR was caused in line 274 of the file /home/.../public_html/wp-content/plugins/civicrm/civicrm/vendor/dompdf/dompdf/src/Dompdf.php. Error message: Uncaught Error: Call to undefined function Dompdf\mb_internal_encoding() in /home/.../public_html/wp-content/plugins/civicrm/civicrm/vendor/dompdf/dompdf/src/Dompdf.php:274

Stack trace:

-0 /home/.../public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/PDF/Utils.php(200): Dompdf\Dompdf->__construct(Object(Dompdf\Options))

-1 /home/.../public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/PDF/Utils.php(125): CRM_Utils_PDF_Utils::_html2pdf_dompdf(Array, 'landscape', '\n\n

4 Answers 4

2

Based on replies here this is the solution. Hosting support assured me: Package alt-php72-xml-7.2.20-2.el6.x86_64 already installed and latest version

Then I enabled wordpress debugging, and found that the package 'GD' was required, so I enabled that in cPanel. PDF printing is now working!

1
  • Unfortunately we are now getting out of memory errors with PDF printing on large membership reports.
    – P a u l
    Oct 22, 2019 at 18:01
1

You probably don't have php-mbstring installed, or it's not enabled in php.ini. See for example https://stackoverflow.com/a/1216284/8332458 and the comment underneath it for if you're using ubuntu/debian (apt install php-mbstring). The package name might be slightly different depending on exactly what system you're on.

2
  • We use shared linux hosting and support tells me they have enabled php_mbstring. I set the defaults in php.ini and the error still occurs. Not clear to me why multibyte has anything to do with pdf, but I defer to the group expertise here. I just need it to work.
    – P a u l
    Oct 15, 2019 at 6:09
  • If you create a file called info.php with the contents: <?php phpinfo(); you can see what PHP extensions are present for yourself. I've seen scenarios where hosters think they have an extension installed, but either a) it's not installed across all PHP versions, or b) the files are present but aren't loaded in php.ini. Oct 16, 2019 at 15:13
0

You could try using wkhtmltopdf instead as a workaround to get your pdf's printed - that is provided by some shared hosting setups. See eg https://civicrm.stackexchange.com/a/10903/225

4
  • We don't have anyone here that could do that.
    – P a u l
    Oct 15, 2019 at 16:58
  • If your hosting already has the binaries installed, it's just a matter of setting the path in a config setting.
    – Aidan
    Oct 15, 2019 at 17:03
  • The host tells me they will not install wkhtmltopdf due to security concerns.
    – P a u l
    Oct 15, 2019 at 20:23
  • 1
    That's vague - sounds like they just don't want to install it. If they have anything of substance, have they reported those concerns to the wkhtmltopdf project? It's widely used.
    – Aidan
    Oct 16, 2019 at 0:57
0

Here is another error that just happened with 'Print to PDF'. It's like the wrong files were distributed, or there is a problem with pdf_mbstring. Our shared hosting support is probably out of their depth on this one.

Fatal error: Uncaught Error: Class 'DOMDocument' not found in /home/.../public_html/wp-content/plugins/civicrm/civicrm/vendor/dompdf/dompdf/src/Dompdf.php:488

Stack trace:

-0 /home/.../public_html/wp-content/plugins/civicrm/civicrm/vendor/dompdf/dompdf/src/Dompdf.php(406): Dompdf\Dompdf->loadHtml('\n\n

-1 /home/.../public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/PDF/Utils.php(202): Dompdf\Dompdf->load_html('\n\n

-2 /home/.../public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/PDF/Utils.php(125): CRM_Utils_PDF_Utils::_html2pdf_dompdf(Array, 'landscape', '\n\n

-3 /home/.../public_html/wp-content/plugins/civicrm/civicrm/CRM/Report/Form.php(3472): CRM_Utils_PDF_Utils::html2pdf('\r\n

-4 /home/.../public_html/wp-content/plugins/civicrm/civicrm/CRM/Report/Form.php(3562): CRM_Report_Form->endPostProcess(Array)

-5 /home/.../public_html/wp-content/ in /home/.../public_html/wp-content/plugins/civicrm/civicrm/vendor/dompdf/dompdf/src/Dompdf.php on line 488

2
  • That sounds like php-xml isn't enabled or installed.
    – Demerit
    Oct 15, 2019 at 18:44
  • Did you try Jon's suggestion above with the info.php file? It would prove it one way or the other. You put that file in the top-level folder of your wordpress site and then go to yoursite.com/info.php. As he notes it might be enabled for one version of php, but not the version your site is running on.
    – Demerit
    Oct 16, 2019 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.