Basic test covering of all PDF writers
Third party PDF libraries must now be installed via composer and naturally via composer autoloading mechanism. Because of that it is not necessary to specify their path on disk. The usage is simplified and it allows us to include them in our unit tests. This also means that from now on PhpSpreadsheet must use composer autoloader mechanism. The internal autoloading implementation was dropped.
This commit is contained in:
parent
66f37218c9
commit
035281f04c
|
@ -36,7 +36,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|||
|
||||
For a comprehensive list of all class changes, and a semi-automated migration path, read the [migration guide](./docs/Migration-from-PHPExcel.md).
|
||||
|
||||
- Dropped `\PHPExcel_Calculation_Functions::VERSION()`. Composer or git should be used to know the version.
|
||||
- Dropped `PHPExcel_Calculation_Functions::VERSION()`. Composer or git should be used to know the version.
|
||||
- Dropped `PHPExcel_Settings::setPdfRenderer()` and `PHPExcel_Settings::setPdfRenderer()`. Composer should be used to autoload PDF libs.
|
||||
|
||||
|
||||
## [1.8.1] - 2015-04-30
|
||||
|
||||
|
|
|
@ -33,7 +33,10 @@
|
|||
"squizlabs/php_codesniffer": "2.*",
|
||||
"phpunit/phpunit": "4.6.*",
|
||||
"mikey179/vfsStream": "1.5.*",
|
||||
"friendsofphp/php-cs-fixer": "^2.0"
|
||||
"friendsofphp/php-cs-fixer": "^2.0",
|
||||
"dompdf/dompdf": "^0.7.0",
|
||||
"mpdf/mpdf": "^6.1",
|
||||
"tecnickcom/tcpdf": "^6.2"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-zip": "Required to handle .xlsx .ods or .gnumeric files",
|
||||
|
|
|
@ -4,8 +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"
|
||||
],
|
||||
"hash": "7244392042ac04174b9b0d5cf51129d0",
|
||||
"content-hash": "230c3d270e3bfe7e52ffe59b6e65eaa7",
|
||||
"content-hash": "5bc2a831cb37027378be4c325f6b2681",
|
||||
"packages": [],
|
||||
"packages-dev": [
|
||||
{
|
||||
|
@ -60,7 +59,68 @@
|
|||
"constructor",
|
||||
"instantiate"
|
||||
],
|
||||
"time": "2015-06-14 21:17:01"
|
||||
"time": "2015-06-14T21:17:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "dompdf/dompdf",
|
||||
"version": "v0.7.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/dompdf/dompdf.git",
|
||||
"reference": "5c98652b1a5beb7e3cc8ec35419b2828dd63ab14"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/dompdf/dompdf/zipball/5c98652b1a5beb7e3cc8ec35419b2828dd63ab14",
|
||||
"reference": "5c98652b1a5beb7e3cc8ec35419b2828dd63ab14",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"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": [
|
||||
"lib/"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPL-2.1"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Fabien Ménager",
|
||||
"email": "fabien.menager@gmail.com"
|
||||
},
|
||||
{
|
||||
"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": "2016-05-11T00:36:29+00:00"
|
||||
},
|
||||
{
|
||||
"name": "friendsofphp/php-cs-fixer",
|
||||
|
@ -125,7 +185,7 @@
|
|||
}
|
||||
],
|
||||
"description": "A tool to automatically fix PHP code style",
|
||||
"time": "2016-12-01 06:18:06"
|
||||
"time": "2016-12-01T06:18:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mikey179/vfsStream",
|
||||
|
@ -171,7 +231,126 @@
|
|||
],
|
||||
"description": "Virtual file system to mock the real file system in unit tests.",
|
||||
"homepage": "http://vfs.bovigo.org/",
|
||||
"time": "2015-03-29 11:19:49"
|
||||
"time": "2015-03-29T11:19:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "mpdf/mpdf",
|
||||
"version": "v6.1.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/mpdf/mpdf.git",
|
||||
"reference": "7f138bf7508eac895ac2c13d2509b056ac7e7e97"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/mpdf/mpdf/zipball/7f138bf7508eac895ac2c13d2509b056ac7e7e97",
|
||||
"reference": "7f138bf7508eac895ac2c13d2509b056ac7e7e97",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"ext-mbstring": "*",
|
||||
"php": ">=5.4.0",
|
||||
"setasign/fpdi": "1.6.*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^4.7"
|
||||
},
|
||||
"suggest": {
|
||||
"ext-zlib": "Needed for compression of embedded resources, such as fonts"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"mpdf.php",
|
||||
"classes"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"GPL-2.0"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Ian Back",
|
||||
"role": "Developer"
|
||||
}
|
||||
],
|
||||
"description": "A PHP class to generate PDF files from HTML with Unicode/UTF-8 and CJK support",
|
||||
"homepage": "http://mpdf.github.io",
|
||||
"keywords": [
|
||||
"pdf",
|
||||
"php",
|
||||
"utf-8"
|
||||
],
|
||||
"time": "2016-12-12T10:42:18+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phenx/php-font-lib",
|
||||
"version": "0.4",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/PhenX/php-font-lib.git",
|
||||
"reference": "b8af0cacdc3cbf1e41a586fcb78f506f4121a088"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/PhenX/php-font-lib/zipball/b8af0cacdc3cbf1e41a586fcb78f506f4121a088",
|
||||
"reference": "b8af0cacdc3cbf1e41a586fcb78f506f4121a088",
|
||||
"shasum": ""
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-0": {
|
||||
"FontLib\\": "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, export and make subsets of different types of font files.",
|
||||
"homepage": "https://github.com/PhenX/php-font-lib",
|
||||
"time": "2015-05-06T20:02:39+00:00"
|
||||
},
|
||||
{
|
||||
"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-06T18:49:49+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-common",
|
||||
|
@ -225,7 +404,7 @@
|
|||
"reflection",
|
||||
"static analysis"
|
||||
],
|
||||
"time": "2015-12-27 11:43:31"
|
||||
"time": "2015-12-27T11:43:31+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/reflection-docblock",
|
||||
|
@ -270,7 +449,7 @@
|
|||
}
|
||||
],
|
||||
"description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.",
|
||||
"time": "2016-06-10 09:48:41"
|
||||
"time": "2016-06-10T09:48:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpdocumentor/type-resolver",
|
||||
|
@ -317,7 +496,7 @@
|
|||
"email": "me@mikevanriel.com"
|
||||
}
|
||||
],
|
||||
"time": "2016-06-10 07:14:17"
|
||||
"time": "2016-06-10T07:14:17+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpspec/prophecy",
|
||||
|
@ -379,7 +558,7 @@
|
|||
"spy",
|
||||
"stub"
|
||||
],
|
||||
"time": "2016-06-07 08:13:47"
|
||||
"time": "2016-06-07T08:13:47+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-code-coverage",
|
||||
|
@ -441,7 +620,7 @@
|
|||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2015-10-06 15:47:00"
|
||||
"time": "2015-10-06T15:47:00+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-file-iterator",
|
||||
|
@ -488,7 +667,7 @@
|
|||
"filesystem",
|
||||
"iterator"
|
||||
],
|
||||
"time": "2015-06-21 13:08:43"
|
||||
"time": "2015-06-21T13:08:43+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-text-template",
|
||||
|
@ -529,7 +708,7 @@
|
|||
"keywords": [
|
||||
"template"
|
||||
],
|
||||
"time": "2015-06-21 13:50:34"
|
||||
"time": "2015-06-21T13:50:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-timer",
|
||||
|
@ -573,7 +752,7 @@
|
|||
"keywords": [
|
||||
"timer"
|
||||
],
|
||||
"time": "2016-05-12 18:03:57"
|
||||
"time": "2016-05-12T18:03:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/php-token-stream",
|
||||
|
@ -622,7 +801,7 @@
|
|||
"keywords": [
|
||||
"tokenizer"
|
||||
],
|
||||
"time": "2015-09-15 10:49:45"
|
||||
"time": "2015-09-15T10:49:45+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit",
|
||||
|
@ -694,7 +873,7 @@
|
|||
"testing",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2015-06-03 05:03:30"
|
||||
"time": "2015-06-03T05:03:30+00:00"
|
||||
},
|
||||
{
|
||||
"name": "phpunit/phpunit-mock-objects",
|
||||
|
@ -750,7 +929,7 @@
|
|||
"mock",
|
||||
"xunit"
|
||||
],
|
||||
"time": "2015-10-02 06:51:40"
|
||||
"time": "2015-10-02T06:51:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/comparator",
|
||||
|
@ -814,7 +993,7 @@
|
|||
"compare",
|
||||
"equality"
|
||||
],
|
||||
"time": "2015-07-26 15:48:44"
|
||||
"time": "2015-07-26T15:48:44+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/diff",
|
||||
|
@ -866,7 +1045,7 @@
|
|||
"keywords": [
|
||||
"diff"
|
||||
],
|
||||
"time": "2015-12-08 07:14:41"
|
||||
"time": "2015-12-08T07:14:41+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/environment",
|
||||
|
@ -916,7 +1095,7 @@
|
|||
"environment",
|
||||
"hhvm"
|
||||
],
|
||||
"time": "2016-05-17 03:18:57"
|
||||
"time": "2016-05-17T03:18:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/exporter",
|
||||
|
@ -983,7 +1162,7 @@
|
|||
"export",
|
||||
"exporter"
|
||||
],
|
||||
"time": "2016-06-17 09:04:28"
|
||||
"time": "2016-06-17T09:04:28+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/global-state",
|
||||
|
@ -1034,7 +1213,7 @@
|
|||
"keywords": [
|
||||
"global state"
|
||||
],
|
||||
"time": "2015-10-12 03:26:01"
|
||||
"time": "2015-10-12T03:26:01+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/recursion-context",
|
||||
|
@ -1087,7 +1266,7 @@
|
|||
],
|
||||
"description": "Provides functionality to recursively process PHP variables",
|
||||
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
|
||||
"time": "2015-11-11 19:50:13"
|
||||
"time": "2015-11-11T19:50:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/version",
|
||||
|
@ -1122,7 +1301,56 @@
|
|||
],
|
||||
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
|
||||
"homepage": "https://github.com/sebastianbergmann/version",
|
||||
"time": "2015-06-21 13:59:46"
|
||||
"time": "2015-06-21T13:59:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "setasign/fpdi",
|
||||
"version": "1.6.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Setasign/FPDI.git",
|
||||
"reference": "5b899b2b41463bf261aa69840fd30b50950a500c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Setasign/FPDI/zipball/5b899b2b41463bf261aa69840fd30b50950a500c",
|
||||
"reference": "5b899b2b41463bf261aa69840fd30b50950a500c",
|
||||
"shasum": ""
|
||||
},
|
||||
"suggest": {
|
||||
"setasign/fpdf": "FPDI will extend this class but as it is also possible to use \"tecnickcom/tcpdf\" as an alternative there's no fixed dependency configured.",
|
||||
"setasign/fpdi-fpdf": "Use this package to automatically evaluate dependencies to FPDF.",
|
||||
"setasign/fpdi-tcpdf": "Use this package to automatically evaluate dependencies to TCPDF."
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"filters/",
|
||||
"fpdi.php",
|
||||
"fpdf_tpl.php",
|
||||
"fpdi_pdf_parser.php",
|
||||
"pdf_context.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"MIT"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Jan Slabon",
|
||||
"email": "jan.slabon@setasign.com",
|
||||
"homepage": "https://www.setasign.com"
|
||||
}
|
||||
],
|
||||
"description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
|
||||
"homepage": "https://www.setasign.com/fpdi",
|
||||
"keywords": [
|
||||
"fpdf",
|
||||
"fpdi",
|
||||
"pdf"
|
||||
],
|
||||
"time": "2015-11-30T10:53:14+00:00"
|
||||
},
|
||||
{
|
||||
"name": "squizlabs/php_codesniffer",
|
||||
|
@ -1200,7 +1428,7 @@
|
|||
"phpcs",
|
||||
"standards"
|
||||
],
|
||||
"time": "2016-07-13 23:29:13"
|
||||
"time": "2016-07-13T23:29:13+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
|
@ -1260,7 +1488,7 @@
|
|||
],
|
||||
"description": "Symfony Console Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-07-26 08:04:17"
|
||||
"time": "2016-07-26T08:04:17+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
|
@ -1320,7 +1548,7 @@
|
|||
],
|
||||
"description": "Symfony EventDispatcher Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-07-19 10:45:57"
|
||||
"time": "2016-07-19T10:45:57+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/filesystem",
|
||||
|
@ -1369,7 +1597,7 @@
|
|||
],
|
||||
"description": "Symfony Filesystem Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-07-20 05:44:26"
|
||||
"time": "2016-07-20T05:44:26+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/finder",
|
||||
|
@ -1418,7 +1646,7 @@
|
|||
],
|
||||
"description": "Symfony Finder Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-06-29 05:41:56"
|
||||
"time": "2016-06-29T05:41:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-mbstring",
|
||||
|
@ -1477,7 +1705,7 @@
|
|||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2016-05-18 14:26:46"
|
||||
"time": "2016-05-18T14:26:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-php54",
|
||||
|
@ -1535,7 +1763,7 @@
|
|||
"portable",
|
||||
"shim"
|
||||
],
|
||||
"time": "2016-11-14 01:06:16"
|
||||
"time": "2016-11-14T01:06:16+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
|
@ -1584,7 +1812,7 @@
|
|||
],
|
||||
"description": "Symfony Process Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-07-28 11:13:48"
|
||||
"time": "2016-07-28T11:13:48+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/stopwatch",
|
||||
|
@ -1633,7 +1861,7 @@
|
|||
],
|
||||
"description": "Symfony Stopwatch Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-06-29 05:41:56"
|
||||
"time": "2016-06-29T05:41:56+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/yaml",
|
||||
|
@ -1682,7 +1910,70 @@
|
|||
],
|
||||
"description": "Symfony Yaml Component",
|
||||
"homepage": "https://symfony.com",
|
||||
"time": "2016-07-17 14:02:08"
|
||||
"time": "2016-07-17T14:02:08+00:00"
|
||||
},
|
||||
{
|
||||
"name": "tecnickcom/tcpdf",
|
||||
"version": "6.2.12",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/tecnickcom/TCPDF.git",
|
||||
"reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/tecnickcom/TCPDF/zipball/2f732eaa91b5665274689b1d40b285a7bacdc37f",
|
||||
"reference": "2f732eaa91b5665274689b1d40b285a7bacdc37f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": ">=5.3.0"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"fonts",
|
||||
"config",
|
||||
"include",
|
||||
"tcpdf.php",
|
||||
"tcpdf_parser.php",
|
||||
"tcpdf_import.php",
|
||||
"tcpdf_barcodes_1d.php",
|
||||
"tcpdf_barcodes_2d.php",
|
||||
"include/tcpdf_colors.php",
|
||||
"include/tcpdf_filters.php",
|
||||
"include/tcpdf_font_data.php",
|
||||
"include/tcpdf_fonts.php",
|
||||
"include/tcpdf_images.php",
|
||||
"include/tcpdf_static.php",
|
||||
"include/barcodes/datamatrix.php",
|
||||
"include/barcodes/pdf417.php",
|
||||
"include/barcodes/qrcode.php"
|
||||
]
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"LGPLv3"
|
||||
],
|
||||
"authors": [
|
||||
{
|
||||
"name": "Nicola Asuni",
|
||||
"email": "info@tecnick.com",
|
||||
"homepage": "http://nicolaasuni.tecnick.com"
|
||||
}
|
||||
],
|
||||
"description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
|
||||
"homepage": "http://www.tcpdf.org/",
|
||||
"keywords": [
|
||||
"PDFD32000-2008",
|
||||
"TCPDF",
|
||||
"barcodes",
|
||||
"datamatrix",
|
||||
"pdf",
|
||||
"pdf417",
|
||||
"qrcode"
|
||||
],
|
||||
"time": "2015-09-12T10:08:34+00:00"
|
||||
},
|
||||
{
|
||||
"name": "webmozart/assert",
|
||||
|
@ -1732,7 +2023,7 @@
|
|||
"check",
|
||||
"validate"
|
||||
],
|
||||
"time": "2016-08-09 15:02:57"
|
||||
"time": "2016-08-09T15:02:57+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
|
|
@ -130,12 +130,6 @@ included. See section: "Setting a column's width" for more details.
|
|||
- Using [PhpSpreadsheet with
|
||||
TYPO3](http://typo3.org/documentation/document-library/extension-manuals/phpexcel_library/1.1.1/view/toc/0/)
|
||||
|
||||
## Joomla Autoloader interferes with PhpSpreadsheet Autoloader
|
||||
|
||||
Thanks to peterrlynch for the following advice on resolving issues
|
||||
between the [PhpSpreadsheet autoloader and Joomla
|
||||
Autoloader](http://phpexcel.codeplex.com/discussions/211925)
|
||||
|
||||
### Tutorials
|
||||
|
||||
- [English PHPExcel tutorial](http://openxmldeveloper.org)
|
||||
|
|
|
@ -75,39 +75,11 @@ using PhpSpreadsheet.
|
|||
|
||||
![01-schematic.png](./images/01-schematic.png "Basic Architecture Schematic")
|
||||
|
||||
## Lazy Loader
|
||||
## AutoLoader
|
||||
|
||||
PhpSpreadsheet implements an autoloader or "lazy loader", which means
|
||||
that it is not necessary to include every file within PhpSpreadsheet. It
|
||||
is only necessary to include the initial PhpSpreadsheet class file, then
|
||||
the autoloader will include other class files as and when required, so
|
||||
only those files that are actually required by your script will be
|
||||
loaded into PHP memory. The main benefit of this is that it reduces the
|
||||
memory footprint of PhpSpreadsheet itself, so that it uses less PHP
|
||||
memory.
|
||||
|
||||
If your own scripts already define an autoload function, then this may
|
||||
be overwritten by the PhpSpreadsheet autoload function. For example, if
|
||||
you have:
|
||||
|
||||
``` php
|
||||
function __autoload($class) {
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Do this instead:
|
||||
|
||||
``` php
|
||||
function myAutoload($class) {
|
||||
...
|
||||
}
|
||||
|
||||
spl_autoload_register('myAutoload');
|
||||
```
|
||||
|
||||
Your autoloader will then co-exist with the autoloader of
|
||||
PhpSpreadsheet.
|
||||
PhpSpreadsheet relies on Composer autoloader. So before working with
|
||||
PhpSpreadsheet in standalone, be sure to run `composer install`. Or add it to a
|
||||
pre-existing project with `composer require phpoffice/phpspreadsheet`.
|
||||
|
||||
## Spreadsheet in memory
|
||||
|
||||
|
@ -1574,16 +1546,16 @@ regarding to styling cells, number formatting, ...
|
|||
|
||||
PhpSpreadsheet’s PDF Writer is a wrapper for a 3rd-Party PDF Rendering
|
||||
library such as tcPDF, mPDF or DomPDF. You must now install a PDF
|
||||
Rendering library yourself; but PhpSpreadsheet will work with a number
|
||||
rendering library yourself; but PhpSpreadsheet will work with a number
|
||||
of different libraries.
|
||||
|
||||
Currently, the following libraries are supported:
|
||||
|
||||
Library | Version used for testing | Downloadable from | PhpSpreadsheet Internal Constant
|
||||
--------|--------------------------|----------------------------------|----------------------------
|
||||
tcPDF | 5.9 | http://www.tcpdf.org/ | PDF_RENDERER_TCPDF
|
||||
mPDF | 5.4 | http://www.mpdf1.com/mpdf/ | PDF_RENDERER_MPDF
|
||||
domPDF | 0.6.0 beta 3 | http://code.google.com/p/dompdf/ | PDF_RENDERER_DOMPDF
|
||||
Library | Downloadable from | PhpSpreadsheet Internal Constant
|
||||
--------|-------------------------------------|---------------------------------
|
||||
tcPDF | https://github.com/tecnickcom/tcpdf | PDF_RENDERER_TCPDF
|
||||
mPDF | https://github.com/mpdf/mpdf | PDF_RENDERER_MPDF
|
||||
domPDF | https://github.com/dompdf/dompdf | PDF_RENDERER_DOMPDF
|
||||
|
||||
The different libraries have different strengths and weaknesses. Some
|
||||
generate better formatted output than others, some are faster or use
|
||||
|
@ -1592,23 +1564,11 @@ the developers choice which one they wish to use, appropriate to their
|
|||
own circumstances.
|
||||
|
||||
Before instantiating a Writer to generate PDF output, you will need to
|
||||
indicate which Rendering library you are using, and where it is located.
|
||||
indicate which Rendering library you are using.
|
||||
|
||||
``` php
|
||||
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
|
||||
$rendererLibrary = 'mPDF5.4';
|
||||
$rendererLibraryPath = dirname(__FILE__).'/../../../libraries/PDF/' . $rendererLibrary;
|
||||
|
||||
if (!\PhpOffice\PhpSpreadsheet\Settings::setPdfRenderer(
|
||||
$rendererName,
|
||||
$rendererLibraryPath
|
||||
)) {
|
||||
die(
|
||||
'Please set the $rendererName and $rendererLibraryPath values' .
|
||||
PHP_EOL .
|
||||
' as appropriate for your directory structure'
|
||||
);
|
||||
}
|
||||
\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
|
||||
```
|
||||
|
||||
#### Writing a spreadsheet
|
||||
|
|
|
@ -116,3 +116,19 @@ $writer->setTempDir();
|
|||
|
||||
// After, there is no way to set temporary storage directory anymore
|
||||
```
|
||||
|
||||
## Autoloader
|
||||
|
||||
The class `PHPExcel_Autoloader` was removed entirely and is replaced by composer
|
||||
autoloading mechanism.
|
||||
|
||||
## Writing PDF
|
||||
|
||||
`PHPExcel_Settings::setPdfRenderer()` and `PHPExcel_Settings::setPdfRenderer()`
|
||||
were removed and PDF libraries must be installed via composer. So the only thing
|
||||
to do is to specify a renderer like so:
|
||||
|
||||
```php
|
||||
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
|
||||
\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
|
||||
```
|
||||
|
|
|
@ -14,10 +14,6 @@ if ($helper->isCli()) {
|
|||
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
|
||||
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
|
||||
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
|
||||
//$rendererLibrary = 'tcPDF5.9';
|
||||
$rendererLibrary = 'mPDF5.4';
|
||||
//$rendererLibrary = 'domPDF0.6.0beta3';
|
||||
$rendererLibraryPath = __DIR__ . '/../../../libraries/PDF/' . $rendererLibrary;
|
||||
|
||||
// Create new Spreadsheet object
|
||||
$spreadsheet = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
|
||||
|
@ -50,11 +46,7 @@ $spreadsheet->getActiveSheet()->setShowGridLines(false);
|
|||
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
|
||||
$spreadsheet->setActiveSheetIndex(0);
|
||||
|
||||
if (!\PhpOffice\PhpSpreadsheet\Settings::setPdfRenderer($rendererName, $rendererLibraryPath)) {
|
||||
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
||||
|
||||
return;
|
||||
}
|
||||
\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
|
||||
|
||||
// Redirect output to a client’s web browser (PDF)
|
||||
header('Content-Type: application/pdf');
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
<?php
|
||||
|
||||
require __DIR__ . '/Header.php';
|
||||
$spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||
|
||||
// Change these values to select the Rendering library that you wish to use
|
||||
// and its directory location on your server
|
||||
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
|
||||
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
|
||||
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
|
||||
//$rendererLibrary = 'tcPDF5.9';
|
||||
//$rendererLibrary = 'mPDF5.4';
|
||||
$rendererLibrary = 'domPDF0.6.0beta3';
|
||||
$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
|
||||
|
||||
$helper->log('Hide grid lines');
|
||||
$spreadsheet->getActiveSheet()->setShowGridLines(false);
|
||||
|
||||
$helper->log('Set orientation to landscape');
|
||||
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
|
||||
|
||||
$helper->log("Write to PDF format using {$rendererName}");
|
||||
|
||||
if (!\PhpOffice\PhpSpreadsheet\Settings::setPdfRenderer($rendererName, $rendererLibraryPath)) {
|
||||
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
||||
}
|
||||
|
||||
// Save
|
||||
$helper->write($spreadsheet, __FILE__, ['PDF' => 'pdf']);
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
require __DIR__ . '/Header.php';
|
||||
$spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||
|
||||
$helper->log('Hide grid lines');
|
||||
$spreadsheet->getActiveSheet()->setShowGridLines(false);
|
||||
|
||||
$helper->log('Set orientation to landscape');
|
||||
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
|
||||
|
||||
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
|
||||
$helper->log("Write to PDF format using {$rendererName}");
|
||||
\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
|
||||
|
||||
// Save
|
||||
$helper->write($spreadsheet, __FILE__, ['PDF' => 'pdf']);
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
require __DIR__ . '/Header.php';
|
||||
$spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||
|
||||
$helper->log('Hide grid lines');
|
||||
$spreadsheet->getActiveSheet()->setShowGridLines(false);
|
||||
|
||||
$helper->log('Set orientation to landscape');
|
||||
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
|
||||
|
||||
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
|
||||
$helper->log("Write to PDF format using {$rendererName}");
|
||||
\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
|
||||
|
||||
// Save
|
||||
$helper->write($spreadsheet, __FILE__, ['PDF' => 'pdf']);
|
|
@ -0,0 +1,17 @@
|
|||
<?php
|
||||
|
||||
require __DIR__ . '/Header.php';
|
||||
$spreadsheet = require __DIR__ . '/templates/sampleSpreadsheet.php';
|
||||
|
||||
$helper->log('Hide grid lines');
|
||||
$spreadsheet->getActiveSheet()->setShowGridLines(false);
|
||||
|
||||
$helper->log('Set orientation to landscape');
|
||||
$spreadsheet->getActiveSheet()->getPageSetup()->setOrientation(\PhpOffice\PhpSpreadsheet\Worksheet\PageSetup::ORIENTATION_LANDSCAPE);
|
||||
|
||||
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
|
||||
$helper->log("Write to PDF format using {$rendererName}");
|
||||
\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
|
||||
|
||||
// Save
|
||||
$helper->write($spreadsheet, __FILE__, ['PDF' => 'pdf']);
|
|
@ -7,10 +7,6 @@ require __DIR__ . '/Header.php';
|
|||
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
|
||||
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
|
||||
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
|
||||
//$rendererLibrary = 'tcPDF5.9';
|
||||
//$rendererLibrary = 'mPDF5.4';
|
||||
$rendererLibrary = 'domPDF0.6.0beta3';
|
||||
$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
|
||||
|
||||
// Read from Xlsx (.xlsx) template
|
||||
$helper->log('Load Xlsx template file');
|
||||
|
@ -22,15 +18,8 @@ $helper->write($spreadsheet, __FILE__, ['Xlsx' => 'xlsx', 'Xls' => 'xls', 'HTML'
|
|||
|
||||
// Export to PDF (.pdf)
|
||||
$helper->log('Write to PDF format');
|
||||
try {
|
||||
if (!\PhpOffice\PhpSpreadsheet\Settings::setPdfRenderer($rendererName, $rendererLibraryPath)) {
|
||||
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
||||
} else {
|
||||
$helper->write($spreadsheet, __FILE__, ['PDF' => 'pdf']);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$helper->log('EXCEPTION: ' . $e->getMessage());
|
||||
}
|
||||
\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
|
||||
$helper->write($spreadsheet, __FILE__, ['PDF' => 'pdf']);
|
||||
|
||||
// Remove first two rows with field headers before exporting to CSV
|
||||
$helper->log('Removing first two heading rows for CSV export');
|
||||
|
|
|
@ -7,16 +7,8 @@ require __DIR__ . '/Header.php';
|
|||
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF;
|
||||
$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF;
|
||||
//$rendererName = \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF;
|
||||
//$rendererLibrary = 'tcPDF5.9';
|
||||
$rendererLibrary = 'mPDF5.4';
|
||||
//$rendererLibrary = 'domPDF0.6.0beta3';
|
||||
$rendererLibraryPath = '/php/libraries/PDF/' . $rendererLibrary;
|
||||
|
||||
if (!\PhpOffice\PhpSpreadsheet\Settings::setPdfRenderer($rendererName, $rendererLibraryPath)) {
|
||||
$helper->log('NOTICE: Please set the $rendererName and $rendererLibraryPath values at the top of this script as appropriate for your directory structure');
|
||||
|
||||
return;
|
||||
}
|
||||
\PhpOffice\PhpSpreadsheet\Settings::setPdfRendererName($rendererName);
|
||||
|
||||
// Change these values to select the Rendering library that you wish to use
|
||||
// for Chart images, and its directory location on your server
|
||||
|
|
|
@ -1,68 +0,0 @@
|
|||
<?php
|
||||
|
||||
namespace PhpOffice\PhpSpreadsheet;
|
||||
|
||||
/**
|
||||
* Autoloader for PhpSpreadsheet classes.
|
||||
*
|
||||
* Copyright (c) 2006 - 2016 PhpSpreadsheet
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
* @category PhpSpreadsheet
|
||||
*
|
||||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
class Autoloader
|
||||
{
|
||||
/**
|
||||
* Register the Autoloader with SPL.
|
||||
*/
|
||||
public static function register()
|
||||
{
|
||||
if (function_exists('__autoload')) {
|
||||
// Register any existing autoloader function with SPL, so we don't get any clashes
|
||||
spl_autoload_register('__autoload');
|
||||
}
|
||||
// Register ourselves with SPL
|
||||
return spl_autoload_register([\PhpOffice\PhpSpreadsheet\Autoloader::class, 'load'], true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Autoload a class identified by name.
|
||||
*
|
||||
* @param string $className Name of the object to load
|
||||
*/
|
||||
public static function load($className)
|
||||
{
|
||||
$prefix = 'PhpOffice\\PhpSpreadsheet\\';
|
||||
if ((class_exists($className, false)) || (strpos($className, $prefix) !== 0)) {
|
||||
// Either already loaded, or not a PhpSpreadsheet class request
|
||||
return false;
|
||||
}
|
||||
|
||||
$classFilePath = __DIR__ . DIRECTORY_SEPARATOR .
|
||||
'PhpSpreadsheet' . DIRECTORY_SEPARATOR .
|
||||
str_replace([$prefix, '\\'], ['', '/'], $className) .
|
||||
'.php';
|
||||
|
||||
if ((file_exists($classFilePath) === false) || (is_readable($classFilePath) === false)) {
|
||||
// Can't load
|
||||
return false;
|
||||
}
|
||||
require $classFilePath;
|
||||
}
|
||||
}
|
|
@ -24,6 +24,19 @@
|
|||
* @copyright Copyright (c) 2006 - 2016 PhpSpreadsheet (https://github.com/PHPOffice/PhpSpreadsheet)
|
||||
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
|
||||
*/
|
||||
include_once __DIR__ . '/Autoloader.php';
|
||||
|
||||
\PhpOffice\PhpSpreadsheet\Autoloader::register();
|
||||
// This sucks, but we have to try to find the composer autoloader
|
||||
$paths = [
|
||||
__DIR__ . '/../vendor/autoload.php', // In case PhpSpreadsheet is cloned directly
|
||||
__DIR__ . '/../../../autoload.php', // In case PhpSpreadsheet is a composer dependency.
|
||||
];
|
||||
|
||||
foreach ($paths as $path) {
|
||||
if (file_exists($path)) {
|
||||
require_once $path;
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new \Exception('Composer autoloader could not be found. Install dependencies with `composer install` and try again.');
|
||||
|
|
|
@ -204,7 +204,6 @@ class Migrator
|
|||
'PHPExcel_Writer_PDF' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\PDF',
|
||||
'PHPExcel_Writer_Excel5' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Xls',
|
||||
'PHPExcel_Writer_Excel2007' => '\\PhpOffice\\PhpSpreadsheet\\Writer\\Xlsx',
|
||||
'PHPExcel_Autoloader' => '\\PhpOffice\\PhpSpreadsheet\\Autoloader',
|
||||
'PHPExcel_CachedObjectStorageFactory' => '\\PhpOffice\\PhpSpreadsheet\\CachedObjectStorageFactory',
|
||||
'PHPExcel_Calculation' => '\\PhpOffice\\PhpSpreadsheet\\Calculation',
|
||||
'PHPExcel_Cell' => '\\PhpOffice\\PhpSpreadsheet\\Cell',
|
||||
|
|
|
@ -83,13 +83,6 @@ class Settings
|
|||
*/
|
||||
private static $pdfRendererName;
|
||||
|
||||
/**
|
||||
* Directory Path to the external Library used for rendering PDF files.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private static $pdfRendererPath;
|
||||
|
||||
/**
|
||||
* Default options for libxml loader.
|
||||
*
|
||||
|
@ -251,26 +244,6 @@ class Settings
|
|||
return self::$chartRendererPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set details of the external library that PhpSpreadsheet should use for rendering PDF files.
|
||||
*
|
||||
* @param string $libraryName Internal reference name of the library
|
||||
* e.g. \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF,
|
||||
* \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF
|
||||
* or \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF
|
||||
* @param string $libraryBaseDir Directory path to the library's base folder
|
||||
*
|
||||
* @return bool Success or failure
|
||||
*/
|
||||
public static function setPdfRenderer($libraryName, $libraryBaseDir)
|
||||
{
|
||||
if (!self::setPdfRendererName($libraryName)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return self::setPdfRendererPath($libraryBaseDir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Identify to PhpSpreadsheet the external library to use for rendering PDF files.
|
||||
*
|
||||
|
@ -278,34 +251,13 @@ class Settings
|
|||
* e.g. \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_TCPDF,
|
||||
* \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_DOMPDF
|
||||
* or \PhpOffice\PhpSpreadsheet\Settings::PDF_RENDERER_MPDF
|
||||
*
|
||||
* @return bool Success or failure
|
||||
*/
|
||||
public static function setPdfRendererName($libraryName)
|
||||
{
|
||||
if (!in_array($libraryName, self::$pdfRenderers)) {
|
||||
return false;
|
||||
throw new Exception('"' . $libraryName . '" is not a valid PDF library name');
|
||||
}
|
||||
self::$pdfRendererName = $libraryName;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Tell PhpSpreadsheet where to find the external library to use for rendering PDF files.
|
||||
*
|
||||
* @param string $libraryBaseDir Directory path to the library's base folder
|
||||
*
|
||||
* @return bool Success or failure
|
||||
*/
|
||||
public static function setPdfRendererPath($libraryBaseDir)
|
||||
{
|
||||
if ((file_exists($libraryBaseDir) === false) || (is_readable($libraryBaseDir) === false)) {
|
||||
return false;
|
||||
}
|
||||
self::$pdfRendererPath = $libraryBaseDir;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -322,17 +274,6 @@ class Settings
|
|||
return self::$pdfRendererName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the directory path to the PDF Rendering Library that PhpSpreadsheet is currently configured to use.
|
||||
*
|
||||
* @return string|null Directory Path to the PDF Rendering Library that PhpSpreadsheet is
|
||||
* currently configured to use
|
||||
*/
|
||||
public static function getPdfRendererPath()
|
||||
{
|
||||
return self::$pdfRendererPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set default options for libxml loader.
|
||||
*
|
||||
|
|
|
@ -50,7 +50,7 @@ class HTML extends BaseWriter implements IWriter
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
private $imagesRoot = '.';
|
||||
private $imagesRoot = '';
|
||||
|
||||
/**
|
||||
* embed images, or link to images.
|
||||
|
|
|
@ -49,16 +49,6 @@ class PDF implements IWriter
|
|||
throw new Exception('PDF Rendering library has not been defined.');
|
||||
}
|
||||
|
||||
$pdfLibraryPath = \PhpOffice\PhpSpreadsheet\Settings::getPdfRendererPath();
|
||||
if (is_null($pdfLibraryPath)) {
|
||||
throw new Exception('PDF Rendering library path has not been defined.');
|
||||
}
|
||||
$includePath = str_replace('\\', '/', get_include_path());
|
||||
$rendererPath = str_replace('\\', '/', $pdfLibraryPath);
|
||||
if (strpos($rendererPath, $includePath) === false) {
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . $pdfLibraryPath);
|
||||
}
|
||||
|
||||
$rendererName = '\\PhpOffice\\PhpSpreadsheet\\Writer\\PDF\\' . $pdfLibraryName;
|
||||
$this->renderer = new $rendererName($spreadsheet);
|
||||
}
|
||||
|
|
|
@ -26,24 +26,6 @@ namespace PhpOffice\PhpSpreadsheet\Writer\PDF;
|
|||
*/
|
||||
class DomPDF extends Core implements \PhpOffice\PhpSpreadsheet\Writer\IWriter
|
||||
{
|
||||
/**
|
||||
* Create a new DomPDF Writer instance.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet Spreadsheet object
|
||||
*/
|
||||
public function __construct(\PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet)
|
||||
{
|
||||
parent::__construct($spreadsheet);
|
||||
|
||||
/* Require DomPDF library */
|
||||
$pdfRendererClassFile = \PhpOffice\PhpSpreadsheet\Settings::getPdfRendererPath() . '/dompdf_config.inc.php';
|
||||
if (file_exists($pdfRendererClassFile)) {
|
||||
require_once $pdfRendererClassFile;
|
||||
} else {
|
||||
throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('Unable to load PDF Rendering library');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Spreadsheet to file.
|
||||
*
|
||||
|
@ -89,7 +71,7 @@ class DomPDF extends Core implements \PhpOffice\PhpSpreadsheet\Writer\IWriter
|
|||
}
|
||||
|
||||
// Create PDF
|
||||
$pdf = new \DOMPDF();
|
||||
$pdf = new \Dompdf\Dompdf();
|
||||
$pdf->set_paper(strtolower($paperSize), $orientation);
|
||||
|
||||
$pdf->load_html(
|
||||
|
|
|
@ -26,26 +26,6 @@ namespace PhpOffice\PhpSpreadsheet\Writer\PDF;
|
|||
*/
|
||||
class MPDF extends Core implements \PhpOffice\PhpSpreadsheet\Writer\IWriter
|
||||
{
|
||||
/**
|
||||
* Create a mPDF Writer instance.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet Spreadsheet object
|
||||
*
|
||||
* @throws \PhpOffice\PhpSpreadsheet\Writer\Exception
|
||||
*/
|
||||
public function __construct(\PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet)
|
||||
{
|
||||
parent::__construct($spreadsheet);
|
||||
|
||||
/* Require mPDF library */
|
||||
$pdfRendererClassFile = \PhpOffice\PhpSpreadsheet\Settings::getPdfRendererPath() . '/mpdf.php';
|
||||
if (file_exists($pdfRendererClassFile)) {
|
||||
require_once $pdfRendererClassFile;
|
||||
} else {
|
||||
throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('Unable to load PDF Rendering library');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Spreadsheet to file.
|
||||
*
|
||||
|
@ -93,7 +73,7 @@ class MPDF extends Core implements \PhpOffice\PhpSpreadsheet\Writer\IWriter
|
|||
}
|
||||
|
||||
// Create PDF
|
||||
$pdf = new \Mpdf();
|
||||
$pdf = new \mPDF();
|
||||
$ortmp = $orientation;
|
||||
$pdf->_setPageSize(strtoupper($paperSize), $ortmp);
|
||||
$pdf->DefOrientation = $orientation;
|
||||
|
|
|
@ -26,25 +26,6 @@ namespace PhpOffice\PhpSpreadsheet\Writer\PDF;
|
|||
*/
|
||||
class TcPDF extends Core implements \PhpOffice\PhpSpreadsheet\Writer\IWriter
|
||||
{
|
||||
/**
|
||||
* Create a new tcPDF Writer instance.
|
||||
*
|
||||
* @param \PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet Spreadsheet object
|
||||
*/
|
||||
public function __construct(\PhpOffice\PhpSpreadsheet\Spreadsheet $spreadsheet)
|
||||
{
|
||||
parent::__construct($spreadsheet);
|
||||
|
||||
/* Require tcPDF library */
|
||||
$pdfRendererClassFile = \PhpOffice\PhpSpreadsheet\Settings::getPdfRendererPath() . '/tcpdf.php';
|
||||
if (file_exists($pdfRendererClassFile)) {
|
||||
$k_path_url = \PhpOffice\PhpSpreadsheet\Settings::getPdfRendererPath();
|
||||
require_once $pdfRendererClassFile;
|
||||
} else {
|
||||
throw new \PhpOffice\PhpSpreadsheet\Writer\Exception('Unable to load PDF Rendering library');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Save Spreadsheet to file.
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue