From f70b087324009c72912242ac8e3a393842311f7b Mon Sep 17 00:00:00 2001 From: Seamus Lee <seamuslee001@gmail.com> Date: Sat, 17 Sep 2016 21:46:45 +0000 Subject: [PATCH] CRM-19059 upgrade dompdf for 4.6 --- CRM/Contribute/Form/Task/Invoice.php | 6 +- CRM/Utils/PDF/Utils.php | 10 +- composer.json | 2 +- composer.lock | 189 ++++++++++++++++++--------- 4 files changed, 137 insertions(+), 70 deletions(-) diff --git a/CRM/Contribute/Form/Task/Invoice.php b/CRM/Contribute/Form/Task/Invoice.php index cf0244bf19..65e916864b 100644 --- a/CRM/Contribute/Form/Task/Invoice.php +++ b/CRM/Contribute/Form/Task/Invoice.php @@ -25,6 +25,8 @@ +--------------------------------------------------------------------+ */ +use Dompdf\Dompdf; +use Dompdf\Options; /** * * @package CRM @@ -648,7 +650,9 @@ class CRM_Contribute_Form_Task_Invoice extends CRM_Contribute_Form_Task { * Name of file which is in pdf format */ static public function putFile($html, $name = 'Invoice.pdf') { - require_once "vendor/dompdf/dompdf/dompdf_config.inc.php"; + $options = new Options(); + $options->set('isRemoteEnabled', TRUE); + $doc = new DOMPDF(); $doc->load_html($html); $doc->render(); diff --git a/CRM/Utils/PDF/Utils.php b/CRM/Utils/PDF/Utils.php index 7088d6066c..aa6e4ae882 100644 --- a/CRM/Utils/PDF/Utils.php +++ b/CRM/Utils/PDF/Utils.php @@ -25,10 +25,8 @@ +--------------------------------------------------------------------+ */ -// 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 +198,9 @@ class CRM_Utils_PDF_Utils { * @return string */ public static function _html2pdf_dompdf($paper_size, $orientation, $html, $output, $fileName) { - require_once 'vendor/dompdf/dompdf/dompdf_config.inc.php'; + // CRM-12165 - Remote file support needed for image handling + $options = new Options(); + $options->set('isRemoteEnabled', TRUE); $dompdf = new DOMPDF(); $dompdf->set_paper($paper_size, $orientation); diff --git a/composer.json b/composer.json index 35e32382ee..597d71a1fb 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ }, "include-path": ["vendor/tecnickcom"], "require": { - "dompdf/dompdf" : "0.6.*", + "dompdf/dompdf" : "0.7.*", "symfony/dependency-injection": "2.3.*", "symfony/event-dispatcher": "2.3.*", "symfony/process": "2.3.*", diff --git a/composer.lock b/composer.lock index 070798ee64..5c9a0766e6 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "e4049717f3ff5f9f303ea41e24167cd7", - "content-hash": "24925810ee175da5ce6472dfa2b8f3bb", + "hash": "fd3f59bfad9a391951d4e773230a4752", + "content-hash": "5ac26ca66347ff4485584db892ed4341", "packages": [ { "name": "civicrm/civicrm-cxn-rpc", @@ -49,30 +49,46 @@ }, { "name": "dompdf/dompdf", - "version": "v0.6.2", + "version": "v0.7.0", "source": { "type": "git", "url": "https://github.com/dompdf/dompdf.git", - "reference": "cc06008f75262510ee135b8cbb14e333a309f651" + "reference": "5c98652b1a5beb7e3cc8ec35419b2828dd63ab14" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dompdf/dompdf/zipball/cc06008f75262510ee135b8cbb14e333a309f651", - "reference": "cc06008f75262510ee135b8cbb14e333a309f651", + "url": "https://api.github.com/repos/dompdf/dompdf/zipball/5c98652b1a5beb7e3cc8ec35419b2828dd63ab14", + "reference": "5c98652b1a5beb7e3cc8ec35419b2828dd63ab14", "shasum": "" }, "require": { - "phenx/php-font-lib": "0.2.*" + "ext-dom": "*", + "ext-gd": "*", + "ext-mbstring": "*", + "phenx/php-font-lib": "0.4.*", + "phenx/php-svg-lib": "0.1.*", + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*" }, "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "0.7-dev" + } + }, "autoload": { + "psr-4": { + "Dompdf\\": "src/" + }, "classmap": [ - "include/" + "lib/" ] }, "notification-url": "https://packagist.org/downloads/", "license": [ - "LGPL" + "LGPL-2.1" ], "authors": [ { @@ -82,35 +98,39 @@ { "name": "Brian Sweeney", "email": "eclecticgeek@gmail.com" + }, + { + "name": "Gabriel Bull", + "email": "me@gabrielbull.com" } ], "description": "DOMPDF is a CSS 2.1 compliant HTML to PDF converter", "homepage": "https://github.com/dompdf/dompdf", - "time": "2015-12-07 04:07:13" + "time": "2016-05-11 00:36:29" }, { "name": "phenx/php-font-lib", - "version": "0.2.2", + "version": "0.4", "source": { "type": "git", "url": "https://github.com/PhenX/php-font-lib.git", - "reference": "c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82" + "reference": "b8af0cacdc3cbf1e41a586fcb78f506f4121a088" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82", - "reference": "c30c7fc00a6b0d863e9bb4c5d5dd015298b2dc82", + "url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/b8af0cacdc3cbf1e41a586fcb78f506f4121a088", + "reference": "b8af0cacdc3cbf1e41a586fcb78f506f4121a088", "shasum": "" }, "type": "library", "autoload": { - "classmap": [ - "classes/" - ] + "psr-0": { + "FontLib\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "LGPL" + "LGPL-3.0" ], "authors": [ { @@ -120,7 +140,41 @@ ], "description": "A library to read, parse, export and make subsets of different types of font files.", "homepage": "https://github.com/PhenX/php-font-lib", - "time": "2014-02-01 15:22:28" + "time": "2015-05-06 20:02:39" + }, + { + "name": "phenx/php-svg-lib", + "version": "0.1", + "source": { + "type": "git", + "url": "https://github.com/PhenX/php-svg-lib.git", + "reference": "b419766515b3426c6da74b0e29e93d71c4f17099" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PhenX/php-svg-lib/zipball/b419766515b3426c6da74b0e29e93d71c4f17099", + "reference": "b419766515b3426c6da74b0e29e93d71c4f17099", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Svg\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "LGPL-3.0" + ], + "authors": [ + { + "name": "Fabien Ménager", + "email": "fabien.menager@gmail.com" + } + ], + "description": "A library to read, parse and export to PDF SVG files.", + "homepage": "https://github.com/PhenX/php-svg-lib", + "time": "2015-05-06 18:49:49" }, { "name": "phpseclib/phpseclib", @@ -260,17 +314,17 @@ }, { "name": "symfony/dependency-injection", - "version": "v2.3.23", + "version": "v2.3.42", "target-dir": "Symfony/Component/DependencyInjection", "source": { "type": "git", "url": "https://github.com/symfony/dependency-injection.git", - "reference": "f165ee0e0b3522b5158def22622b2f171a8ecd59" + "reference": "06265ee128644eb70356bd72ab28c9ded6618d19" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/f165ee0e0b3522b5158def22622b2f171a8ecd59", - "reference": "f165ee0e0b3522b5158def22622b2f171a8ecd59", + "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/06265ee128644eb70356bd72ab28c9ded6618d19", + "reference": "06265ee128644eb70356bd72ab28c9ded6618d19", "shasum": "" }, "require": { @@ -278,7 +332,7 @@ }, "require-dev": { "symfony/config": "~2.2", - "symfony/yaml": "~2.0" + "symfony/yaml": "~2.1" }, "suggest": { "symfony/config": "", @@ -294,46 +348,49 @@ "autoload": { "psr-0": { "Symfony\\Component\\DependencyInjection\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony DependencyInjection Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 19:42:47" + "homepage": "https://symfony.com", + "time": "2016-05-30 08:31:06" }, { "name": "symfony/event-dispatcher", - "version": "v2.3.23", + "version": "v2.3.42", "target-dir": "Symfony/Component/EventDispatcher", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "36a40695d94e948d7a85347db0b12ba446c400fa" + "reference": "fd6d162d97bf3e6060622e5c015af39ca72e33bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/36a40695d94e948d7a85347db0b12ba446c400fa", - "reference": "36a40695d94e948d7a85347db0b12ba446c400fa", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/fd6d162d97bf3e6060622e5c015af39ca72e33bc", + "reference": "fd6d162d97bf3e6060622e5c015af39ca72e33bc", "shasum": "" }, "require": { "php": ">=5.3.3" }, "require-dev": { - "symfony/dependency-injection": "~2.0" + "symfony/dependency-injection": "~2.0,>=2.0.5" }, "suggest": { "symfony/dependency-injection": "", @@ -348,39 +405,42 @@ "autoload": { "psr-0": { "Symfony\\Component\\EventDispatcher\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony EventDispatcher Component", - "homepage": "http://symfony.com", - "time": "2014-11-30 13:33:44" + "homepage": "https://symfony.com", + "time": "2016-04-04 09:22:54" }, { "name": "symfony/finder", - "version": "v2.3.23", + "version": "v2.3.42", "target-dir": "Symfony/Component/Finder", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "d533aea3400dc463c4d0ba9c3ecf40bd80d49dbd" + "reference": "dce4b58434fc1cbd66e3006e539bb53074dfea82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/d533aea3400dc463c4d0ba9c3ecf40bd80d49dbd", - "reference": "d533aea3400dc463c4d0ba9c3ecf40bd80d49dbd", + "url": "https://api.github.com/repos/symfony/finder/zipball/dce4b58434fc1cbd66e3006e539bb53074dfea82", + "reference": "dce4b58434fc1cbd66e3006e539bb53074dfea82", "shasum": "" }, "require": { @@ -395,47 +455,47 @@ "autoload": { "psr-0": { "Symfony\\Component\\Finder\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Symfony Community", - "homepage": "http://symfony.com/contributors" - }, { "name": "Fabien Potencier", "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" } ], "description": "Symfony Finder Component", - "homepage": "http://symfony.com", - "time": "2014-12-02 19:42:47" + "homepage": "https://symfony.com", + "time": "2016-05-13 14:58:35" }, { "name": "symfony/process", - "version": "v2.3.28", + "version": "v2.3.42", "target-dir": "Symfony/Component/Process", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "a8fe947ac58e081f8773e0d160807dcffbff7ed8" + "reference": "89aced1438655ad81fc828c2e2e555e9b88fef3b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/a8fe947ac58e081f8773e0d160807dcffbff7ed8", - "reference": "a8fe947ac58e081f8773e0d160807dcffbff7ed8", + "url": "https://api.github.com/repos/symfony/process/zipball/89aced1438655ad81fc828c2e2e555e9b88fef3b", + "reference": "89aced1438655ad81fc828c2e2e555e9b88fef3b", "shasum": "" }, "require": { "php": ">=5.3.3" }, - "require-dev": { - "symfony/phpunit-bridge": "~2.7" - }, "type": "library", "extra": { "branch-alias": { @@ -445,7 +505,10 @@ "autoload": { "psr-0": { "Symfony\\Component\\Process\\": "" - } + }, + "exclude-from-classmap": [ + "/Tests/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -463,7 +526,7 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2015-05-01 14:06:45" + "time": "2016-03-31 08:39:43" }, { "name": "tecnickcom/tcpdf", -- 2.25.1