From 383b23e336bb25b193dd56acdeeb191bb72ebedc Mon Sep 17 00:00:00 2001 From: Olaf Buddenhagen Date: Sun, 21 Jun 2015 00:49:12 +0200 Subject: [PATCH] Fix CRM_Utils_PDF_Utils::_html2pdf_dompdf() when invoked more than once Constants are like functions: they are always global; and they cannot be redefined. Thus, move the defines to a context that doesn't get re-evaluated on each invocation. --- CRM/Utils/PDF/Utils.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CRM/Utils/PDF/Utils.php b/CRM/Utils/PDF/Utils.php index 036e059f48..f2c9bd8558 100644 --- a/CRM/Utils/PDF/Utils.php +++ b/CRM/Utils/PDF/Utils.php @@ -25,6 +25,10 @@ +--------------------------------------------------------------------+ */ +// CRM-12165 - Remote file support required for image handling. +define("DOMPDF_ENABLE_REMOTE", TRUE); +define('DOMPDF_ENABLE_AUTOLOAD', FALSE); + /** * * @package CRM @@ -190,9 +194,6 @@ class CRM_Utils_PDF_Utils { * @return string */ public static function _html2pdf_dompdf($paper_size, $orientation, $html, $output, $fileName) { - // CRM-12165 - Remote file support required for image handling. - define('DOMPDF_ENABLE_REMOTE', TRUE); - define('DOMPDF_ENABLE_AUTOLOAD', FALSE); require_once 'vendor/dompdf/dompdf/dompdf_config.inc.php'; $dompdf = new DOMPDF(); -- 2.25.1