From 360db8dbcdac658953ef4c6ad745c63bd6e68cf2 Mon Sep 17 00:00:00 2001 From: Adrien Crivelli Date: Fri, 29 Sep 2017 11:17:08 +0900 Subject: [PATCH] Upgrade to mPDF 7.0+ Closes #144 --- CHANGELOG.md | 1 + composer.json | 4 +- composer.lock | 107 ++++++++++++++++++++----- src/PhpSpreadsheet/Writer/Pdf/MPDF.php | 2 +- 4 files changed, 92 insertions(+), 22 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e399d3e72e..94f018b4e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/). - Merge data-validations to reduce written worksheet size - @billblume [#131](https://github.com/PHPOffice/PhpSpreadSheet/issues/131) - Throws exception if a XML file is invalid - @GreatHumorist [#222](https://github.com/PHPOffice/PhpSpreadsheet/pull/222) +- Upgrade to mPDF 7.0+ - [#144](https://github.com/PHPOffice/PhpSpreadsheet/issues/144) ### Fixed diff --git a/composer.json b/composer.json index 580b95c813..04a922c8b7 100644 --- a/composer.json +++ b/composer.json @@ -39,12 +39,12 @@ "psr/simple-cache": "^1.0" }, "require-dev": { - "mpdf/mpdf": "^6.1", "tecnickcom/tcpdf": "^6.2", "squizlabs/php_codesniffer": "^2.7", "phpunit/phpunit": "^5.7", "friendsofphp/php-cs-fixer": "^2.0", - "dompdf/dompdf": "^0.8.0" + "dompdf/dompdf": "^0.8.0", + "mpdf/mpdf": "7.0.0-RC1@dev" }, "suggest": { "ext-gd": "Required for exact column width autocalculation", diff --git a/composer.lock b/composer.lock index b2bf65bae6..92d9bea92d 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "81b6f3fcd32849e29ea13dd37c9af17f", + "content-hash": "4361e04d6b452f3df8a46484e1728fe1", "packages": [ { "name": "psr/simple-cache", @@ -283,34 +283,49 @@ }, { "name": "mpdf/mpdf", - "version": "v6.1.3", + "version": "v7.0.0-RC1", "source": { "type": "git", "url": "https://github.com/mpdf/mpdf.git", - "reference": "7f138bf7508eac895ac2c13d2509b056ac7e7e97" + "reference": "ef766b1a3e183d78fac39694ecefb41ce391bbd1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mpdf/mpdf/zipball/7f138bf7508eac895ac2c13d2509b056ac7e7e97", - "reference": "7f138bf7508eac895ac2c13d2509b056ac7e7e97", + "url": "https://api.github.com/repos/mpdf/mpdf/zipball/ef766b1a3e183d78fac39694ecefb41ce391bbd1", + "reference": "ef766b1a3e183d78fac39694ecefb41ce391bbd1", "shasum": "" }, "require": { + "ext-gd": "*", "ext-mbstring": "*", - "php": ">=5.4.0", + "paragonie/random_compat": "^2.0", + "php": "^5.6 || ~7.0.0 || ~7.1.0 || ~7.2.0", + "psr/log": "^1.0", "setasign/fpdi": "1.6.*" }, "require-dev": { - "phpunit/phpunit": "^4.7" + "mockery/mockery": "^0.9.5", + "phpunit/phpunit": "^5.0", + "squizlabs/php_codesniffer": "^2.7.0", + "tracy/tracy": "^2.4" }, "suggest": { + "ext-bcmath": "Needed for generation of some types of barcodes", + "ext-xml": "Needed mainly for SVG manipulation", "ext-zlib": "Needed for compression of embedded resources, such as fonts" }, "type": "library", + "extra": { + "branch-alias": { + "dev-development": "7.0-dev" + } + }, "autoload": { - "classmap": [ - "mpdf.php", - "classes" + "psr-4": { + "Mpdf\\": "src/" + }, + "files": [ + "src/functions.php" ] }, "notification-url": "https://packagist.org/downloads/", @@ -318,19 +333,23 @@ "GPL-2.0" ], "authors": [ + { + "name": "Matěj Humpál", + "role": "Developer, maintainer" + }, { "name": "Ian Back", - "role": "Developer" + "role": "Developer (retired)" } ], "description": "A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support", - "homepage": "http://mpdf.github.io", + "homepage": "https://mpdf.github.io", "keywords": [ "pdf", "php", "utf-8" ], - "time": "2016-12-12T10:42:18+00:00" + "time": "2017-09-26T12:00:17+00:00" }, { "name": "myclabs/deep-copy", @@ -374,6 +393,54 @@ ], "time": "2017-01-26T22:05:40+00:00" }, + { + "name": "paragonie/random_compat", + "version": "v2.0.11", + "source": { + "type": "git", + "url": "https://github.com/paragonie/random_compat.git", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/paragonie/random_compat/zipball/5da4d3c796c275c55f057af5a643ae297d96b4d8", + "reference": "5da4d3c796c275c55f057af5a643ae297d96b4d8", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "require-dev": { + "phpunit/phpunit": "4.*|5.*" + }, + "suggest": { + "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes." + }, + "type": "library", + "autoload": { + "files": [ + "lib/random.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Paragon Initiative Enterprises", + "email": "security@paragonie.com", + "homepage": "https://paragonie.com" + } + ], + "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7", + "keywords": [ + "csprng", + "pseudorandom", + "random" + ], + "time": "2017-09-27T21:40:39+00:00" + }, { "name": "phenx/php-font-lib", "version": "0.5", @@ -1650,16 +1717,16 @@ }, { "name": "setasign/fpdi", - "version": "1.6.1", + "version": "1.6.2", "source": { "type": "git", "url": "https://github.com/Setasign/FPDI.git", - "reference": "5b899b2b41463bf261aa69840fd30b50950a500c" + "reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/Setasign/FPDI/zipball/5b899b2b41463bf261aa69840fd30b50950a500c", - "reference": "5b899b2b41463bf261aa69840fd30b50950a500c", + "url": "https://api.github.com/repos/Setasign/FPDI/zipball/a6ad58897a6d97cc2d2cd2adaeda343b25a368ea", + "reference": "a6ad58897a6d97cc2d2cd2adaeda343b25a368ea", "shasum": "" }, "suggest": { @@ -1695,7 +1762,7 @@ "fpdi", "pdf" ], - "time": "2015-11-30T10:53:14+00:00" + "time": "2017-05-11T14:25:49+00:00" }, { "name": "squizlabs/php_codesniffer", @@ -2553,7 +2620,9 @@ ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": { + "mpdf/mpdf": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { diff --git a/src/PhpSpreadsheet/Writer/Pdf/MPDF.php b/src/PhpSpreadsheet/Writer/Pdf/MPDF.php index 425b132eee..f6d6605ba0 100644 --- a/src/PhpSpreadsheet/Writer/Pdf/MPDF.php +++ b/src/PhpSpreadsheet/Writer/Pdf/MPDF.php @@ -77,7 +77,7 @@ public function save($pFilename) } // Create PDF - $pdf = new \mPDF(); + $pdf = new \Mpdf\Mpdf(); $ortmp = $orientation; $pdf->_setPageSize(strtoupper($paperSize), $ortmp); $pdf->DefOrientation = $orientation;