Answers.Body: <p>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</p>
  
  <p>Then I enabled wordpress debugging, and found that the package 'GD' was required, so I enabled that in cPanel. PDF printing is now working!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-22T18:01:18.087Z
Answers.Text: Unfortunately we are now getting out of memory errors with PDF printing on large membership reports.
Answers.UserDisplayName: P a u l
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-16T19:19:32.463Z
Answers.LastActivityDate: 2019-10-16T19:19:32.463Z
Answers.UserDisplayName: P a u l
Answers.Body: <p>You probably don't have php-mbstring installed, or it's not enabled in php.ini. See for example <a href="https://stackoverflow.com/a/1216284/8332458">https://stackoverflow.com/a/1216284/8332458</a> 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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-15T06:09:09.270Z
Answers.Text: 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.
Answers.UserDisplayName: P a u l
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-16T15:13:20.313Z
Answers.Text: 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`.
Answers.UserDisplayName: Jon G - Megaphone Tech
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-15T00:30:26.737Z
Answers.LastActivityDate: 2019-10-15T00:30:26.737Z
Answers.UserDisplayName: Demerit
Answers.Body: <p>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.</p>
  
  <p>Fatal error: Uncaught Error: Class 'DOMDocument' not found in /home/.../public_html/wp-content/plugins/civicrm/civicrm/vendor/dompdf/dompdf/src/Dompdf.php:488 </p>
  
  <p>Stack trace: </p>
  
  <p>-0 /home/.../public_html/wp-content/plugins/civicrm/civicrm/vendor/dompdf/dompdf/src/Dompdf.php(406): Dompdf\Dompdf->loadHtml('\n\n 
  
  <p>-1 /home/.../public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/PDF/Utils.php(202): Dompdf\Dompdf->load_html('\n\n 
  
  <p>-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 
  
  <p>-3 /home/.../public_html/wp-content/plugins/civicrm/civicrm/CRM/Report/Form.php(3472): CRM_Utils_PDF_Utils::html2pdf('\r\n 
  
  <p>-4 /home/.../public_html/wp-content/plugins/civicrm/civicrm/CRM/Report/Form.php(3562): CRM_Report_Form->endPostProcess(Array) </p>
  
  <p>-5 /home/.../public_html/wp-content/ in /home/.../public_html/wp-content/plugins/civicrm/civicrm/vendor/dompdf/dompdf/src/Dompdf.php on line 488</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-15T18:44:16.297Z
Answers.Text: That sounds like php-xml isn't enabled or installed.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-16T18:55:37.927Z
Answers.Text: 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 http://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.
Answers.UserDisplayName: Demerit
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-15T17:01:29.590Z
Answers.LastActivityDate: 2019-10-15T18:11:44.843Z
Answers.LastEditDate: 2019-10-15T18:11:44.843Z
Answers.UserDisplayName: P a u l
Answers.Body: <p>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 <a href="https://civicrm.stackexchange.com/a/10903/225">https://civicrm.stackexchange.com/a/10903/225</a>  </p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-15T16:58:23.227Z
Answers.Text: We don't have anyone here that could do that.
Answers.UserDisplayName: P a u l
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-15T17:03:05.610Z
Answers.Text: If your hosting already has the binaries installed, it's just a matter of setting the path in a config setting.
Answers.UserDisplayName: Aidan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-15T20:23:14.720Z
Answers.Text: The host tells me they will not install wkhtmltopdf due to security concerns.
Answers.UserDisplayName: P a u l
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-16T00:57:43.463Z
Answers.Text: 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.
Answers.UserDisplayName: Aidan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-10-15T07:25:59.040Z
Answers.LastActivityDate: 2019-10-15T07:25:59.040Z
Answers.UserDisplayName: Aidan
Body: <p>We are on CiviCRM 5.15.1</p>
  
  <p>In trying to pdf print a member list ('Print to  PDF') we get the error below.</p>
  
  <p>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</p>
  
  <p>Stack trace:</p>
  
  <p>-0 /home/.../public_html/wp-content/plugins/civicrm/civicrm/CRM/Utils/PDF/Utils.php(200): Dompdf\Dompdf->__construct(Object(Dompdf\Options))</p>
  
  <p>-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</p>
  
Tags: <pdf><printing>
Title: Error printing to pdf
ThreadText: # Error printing to pdf
  
  (Asked by: username_0 on 2019-10-14)
  
  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
  
  **Tags:** pdf, printing
  
  
  ---
  
  ## 4 answers
  
  ### Answer by username_0 on 2019-10-16. Score: 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!
  
  > **Comments:**
  > **username_0**: Unfortunately we are now getting out of memory errors with PDF printing on large membership reports.  
  
  ---
  
  ### Answer by username_1 on 2019-10-15. Score: 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.
  
  > **Comments:**
  > **username_0**: 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.  
  > **username_2**: 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`.  
  
  ---
  
  ### Answer by username_0 on 2019-10-15. Score: 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
  
  > **Comments:**
  > **username_1**: That sounds like php-xml isn't enabled or installed.  
  > **username_1**: 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 http://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.  
  
  ---
  
  ### Answer by username_3 on 2019-10-15. Score: 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>
  
  > **Comments:**
  > **username_0**: We don't have anyone here that could do that.  
  > **username_3**: If your hosting already has the binaries installed, it's just a matter of setting the path in a config setting.  
  > **username_0**: The host tells me they will not install wkhtmltopdf due to security concerns.  
  > **username_3**: 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.  
  
  ---
  
  