Skip to content

Commit

Permalink
Merge pull request #19942 from eileenmcnaughton/5.36
Browse files Browse the repository at this point in the history
Revert "dev/core#2028 Add in a status check for checking if the wkhtm…
  • Loading branch information
eileenmcnaughton authored Mar 30, 2021
2 parents 2edd3d6 + f5f6324 commit eb22b80
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
15 changes: 0 additions & 15 deletions CRM/Utils/Check/Component/Env.php
Original file line number Diff line number Diff line change
Expand Up @@ -960,19 +960,4 @@ public function checkPHPIntlExists() {
return $messages;
}

public function checkWkHtmlToPDFPath() {
$messages = [];
$wkhtmltopdfPath = CRM_Core_Config::singleton()->wkhtmltopdfPath;
if (!empty($wkhtmltopdfPath) && !file_exists($wkhtmltopdfPath)) {
$messages[] = new CRM_Utils_Check_Message(
__FUNCTION__,
ts('CiviCRM is configured to use the wkhtmltopdf package to produce PDFs however it is missing, as such the system will fall back to using the DOMPDF package, this may mean that the output is different to what was expected. You should resolve this by either clearing the setting at Administer -> System Settings -> Miscellaneous or by getting your system administrator to install the wkhtmltopdf package'),
ts('Missing System Package: wkhtmltopdf'),
\Psr\Log\LogLevel::WARNING,
'fa-server'
);
}
return $messages;
}

}
6 changes: 1 addition & 5 deletions CRM/Utils/PDF/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,12 +213,8 @@ public static function _html2pdf_dompdf($paper_size, $orientation, $html, $outpu
* @param string $fileName
*/
public static function _html2pdf_wkhtmltopdf($paper_size, $orientation, $margins, $html, $output, $fileName) {
$config = CRM_Core_Config::singleton();
// if the path doesn't exist fall back on the current backup which is DOMPDF.
if (!file_exists($config->wkhtmltopdfPath)) {
return self::_html2pdf_dompdf($paper_size, $orientation, $html, $output, $fileName);
}
require_once 'snappy/src/autoload.php';
$config = CRM_Core_Config::singleton();
$snappy = new Knp\Snappy\Pdf($config->wkhtmltopdfPath);
$snappy->setOption("page-width", $paper_size[2] . "pt");
$snappy->setOption("page-height", $paper_size[3] . "pt");
Expand Down

0 comments on commit eb22b80

Please sign in to comment.