Answers.Body: <p>The fix was to uninstall/reinstall sumfields! However, I had to manually delete row/drop tables (value_sumfields and custom_groups) in order to "clean install" sumfields. Still don't know why, but my instance was buggy. The usual uninstall/install procedure in the extensions manager didn't work for me. Talked to Jamie McClelland and he confirmed that I could/should manually make changes to the tables and then reinstall 3.1.1 of sumfields. NOTE: I had originally assumed that the problem had to do with wkhtmltopdf and so started down a bunny trail. For some reason upgrading from 4.7.22 to 4.7.29 AND having sumfields enabled AND using alternate pdf generator caused/revealed the problem on my instance. I will continue to investigate this, but I want to give a big shout out to Aidan at Squiffle and to Jamie at Progressive Tech Project for sticking with me.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-02-02T18:43:34.033Z
Answers.LastActivityDate: 2018-02-02T18:52:38.640Z
Answers.LastEditDate: 2018-02-02T18:52:38.640Z
Answers.UserDisplayName: John Richardson
Body: <p>Just upgraded CiviCRM. Running 4.7.29 on D7.56. Have installed wkhtmltopdf at /usr/local/bin/wkhtmltopdf
  I have placed exactly that file path into the settings in the admin for the &quot;alternate&quot; pdf generator. Doesn't seem to work. Get fatal error when I try to generate pdfs for printing. Here is the alert message:</p>
  <p><code>Fatal error: Call to undefined method CRM_Core_SelectValues::documentFormat() in /home/[site]/public_html/sites/all/modules/civicrm/CRM/Contact/Form/Task/PDFLetterCommon.php on line 186</code></p>
  <p>Don't think wkhtmlpdf is executing. Is there a test to see if wkhtmlpdf is handling the conversion, as opposed to dompdf? Any suggestions?</p>
  <p>WARNING: wkhtmltopdf is no longer under active development and its latest tagged release of 0.12.6 from June 2020 (<a href="https://github.com/wkhtmltopdf/wkhtmltopdf/tree/0.12.6" rel="nofollow noreferrer">https://github.com/wkhtmltopdf/wkhtmltopdf/tree/0.12.6</a>) is insecure and should not be used (<a href="https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35583" rel="nofollow noreferrer">https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35583</a>).</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-30T18:05:05.290Z
Comments.Text: The error message looks unrelated to whether wkhtmltopdf is being used. That method should exist and should be in CRM/Core/SelectValues.php at line 1077 (in 4.7.29)  Corrupted download?  Out of disk space?
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-30T18:40:25.653Z
Comments.Text: Thanks. This is what I have at 1077-1084:                                         
   public static function documentFormat() {
      return array(
        'pdf' => ts('Portable Document Format (.pdf)'),
        'docx' => ts('MS Word (.docx)'),
        'odt' => ts('Open Office (.odt)'),
        'html' => ts('Webpage (.html)'),
      );
    }
Comments.UserDisplayName: John Richardson
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-30T18:50:42.540Z
Comments.Text: Is that code at 1077 what I should expect?
Comments.UserDisplayName: John Richardson
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-31T08:41:21.687Z
Comments.Text: That is right - compare https://github.com/civicrm/civicrm-core/blob/4.7.29/CRM/Core/SelectValues.php#L1077  That is the function it is complaining about not finding.  Is there anything else not working?  What steps are you doing to attempt to generate the pdf?
Comments.UserDisplayName: Aidan
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-31T13:45:44.960Z
Comments.Text: Yes, we get other bad behavior when trying to print from civi. To produce the error above: We do a "find contributions" filtered by date, generate a list, select the contributions, select "thank you letters-email or print" under "actions". That last step produces the error. We do not get to the mail module "select template". If I go to the contact record and select "print or merge document" under actions, I get a white-screen-of-death pop-up. However, if I select "print summary" I get what I expect, it opens my system print dialog and displays a well-formatted document to print.
Comments.UserDisplayName: John Richardson
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-31T14:06:18.800Z
Comments.Text: BTW: we have a non-production site that is a copy of the production site. We have not installed wkhtmltopdf on it. dompdf is giving us fits which is why we are trying wkhtmltopdf. On the test site, when I try to perform the same steps I get errors, but completely different in kind.
Comments.UserDisplayName: John Richardson
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-31T14:41:17.213Z
Comments.Text: Just thinking out loud...is there a test to see if wkhtmltopdf is executing? FYI: I had tech support install wkhtmltopdf on the server. Did not do it myself. I can use ssh cli. I will try to see if I can at least locate the wkhtmltopdf file at /usr/local/bin/wkhtmltopdf.
Comments.UserDisplayName: John Richardson
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-01-31T14:50:11.630Z
Comments.Text: John - Find me on chat.civicrm.org - aydun
Comments.UserDisplayName: Aidan
Tags: <pdf><printing>
Title: After upgrade, I can't generate pdf letters for printing. How can I enable wkhtmlpdf to handle pdf conversion?
ThreadText: # After upgrade, I can't generate pdf letters for printing. How can I enable wkhtmlpdf to handle pdf conversion?
  
  (Asked by: username_0 on 2018-01-30)
  
  Just upgraded CiviCRM. Running 4.7.29 on D7.56. Have installed wkhtmltopdf at /usr/local/bin/wkhtmltopdf
  I have placed exactly that file path into the settings in the admin for the "alternate" pdf generator. Doesn't seem to work. Get fatal error when I try to generate pdfs for printing. Here is the alert message:
  
  `Fatal error: Call to undefined method CRM_Core_SelectValues::documentFormat() in /home/[site]/public_html/sites/all/modules/civicrm/CRM/Contact/Form/Task/PDFLetterCommon.php on line 186`
  
  Don't think wkhtmlpdf is executing. Is there a test to see if wkhtmlpdf is handling the conversion, as opposed to dompdf? Any suggestions?
  
  WARNING: wkhtmltopdf is no longer under active development and its latest tagged release of 0.12.6 from June 2020 (<https://github.com/wkhtmltopdf/wkhtmltopdf/tree/0.12.6>) is insecure and should not be used (<https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-35583>).
  
  **Tags:** pdf, printing
  
  > **Comments:**
  > **username_1**: The error message looks unrelated to whether wkhtmltopdf is being used. That method should exist and should be in CRM/Core/SelectValues.php at line 1077 (in 4.7.29)  Corrupted download?  Out of disk space?  
  > **username_0**: Thanks. This is what I have at 1077-1084:                                           public static function documentFormat() {     return array(       'pdf' => ts('Portable Document Format (.pdf)'),       'docx' => ts('MS Word (.docx)'),       'odt' => ts('Open Office (.odt)'),       'html' => ts('Webpage (.html)'),     );   }  
  > **username_0**: Is that code at 1077 what I should expect?  
  > **username_1**: That is right - compare https://github.com/civicrm/civicrm-core/blob/4.7.29/CRM/Core/SelectValues.php#L1077  That is the function it is complaining about not finding.  Is there anything else not working?  What steps are you doing to attempt to generate the pdf?  
  > **username_0**: Yes, we get other bad behavior when trying to print from civi. To produce the error above: We do a "find contributions" filtered by date, generate a list, select the contributions, select "thank you letters-email or print" under "actions". That last step produces the error. We do not get to the mail module "select template". If I go to the contact record and select "print or merge document" under actions, I get a white-screen-of-death pop-up. However, if I select "print summary" I get what I expect, it opens my system print dialog and displays a well-formatted document to print.  
  > **username_0**: BTW: we have a non-production site that is a copy of the production site. We have not installed wkhtmltopdf on it. dompdf is giving us fits which is why we are trying wkhtmltopdf. On the test site, when I try to perform the same steps I get errors, but completely different in kind.  
  > **username_0**: Just thinking out loud...is there a test to see if wkhtmltopdf is executing? FYI: I had tech support install wkhtmltopdf on the server. Did not do it myself. I can use ssh cli. I will try to see if I can at least locate the wkhtmltopdf file at /usr/local/bin/wkhtmltopdf.  
  > **username_1**: username_0 - Find me on chat.civicrm.org - aydun  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-02-02. Score: 0 | Accepted answer
  
  The fix was to uninstall/reinstall sumfields! However, I had to manually delete row/drop tables (value\_sumfields and custom\_groups) in order to "clean install" sumfields. Still don't know why, but my instance was buggy. The usual uninstall/install procedure in the extensions manager didn't work for me. Talked to Jamie McClelland and he confirmed that I could/should manually make changes to the tables and then reinstall 3.1.1 of sumfields. NOTE: I had originally assumed that the problem had to do with wkhtmltopdf and so started down a bunny trail. For some reason upgrading from 4.7.22 to 4.7.29 AND having sumfields enabled AND using alternate pdf generator caused/revealed the problem on my instance. I will continue to investigate this, but I want to give a big shout out to username_1 at Squiffle and to Jamie at Progressive Tech Project for sticking with me.
  
  
  ---
  
  