CRM-16005 - Use and configure the dompdf provided by composer.
[civicrm-core.git] / CRM / Utils / PDF / Utils.php
index 0e9f00c6d8d14868531c9f73075bffec6b8431b2..f7dc760449e4427d7b694cf47e1f6f799e0ef6e3 100644 (file)
@@ -124,6 +124,17 @@ class CRM_Utils_PDF_Utils {
     }
   }
 
+  /**
+   * Convert html to tcpdf.
+   *
+   * @param $paper_size
+   * @param $orientation
+   * @param $margins
+   * @param $html
+   * @param $output
+   * @param $fileName
+   * @param $stationery_path
+   */
   public static function _html2pdf_tcpdf($paper_size, $orientation, $margins, $html, $output, $fileName, $stationery_path) {
     // Documentation on the TCPDF library can be found at: http://www.tcpdf.org
     // This function also uses the FPDI library documented at: http://www.setasign.com/products/fpdi/about/
@@ -179,8 +190,11 @@ class CRM_Utils_PDF_Utils {
    * @return string
    */
   public static function _html2pdf_dompdf($paper_size, $orientation, $html, $output, $fileName) {
-    require_once 'packages/dompdf/dompdf_config.inc.php';
-    spl_autoload_register('DOMPDF_autoload');
+    // 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();
     $dompdf->set_paper($paper_size, $orientation);
     $dompdf->load_html($html);
@@ -225,7 +239,7 @@ class CRM_Utils_PDF_Utils {
   }
 
   /**
-   * convert value from one metric to another
+   * convert value from one metric to another.
    *
    * @param $value
    * @param $from