Fix setting of is remote enabled to work with DomPDF 0.7.0
authorSeamus Lee <seamuslee001@gmail.com>
Sun, 24 Jul 2016 02:14:21 +0000 (12:14 +1000)
committerSeamus Lee <seamuslee001@gmail.com>
Sun, 24 Jul 2016 02:14:49 +0000 (12:14 +1000)
CRM/Utils/PDF/Utils.php

index b22e3ae1a3913476f6696b151048a891d135997d..4c78d8d96b40502812f8a739d546acc0c65c8372 100644 (file)
  +--------------------------------------------------------------------+
  */
 
-// CRM-12165 - Remote file support required for image handling.
-define("DOMPDF_ENABLE_REMOTE", TRUE);
-define('DOMPDF_ENABLE_AUTOLOAD', FALSE);
 
 use Dompdf\Dompdf;
-
+use Dompdf\Options;
 /**
  *
  * @package CRM
@@ -200,7 +197,11 @@ class CRM_Utils_PDF_Utils {
    * @return string
    */
   public static function _html2pdf_dompdf($paper_size, $orientation, $html, $output, $fileName) {
-    $dompdf = new DOMPDF();
+    // CRM-12165 - Remote file support required for image handling.
+    $options = new Options();
+    $options->set('isRemoteEnabled', TRUE);
+
+    $dompdf = new DOMPDF($options);
     $dompdf->set_paper($paper_size, $orientation);
     $dompdf->load_html($html);
     $dompdf->render();