diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 31b587b..3bdae3e 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,3 +1,21 @@ +6.2.25 + - Fix support for image URLs. + +6.2.24 + - Support remote urls when checking if file exists. + +6.2.23 + - Simplify file_exists function. + +6.2.22 + - Fix for security vulnerability: Using the phar:// wrapper it was possible to trigger the unserialization of user provided data. + +6.2.19 + - Merge various fixes for PHP 7.3 compatibility and security. + +6.2.13 (2016-06-10) + - IMPORTANT: A new version of this library is under development at https://github.com/tecnickcom/tc-lib-pdf and as a consequence this version will not receive any additional development or support. This version should be considered obsolete, new projects should use the new version as soon it will become stable. + 6.2.12 (2015-09-12) - fix composer package name to tecnickcom/tcpdf diff --git a/README.TXT b/README.TXT index 2061fa7..baa5181 100644 --- a/README.TXT +++ b/README.TXT @@ -1,117 +1,84 @@ -TCPDF - README -============================================================ +# TCPDF +*PHP PDF Library* -I WISH TO IMPROVE AND EXPAND TCPDF BUT I NEED YOUR SUPPORT. -PLEASE MAKE A DONATION: -http://sourceforge.net/donate/index.php?group_id=128076 -or via PayPal at paypal@tecnick.com +[![Donate via PayPal](https://img.shields.io/badge/donate-paypal-87ceeb.svg)](https://www.paypal.com/cgi-bin/webscr?cmd=_donations¤cy_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20TCPDF%20project) +*Please consider supporting this project by making a donation via [PayPal](https://www.paypal.com/cgi-bin/webscr?cmd=_donations¤cy_code=GBP&business=paypal@tecnick.com&item_name=donation%20for%20TCPDF%20project)* ------------------------------------------------------------- - -Name: TCPDF -Version: 6.2.12 -Release date: 2015-09-12 -Author: Nicola Asuni - -Copyright (c) 2002-2015: - Nicola Asuni - Tecnick.com LTD - www.tecnick.com - -URLs: - http://www.tcpdf.org - http://www.sourceforge.net/projects/tcpdf - https://github.com/tecnickcom/TCPDF - -Description: - TCPDF is a PHP class for generating PDF files on-the-fly without requiring external extensions. - This library includes also a class to extract data from existing PDF documents and - classes to generate 1D and 2D barcodes in various formats. - -Main Features: - * no external libraries are required for the basic functions; - * all standard page formats, custom page formats, custom margins and units of measure; - * UTF-8 Unicode and Right-To-Left languages; - * TrueTypeUnicode, OpenTypeUnicode v1, TrueType, OpenType v1, Type1 and CID-0 fonts; - * font subsetting; - * methods to publish some XHTML + CSS code, Javascript and Forms; - * images, graphic (geometric figures) and transformation methods; - * supports JPEG, PNG and SVG images natively, all images supported by GD (GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM) and all images supported via ImagMagick (http://www.imagemagick.org/script/formats.php) - * 1D and 2D barcodes: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extension, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index - Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS, Datamatrix, QR-Code, PDF417; - * JPEG and PNG ICC profiles, Grayscale, RGB, CMYK, Spot Colors and Transparencies; - * automatic page header and footer management; - * document encryption up to 256 bit and digital signature certifications; - * transactions to UNDO commands; - * PDF annotations, including links, text and file attachments; - * text rendering modes (fill, stroke and clipping); - * multiple columns mode; - * no-write page regions; - * bookmarks, named destinations and table of content; - * text hyphenation; - * text stretching and spacing (tracking); - * automatic page break, line break and text alignments including justification; - * automatic page numbering and page groups; - * move and delete pages; - * page compression (requires php-zlib extension); - * XOBject Templates; - * Layers and object visibility. - * PDF/A-1b support. - -Installation (full instructions on http: www.tcpdf.org): - 1. copy the folder on your Web server - 2. set your installation path and other parameters on the config/tcpdf_config.php - 3. call the examples/example_001.php page with your browser to see an example - -Source Code Documentation: - http://www.tcpdf.org - -Additional Documentation: - http://www.tcpdf.org - -License: - Copyright (C) 2002-2014 Nicola Asuni - Tecnick.com LTD - - TCPDF 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 3 of the - License, or (at your option) any later version. - - TCPDF 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 License - along with TCPDF. If not, see - . - - See LICENSE.TXT file for more information. - -Third party fonts: - - This library may include third party font files released with different licenses. - - All the PHP files on the fonts directory are subject to the general TCPDF license (GNU-LGPLv3), - they do not contain any binary data but just a description of the general properties of a particular font. - These files can be also generated on the fly using the font utilities and TCPDF methods. - - All the original binary TTF font files have been renamed for compatibility with TCPDF and compressed using the gzcompress PHP function that uses the ZLIB data format (.z files). - - The binary files (.z) that begins with the prefix "free" have been extracted from the GNU FreeFont collection (GNU-GPLv3). - The binary files (.z) that begins with the prefix "pdfa" have been derived from the GNU FreeFont, so they are subject to the same license. - For the details of Copyright, License and other information, please check the files inside the directory fonts/freefont-20120503 - Link : http://www.gnu.org/software/freefont/ - - The binary files (.z) that begins with the prefix "dejavu" have been extracted from the DejaVu fonts 2.33 (Bitstream) collection. - For the details of Copyright, License and other information, please check the files inside the directory fonts/dejavu-fonts-ttf-2.33 - Link : http://dejavu-fonts.org - - The binary files (.z) that begins with the prefix "ae" have been extracted from the Arabeyes.org collection (GNU-GPLv2). - Link : http://projects.arabeyes.org/ - -ICC profile: - TCPDF includes the sRGB.icc profile from the icc-profiles-free Debian package: - https://packages.debian.org/source/stable/icc-profiles-free +* **category** Library +* **author** Nicola Asuni +* **copyright** 2002-2018 Nicola Asuni - Tecnick.com LTD +* **license** http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT) +* **link** http://www.tcpdf.org +* **source** https://github.com/tecnickcom/TCPDF -============================================================ +## IMPORTANT +A new version of this library is under development at https://github.com/tecnickcom/tc-lib-pdf and as a consequence this version will not receive any additional development or support. +This version should be considered obsolete, new projects should use the new version as soon it will become stable. + + + +## Description + +PHP library for generating PDF documents on-the-fly. + +### Main Features: +* no external libraries are required for the basic functions; +* all standard page formats, custom page formats, custom margins and units of measure; +* UTF-8 Unicode and Right-To-Left languages; +* TrueTypeUnicode, OpenTypeUnicode v1, TrueType, OpenType v1, Type1 and CID-0 fonts; +* font subsetting; +* methods to publish some XHTML + CSS code, Javascript and Forms; +* images, graphic (geometric figures) and transformation methods; +* supports JPEG, PNG and SVG images natively, all images supported by GD (GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM) and all images supported via ImagMagick (http://www.imagemagick.org/script/formats.php) +* 1D and 2D barcodes: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extension, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index - Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS, Datamatrix, QR-Code, PDF417; +* JPEG and PNG ICC profiles, Grayscale, RGB, CMYK, Spot Colors and Transparencies; +* automatic page header and footer management; +* document encryption up to 256 bit and digital signature certifications; +* transactions to UNDO commands; +* PDF annotations, including links, text and file attachments; +* text rendering modes (fill, stroke and clipping); +* multiple columns mode; +* no-write page regions; +* bookmarks, named destinations and table of content; +* text hyphenation; +* text stretching and spacing (tracking); +* automatic page break, line break and text alignments including justification; +* automatic page numbering and page groups; +* move and delete pages; +* page compression (requires php-zlib extension); +* XOBject Templates; +* Layers and object visibility. +* PDF/A-1b support. + +### Third party fonts: + +This library may include third party font files released with different licenses. + +All the PHP files on the fonts directory are subject to the general TCPDF license (GNU-LGPLv3), +they do not contain any binary data but just a description of the general properties of a particular font. +These files can be also generated on the fly using the font utilities and TCPDF methods. + +All the original binary TTF font files have been renamed for compatibility with TCPDF and compressed using the gzcompress PHP function that uses the ZLIB data format (.z files). + +The binary files (.z) that begins with the prefix "free" have been extracted from the GNU FreeFont collection (GNU-GPLv3). +The binary files (.z) that begins with the prefix "pdfa" have been derived from the GNU FreeFont, so they are subject to the same license. +For the details of Copyright, License and other information, please check the files inside the directory fonts/freefont-20120503 +Link : http://www.gnu.org/software/freefont/ + +The binary files (.z) that begins with the prefix "dejavu" have been extracted from the DejaVu fonts 2.33 (Bitstream) collection. +For the details of Copyright, License and other information, please check the files inside the directory fonts/dejavu-fonts-ttf-2.33 +Link : http://dejavu-fonts.org + +The binary files (.z) that begins with the prefix "ae" have been extracted from the Arabeyes.org collection (GNU-GPLv2). +Link : http://projects.arabeyes.org/ + +### ICC profile: + +TCPDF includes the sRGB.icc profile from the icc-profiles-free Debian package: +https://packages.debian.org/source/stable/icc-profiles-free + + +## Developer(s) Contact + +* Nicola Asuni diff --git a/README.md b/README.md index 0b28f40..e77982f 100644 --- a/README.md +++ b/README.md @@ -6,44 +6,73 @@ TCPDF is a PHP class for generating PDF files on-the-fly without requiring exter This library includes also a class to extract data from existing PDF documents and classes to generate 1D and 2D barcodes in various formats. ## Main Features: -+ no external libraries are required for the basic functions; -+ all standard page formats, custom page formats, custom margins and units of measure; -+ UTF-8 Unicode and Right-To-Left languages; -+ TrueTypeUnicode, OpenTypeUnicode v1, TrueType, OpenType v1, Type1 and CID-0 fonts; -+ font subsetting; -+ methods to publish some XHTML + CSS code, Javascript and Forms; -+ images, graphic (geometric figures) and transformation methods; -+ supports JPEG, PNG and SVG images natively, all images supported by GD (GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM) and all images supported via ImagMagick (http://www.imagemagick.org/script/formats.php) -+ 1D and 2D barcodes: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extension, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index - Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS, Datamatrix, QR-Code, PDF417; -+ JPEG and PNG ICC profiles, Grayscale, RGB, CMYK, Spot Colors and Transparencies; -+ automatic page header and footer management; -+ document encryption up to 256 bit and digital signature certifications; -+ transactions to UNDO commands; -+ PDF annotations, including links, text and file attachments; -+ text rendering modes (fill, stroke and clipping); -+ multiple columns mode; -+ no-write page regions; -+ bookmarks, named destinations and table of content; -+ text hyphenation; -+ text stretching and spacing (tracking); -+ automatic page break, line break and text alignments including justification; -+ automatic page numbering and page groups; -+ move and delete pages; -+ page compression (requires php-zlib extension); -+ XOBject Templates; - * Layers and object visibility. - * PDF/A-1b support. +* no external libraries are required for the basic functions; +* all standard page formats, custom page formats, custom margins and units of measure; +* UTF-8 Unicode and Right-To-Left languages; +* TrueTypeUnicode, OpenTypeUnicode v1, TrueType, OpenType v1, Type1 and CID-0 fonts; +* font subsetting; +* methods to publish some XHTML + CSS code, Javascript and Forms; +* images, graphic (geometric figures) and transformation methods; +* supports JPEG, PNG and SVG images natively, all images supported by GD (GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM) and all images supported via ImagMagick (http://www.imagemagick.org/script/formats.php) +* 1D and 2D barcodes: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extension, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index - Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS, Datamatrix, QR-Code, PDF417; +* JPEG and PNG ICC profiles, Grayscale, RGB, CMYK, Spot Colors and Transparencies; +* automatic page header and footer management; +* document encryption up to 256 bit and digital signature certifications; +* transactions to UNDO commands; +* PDF annotations, including links, text and file attachments; +* text rendering modes (fill, stroke and clipping); +* multiple columns mode; +* no-write page regions; +* bookmarks, named destinations and table of content; +* text hyphenation; +* text stretching and spacing (tracking); +* automatic page break, line break and text alignments including justification; +* automatic page numbering and page groups; +* move and delete pages; +* page compression (requires php-zlib extension); +* XOBject Templates; +* Layers and object visibility. +* PDF/A-1b support. -Version: 6.2.12 -Release date: 2015-09-12 -Author: Nicola Asuni +### Third party fonts: -Copyright (c) 2002-2015: - Nicola Asuni - Tecnick.com LTD - www.tecnick.com +This library may include third party font files released with different licenses. -> Compiled into an installer for Joomla 3 by [Llewellyn van der Merwe] (mailto:joomla@vdm.io) at [Vast Development Method] (https://www.vdm.io/) +All the PHP files on the fonts directory are subject to the general TCPDF license (GNU-LGPLv3), +they do not contain any binary data but just a description of the general properties of a particular font. +These files can be also generated on the fly using the font utilities and TCPDF methods. + +All the original binary TTF font files have been renamed for compatibility with TCPDF and compressed using the gzcompress PHP function that uses the ZLIB data format (.z files). + +The binary files (.z) that begins with the prefix "free" have been extracted from the GNU FreeFont collection (GNU-GPLv3). +The binary files (.z) that begins with the prefix "pdfa" have been derived from the GNU FreeFont, so they are subject to the same license. +For the details of Copyright, License and other information, please check the files inside the directory fonts/freefont-20120503 +Link : http://www.gnu.org/software/freefont/ + +The binary files (.z) that begins with the prefix "dejavu" have been extracted from the DejaVu fonts 2.33 (Bitstream) collection. +For the details of Copyright, License and other information, please check the files inside the directory fonts/dejavu-fonts-ttf-2.33 +Link : http://dejavu-fonts.org + +The binary files (.z) that begins with the prefix "ae" have been extracted from the Arabeyes.org collection (GNU-GPLv2). +Link : http://projects.arabeyes.org/ + +### ICC profile: + +TCPDF includes the sRGB.icc profile from the icc-profiles-free Debian package: +https://packages.debian.org/source/stable/icc-profiles-free + +* **category** Library +* **author** Nicola Asuni +* **copyright** 2002-2018 Nicola Asuni - Tecnick.com LTD +* **license** http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT) +* **link** http://www.tcpdf.org +* **source** https://github.com/tecnickcom/TCPDF + +## Developer(s) Contact + +* Nicola Asuni + +> Compiled into an installer for Joomla 3 by [Llewellyn van der Merwe](mailto:joomla@vdm.io) at [Vast Development Method](https://www.vdm.io/) # Usage in Joomla (PHP) ```php @@ -61,11 +90,11 @@ $pdf = new TCPDF(); ``` # Documentation -+ [Source Code Documentation] (http://www.tcpdf.org) -+ [Additional Documentation] (http://www.tcpdf.org) ++ [Source Code Documentation](http://www.tcpdf.org) ++ [Additional Documentation](http://www.tcpdf.org) # Automatic updates This library is integrated with Joomla's automatic updates. Before updating it's mandatory that you check that your documents still work as expected. # License -TCPDF is licensed under LGPL ([GNU LESSER GENERAL PUBLIC LICENSE] (https://github.com/vdm-io/tcpdf/blob/master/tcpdf/LICENSE.TXT)) \ No newline at end of file +TCPDF is licensed under LGPL ([GNU LESSER GENERAL PUBLIC LICENSE](https://github.com/vdm-io/tcpdf/blob/master/LICENSE.TXT)) diff --git a/composer.json b/composer.json index beab509..1f19dfd 100644 --- a/composer.json +++ b/composer.json @@ -1,40 +1,47 @@ { - "name": "tecnickcom/tcpdf", - "version": "6.2.12", - "homepage": "http://www.tcpdf.org/", - "type": "library", - "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", - "keywords": ["PDF","tcpdf","PDFD32000-2008","qrcode","datamatrix","pdf417","barcodes"], - "license": "LGPLv3", - "authors": [ - { - "name": "Nicola Asuni", - "email": "info@tecnick.com", - "homepage": "http://nicolaasuni.tecnick.com" - } - ], - "require": { - "php": ">=5.3.0" - }, - "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" - ] - } + "name": "tecnickcom/tcpdf", + "version": "6.2.26", + "homepage": "http://www.tcpdf.org/", + "type": "library", + "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", + "keywords": [ + "PDF", + "tcpdf", + "PDFD32000-2008", + "qrcode", + "datamatrix", + "pdf417", + "barcodes" + ], + "license": "LGPL-3.0", + "authors": [ + { + "name": "Nicola Asuni", + "email": "info@tecnick.com", + "role": "lead" + } + ], + "require": { + "php": ">=5.3.0" + }, + "autoload": { + "classmap": [ + "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" + ] + } } diff --git a/examples/example_001.php b/examples/example_001.php old mode 100755 new mode 100644 diff --git a/examples/example_002.php b/examples/example_002.php old mode 100755 new mode 100644 diff --git a/examples/example_003.php b/examples/example_003.php old mode 100755 new mode 100644 diff --git a/examples/example_004.php b/examples/example_004.php old mode 100755 new mode 100644 diff --git a/examples/example_005.php b/examples/example_005.php old mode 100755 new mode 100644 diff --git a/examples/example_006.php b/examples/example_006.php old mode 100755 new mode 100644 diff --git a/examples/example_007.php b/examples/example_007.php old mode 100755 new mode 100644 diff --git a/examples/example_008.php b/examples/example_008.php old mode 100755 new mode 100644 diff --git a/examples/example_009.php b/examples/example_009.php old mode 100755 new mode 100644 diff --git a/examples/example_010.php b/examples/example_010.php old mode 100755 new mode 100644 diff --git a/examples/example_011.php b/examples/example_011.php old mode 100755 new mode 100644 diff --git a/examples/example_012.php b/examples/example_012.php old mode 100755 new mode 100644 diff --git a/examples/example_013.php b/examples/example_013.php old mode 100755 new mode 100644 diff --git a/examples/example_014.php b/examples/example_014.php old mode 100755 new mode 100644 diff --git a/examples/example_015.php b/examples/example_015.php old mode 100755 new mode 100644 diff --git a/examples/example_016.php b/examples/example_016.php old mode 100755 new mode 100644 diff --git a/examples/example_017.php b/examples/example_017.php old mode 100755 new mode 100644 diff --git a/examples/example_018.php b/examples/example_018.php old mode 100755 new mode 100644 diff --git a/examples/example_019.php b/examples/example_019.php old mode 100755 new mode 100644 diff --git a/examples/example_020.php b/examples/example_020.php old mode 100755 new mode 100644 diff --git a/examples/example_021.php b/examples/example_021.php old mode 100755 new mode 100644 diff --git a/examples/example_022.php b/examples/example_022.php old mode 100755 new mode 100644 diff --git a/examples/example_023.php b/examples/example_023.php old mode 100755 new mode 100644 diff --git a/examples/example_024.php b/examples/example_024.php old mode 100755 new mode 100644 diff --git a/examples/example_025.php b/examples/example_025.php old mode 100755 new mode 100644 diff --git a/examples/example_026.php b/examples/example_026.php old mode 100755 new mode 100644 diff --git a/examples/example_027.php b/examples/example_027.php old mode 100755 new mode 100644 diff --git a/examples/example_028.php b/examples/example_028.php old mode 100755 new mode 100644 diff --git a/examples/example_029.php b/examples/example_029.php old mode 100755 new mode 100644 diff --git a/examples/example_030.php b/examples/example_030.php old mode 100755 new mode 100644 diff --git a/examples/example_031.php b/examples/example_031.php old mode 100755 new mode 100644 diff --git a/examples/example_032.php b/examples/example_032.php old mode 100755 new mode 100644 diff --git a/examples/example_033.php b/examples/example_033.php old mode 100755 new mode 100644 diff --git a/examples/example_034.php b/examples/example_034.php old mode 100755 new mode 100644 diff --git a/examples/example_035.php b/examples/example_035.php old mode 100755 new mode 100644 diff --git a/examples/example_036.php b/examples/example_036.php old mode 100755 new mode 100644 diff --git a/examples/example_037.php b/examples/example_037.php old mode 100755 new mode 100644 diff --git a/examples/example_038.php b/examples/example_038.php old mode 100755 new mode 100644 diff --git a/examples/example_039.php b/examples/example_039.php old mode 100755 new mode 100644 diff --git a/examples/example_040.php b/examples/example_040.php old mode 100755 new mode 100644 diff --git a/examples/example_041.php b/examples/example_041.php old mode 100755 new mode 100644 diff --git a/examples/example_042.php b/examples/example_042.php old mode 100755 new mode 100644 diff --git a/examples/example_043.php b/examples/example_043.php old mode 100755 new mode 100644 diff --git a/examples/example_044.php b/examples/example_044.php old mode 100755 new mode 100644 diff --git a/examples/example_045.php b/examples/example_045.php old mode 100755 new mode 100644 diff --git a/examples/example_046.php b/examples/example_046.php old mode 100755 new mode 100644 diff --git a/examples/example_047.php b/examples/example_047.php old mode 100755 new mode 100644 diff --git a/examples/example_048.php b/examples/example_048.php old mode 100755 new mode 100644 diff --git a/examples/example_049.php b/examples/example_049.php old mode 100755 new mode 100644 diff --git a/examples/example_050.php b/examples/example_050.php old mode 100755 new mode 100644 diff --git a/examples/example_051.php b/examples/example_051.php old mode 100755 new mode 100644 diff --git a/examples/example_052.php b/examples/example_052.php old mode 100755 new mode 100644 diff --git a/examples/example_053.php b/examples/example_053.php old mode 100755 new mode 100644 diff --git a/examples/example_054.php b/examples/example_054.php old mode 100755 new mode 100644 diff --git a/examples/example_055.php b/examples/example_055.php old mode 100755 new mode 100644 diff --git a/examples/example_056.php b/examples/example_056.php old mode 100755 new mode 100644 diff --git a/examples/example_057.php b/examples/example_057.php old mode 100755 new mode 100644 diff --git a/examples/example_058.php b/examples/example_058.php old mode 100755 new mode 100644 diff --git a/examples/example_059.php b/examples/example_059.php old mode 100755 new mode 100644 diff --git a/examples/example_060.php b/examples/example_060.php old mode 100755 new mode 100644 diff --git a/examples/example_061.php b/examples/example_061.php old mode 100755 new mode 100644 diff --git a/examples/example_062.php b/examples/example_062.php old mode 100755 new mode 100644 diff --git a/examples/example_063.php b/examples/example_063.php old mode 100755 new mode 100644 diff --git a/examples/example_064.php b/examples/example_064.php old mode 100755 new mode 100644 diff --git a/examples/example_065.php b/examples/example_065.php old mode 100755 new mode 100644 diff --git a/examples/index.php b/examples/index.php old mode 100755 new mode 100644 diff --git a/include/barcodes/pdf417.php b/include/barcodes/pdf417.php index 4fbe652..3b1774e 100644 --- a/include/barcodes/pdf417.php +++ b/include/barcodes/pdf417.php @@ -740,16 +740,6 @@ class PDF417 { * @protected */ protected function getErrorCorrectionLevel($ecl, $numcw) { - // get maximum correction level - $maxecl = 8; // starting error level - $maxerrsize = (928 - $numcw); // available codewords for error - while ($maxecl > 0) { - $errsize = (2 << $ecl); - if ($maxerrsize >= $errsize) { - break; - } - --$maxecl; - } // check for automatic levels if (($ecl < 0) OR ($ecl > 8)) { if ($numcw < 41) { @@ -764,6 +754,16 @@ class PDF417 { $ecl = $maxecl; } } + // get maximum correction level + $maxecl = 8; // starting error level + $maxerrsize = (928 - $numcw); // available codewords for error + while ($maxecl > 0) { + $errsize = (2 << $ecl); + if ($maxerrsize >= $errsize) { + break; + } + --$maxecl; + } if ($ecl > $maxecl) { $ecl = $maxecl; } diff --git a/include/sRGB.icc b/include/sRGB.icc index 71e3383..1d8f741 100644 Binary files a/include/sRGB.icc and b/include/sRGB.icc differ diff --git a/include/tcpdf_fonts.php b/include/tcpdf_fonts.php index 70ca893..9242ca4 100644 --- a/include/tcpdf_fonts.php +++ b/include/tcpdf_fonts.php @@ -70,7 +70,7 @@ class TCPDF_FONTS { * @public static */ public static function addTTFfont($fontfile, $fonttype='', $enc='', $flags=32, $outpath='', $platid=3, $encid=1, $addcbbox=false, $link=false) { - if (!file_exists($fontfile)) { + if (!TCPDF_STATIC::file_exists($fontfile)) { // Could not find file return false; } @@ -95,7 +95,7 @@ class TCPDF_FONTS { $outpath = self::_getfontpath(); } // check if this font already exist - if (@file_exists($outpath.$font_name.'.php')) { + if (@TCPDF_STATIC::file_exists($outpath.$font_name.'.php')) { // this font already exist (delete it from fonts folder to rebuild it) return $font_name; } @@ -665,7 +665,7 @@ class TCPDF_FONTS { $glyphIdArray[$k] = TCPDF_STATIC::_getUSHORT($font, $offset); $offset += 2; } - for ($k = 0; $k < $segCount; ++$k) { + for ($k = 0; $k < $segCount - 1; ++$k) { for ($c = $startCount[$k]; $c <= $endCount[$k]; ++$c) { if ($idRangeOffset[$k] == 0) { $g = ($idDelta[$k] + $c) % 65536; @@ -1543,11 +1543,11 @@ class TCPDF_FONTS { public static function getFontFullPath($file, $fontdir=false) { $fontfile = ''; // search files on various directories - if (($fontdir !== false) AND @file_exists($fontdir.$file)) { + if (($fontdir !== false) AND @TCPDF_STATIC::file_exists($fontdir.$file)) { $fontfile = $fontdir.$file; - } elseif (@file_exists(self::_getfontpath().$file)) { + } elseif (@TCPDF_STATIC::file_exists(self::_getfontpath().$file)) { $fontfile = self::_getfontpath().$file; - } elseif (@file_exists($file)) { + } elseif (@TCPDF_STATIC::file_exists($file)) { $fontfile = $file; } return $fontfile; @@ -2003,7 +2003,11 @@ class TCPDF_FONTS { $chars = str_split($str); $carr = array_map('ord', $chars); } - $currentfont['subsetchars'] += array_fill_keys($carr, true); + if (is_array($currentfont['subsetchars']) && is_array($carr)) { + $currentfont['subsetchars'] += array_fill_keys($carr, true); + } else { + $currentfont['subsetchars'] = array_merge($currentfont['subsetchars'], $carr); + } return $carr; } diff --git a/include/tcpdf_images.php b/include/tcpdf_images.php index c2e3c36..86b3c20 100644 --- a/include/tcpdf_images.php +++ b/include/tcpdf_images.php @@ -161,12 +161,8 @@ class TCPDF_IMAGES { */ public static function _parsejpeg($file) { // check if is a local file - if (!@file_exists($file)) { - // try to encode spaces on filename - $tfile = str_replace(' ', '%20', $file); - if (@file_exists($tfile)) { - $file = $tfile; - } + if (!@TCPDF_STATIC::file_exists($file)) { + return false; } $a = getimagesize($file); if (empty($a)) { diff --git a/include/tcpdf_static.php b/include/tcpdf_static.php index f6d4d2b..df1b28e 100644 --- a/include/tcpdf_static.php +++ b/include/tcpdf_static.php @@ -55,7 +55,7 @@ class TCPDF_STATIC { * Current TCPDF version. * @private static */ - private static $tcpdf_version = '6.2.12'; + private static $tcpdf_version = '6.2.26'; /** * String alias for total number of pages. @@ -1774,39 +1774,6 @@ class TCPDF_STATIC { return $angle; } - - - - - - - - - - - - - - - - -// ==================================================================================================================== -// REIMPLEMENTED -// ==================================================================================================================== - - - - - - - - - - - - - - /** * Split string by a regular expression. * This is a wrapper for the preg_split function to avoid the bug: https://bugs.php.net/bug.php?id=45850 @@ -1854,6 +1821,49 @@ class TCPDF_STATIC { return fopen($filename, $mode); } + /** + * Check if the URL exist. + * @param url (string) URL to check. + * @return Returns TRUE if the URL exists; FALSE otherwise. + * @public static + */ + public static function url_exists($url) { + $crs = curl_init(); + curl_setopt($crs, CURLOPT_URL, $url); + curl_setopt($crs, CURLOPT_NOBODY, true); + curl_setopt($crs, CURLOPT_FAILONERROR, true); + if ((ini_get('open_basedir') == '') && (!ini_get('safe_mode'))) { + curl_setopt($crs, CURLOPT_FOLLOWLOCATION, true); + } + curl_setopt($crs, CURLOPT_CONNECTTIMEOUT, 5); + curl_setopt($crs, CURLOPT_TIMEOUT, 30); + curl_setopt($crs, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($crs, CURLOPT_SSL_VERIFYHOST, false); + curl_setopt($crs, CURLOPT_USERAGENT, 'tc-lib-file'); + curl_exec($crs); + $code = curl_getinfo($crs, CURLINFO_HTTP_CODE); + curl_close($crs); + return ($code == 200); + } + + /** + * Wrapper for file_exists. + * Checks whether a file or directory exists. + * Only allows some protocols and local files. + * @param filename (string) Path to the file or directory. + * @return Returns TRUE if the file or directory specified by filename exists; FALSE otherwise. + * @public static + */ + public static function file_exists($filename) { + if (preg_match('|^https?://|', $filename) == 1) { + return self::url_exists($filename); + } + if (strpos($filename, '://')) { + return false; // only support http and https wrappers for security reasons + } + return @file_exists($filename); + } + /** * Reads entire file into a string. * The file can be also an URL. @@ -1910,12 +1920,14 @@ class TCPDF_STATIC { && !preg_match('%^//%', $file) ) { $urldata = @parse_url($_SERVER['SCRIPT_URI']); - return $urldata['scheme'].'://'.$urldata['host'].(($file[0] == '/') ? '' : '/').$file; + $alt[] = $urldata['scheme'].'://'.$urldata['host'].(($file[0] == '/') ? '' : '/').$file; } // $alt = array_unique($alt); - //var_dump($alt);exit;//DEBUG foreach ($alt as $path) { + if (!self::file_exists($path)) { + return false; + } $ret = @file_get_contents($path); if ($ret !== false) { return $ret; @@ -1949,8 +1961,6 @@ class TCPDF_STATIC { return false; } - - /** * Get ULONG from string (Big Endian 32-bit unsigned integer). * @param $str (string) string from where to extract value diff --git a/tcpdf.php b/tcpdf.php index 599a3f8..24ef434 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,13 +1,13 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 6.2.8 + * @version 6.2.26 */ // TCPDF configuration @@ -128,8 +128,11 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.php'); * TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.
* @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 6.2.8 + * @version 6.2.26 * @author Nicola Asuni - info@tecnick.com + * @IgnoreAnnotation("protected") + * @IgnoreAnnotation("public") + * @IgnoreAnnotation("pre") */ class TCPDF { @@ -1822,9 +1825,9 @@ class TCPDF { /** * This is the class constructor. * It allows to set up the page format, the orientation and the measure unit used in all the methods (except for the font sizes). - * + * * IMPORTANT: Please note that this method sets the mb_internal_encoding to ASCII, so if you are using the mbstring module functions with TCPDF you need to correctly set/unset the mb_internal_encoding when needed. - * + * * @param $orientation (string) page orientation. Possible values are (case insensitive):
  • P or Portrait (default)
  • L or Landscape
  • '' (empty string) for automatic orientation
* @param $unit (string) User measure unit. Possible values are:
  • pt: point
  • mm: millimeter (default)
  • cm: centimeter
  • in: inch

A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit. * @param $format (mixed) The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat(). @@ -1994,10 +1997,6 @@ class TCPDF { * @since 1.53.0.TC016 */ public function __destruct() { - // restore internal encoding - if (isset($this->internal_encoding) AND !empty($this->internal_encoding)) { - mb_internal_encoding($this->internal_encoding); - } // cleanup $this->_destroy(true); } @@ -4257,7 +4256,7 @@ class TCPDF { // true when the font style variation is missing $missing_style = false; // search and include font file - if (TCPDF_STATIC::empty_string($fontfile) OR (!@file_exists($fontfile))) { + if (TCPDF_STATIC::empty_string($fontfile) OR (!@TCPDF_STATIC::file_exists($fontfile))) { // build a standard filenames for specified font $tmp_fontfile = str_replace(' ', '', $family).strtolower($style).'.php'; $fontfile = TCPDF_FONTS::getFontFullPath($tmp_fontfile, $fontdir); @@ -4269,7 +4268,7 @@ class TCPDF { } } // include font file - if (!TCPDF_STATIC::empty_string($fontfile) AND (@file_exists($fontfile))) { + if (!TCPDF_STATIC::empty_string($fontfile) AND (@TCPDF_STATIC::file_exists($fontfile))) { include($fontfile); } else { $this->Error('Could not include font definition file: '.$family.''); @@ -4453,6 +4452,7 @@ class TCPDF { * @see SetFont() */ public function SetFontSize($size, $out=true) { + $size = (float)$size; // font size in points $this->FontSizePt = $size; // font size in user units @@ -4691,7 +4691,7 @@ class TCPDF { * Defines the page and position a link points to. * @param $link (int) The link identifier returned by AddLink() * @param $y (float) Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page) - * @param $page (int) Number of target page; -1 indicates the current page (default value). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages. + * @param $page (int) Number of target page; -1 indicates the current page (default value). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages. * @public * @since 1.5 * @see AddLink() @@ -4809,19 +4809,19 @@ class TCPDF { $this->PageAnnots[$page][] = array('n' => ++$this->n, 'x' => $x, 'y' => $y, 'w' => $w, 'h' => $h, 'txt' => $text, 'opt' => $opt, 'numspaces' => $spaces); if (!$this->pdfa_mode) { if ((($opt['Subtype'] == 'FileAttachment') OR ($opt['Subtype'] == 'Sound')) AND (!TCPDF_STATIC::empty_string($opt['FS'])) - AND (@file_exists($opt['FS']) OR TCPDF_STATIC::isValidURL($opt['FS'])) + AND (@TCPDF_STATIC::file_exists($opt['FS']) OR TCPDF_STATIC::isValidURL($opt['FS'])) AND (!isset($this->embeddedfiles[basename($opt['FS'])]))) { $this->embeddedfiles[basename($opt['FS'])] = array('f' => ++$this->n, 'n' => ++$this->n, 'file' => $opt['FS']); } } // Add widgets annotation's icons - if (isset($opt['mk']['i']) AND @file_exists($opt['mk']['i'])) { + if (isset($opt['mk']['i']) AND @TCPDF_STATIC::file_exists($opt['mk']['i'])) { $this->Image($opt['mk']['i'], '', '', 10, 10, '', '', '', false, 300, '', false, false, 0, false, true); } - if (isset($opt['mk']['ri']) AND @file_exists($opt['mk']['ri'])) { + if (isset($opt['mk']['ri']) AND @TCPDF_STATIC::file_exists($opt['mk']['ri'])) { $this->Image($opt['mk']['ri'], '', '', 0, 0, '', '', '', false, 300, '', false, false, 0, false, true); } - if (isset($opt['mk']['ix']) AND @file_exists($opt['mk']['ix'])) { + if (isset($opt['mk']['ix']) AND @TCPDF_STATIC::file_exists($opt['mk']['ix'])) { $this->Image($opt['mk']['ix'], '', '', 0, 0, '', '', '', false, 300, '', false, false, 0, false, true); } } @@ -5769,10 +5769,9 @@ class TCPDF { $this->resetLastH(); } if (!TCPDF_STATIC::empty_string($y)) { - $this->SetY($y); - } else { - $y = $this->GetY(); + $this->SetY($y); // set y in order to convert negative y values to positive ones } + $y = $this->GetY(); $resth = 0; if (($h > 0) AND $this->inPageBody() AND (($y + $h + $mc_margin['T'] + $mc_margin['B']) > $this->PageBreakTrigger)) { // spit cell in more pages/columns @@ -5944,7 +5943,9 @@ class TCPDF { if ($startpage == $endpage) { // single page for ($column = $startcolumn; $column <= $endcolumn; ++$column) { // for each column - $this->selectColumn($column); + if ($column != $this->current_column) { + $this->selectColumn($column); + } if ($this->rtl) { $this->x -= $mc_margin['R']; } else { @@ -5973,7 +5974,9 @@ class TCPDF { } // end for each column } elseif ($page == $startpage) { // first page for ($column = $startcolumn; $column < $this->num_columns; ++$column) { // for each column - $this->selectColumn($column); + if ($column != $this->current_column) { + $this->selectColumn($column); + } if ($this->rtl) { $this->x -= $mc_margin['R']; } else { @@ -5992,7 +5995,9 @@ class TCPDF { } // end for each column } elseif ($page == $endpage) { // last page for ($column = 0; $column <= $endcolumn; ++$column) { // for each column - $this->selectColumn($column); + if ($column != $this->current_column) { + $this->selectColumn($column); + } if ($this->rtl) { $this->x -= $mc_margin['R']; } else { @@ -6839,13 +6844,9 @@ class TCPDF { $file = substr($file, 1); $exurl = $file; } - // check if is a local file - if (!@file_exists($file)) { - // try to encode spaces on filename - $tfile = str_replace(' ', '%20', $file); - if (@file_exists($tfile)) { - $file = $tfile; - } + // check if file exist and it is valid + if (!@TCPDF_STATIC::file_exists($file)) { + return false; } if (($imsize = @getimagesize($file)) === FALSE) { if (in_array($file, $this->imagekeys)) { @@ -7744,6 +7745,10 @@ class TCPDF { * @since 4.5.016 (2009-02-24) */ public function _destroy($destroyall=false, $preserve_objcopy=false) { + // restore internal encoding + if (isset($this->internal_encoding) AND !empty($this->internal_encoding)) { + mb_internal_encoding($this->internal_encoding); + } if ($destroyall AND !$preserve_objcopy) { // remove all temporary files $tmpfiles = glob(K_PATH_CACHE.'__tcpdf_'.$this->file_id.'_*'); @@ -8151,7 +8156,9 @@ class TCPDF { $annots .= ' /FT /'.$pl['opt']['ft']; $formfield = true; } - $annots .= ' /Contents '.$this->_textstring($pl['txt'], $annot_obj_id); + if ($pl['opt']['subtype'] !== 'Link') { + $annots .= ' /Contents '.$this->_textstring($pl['txt'], $annot_obj_id); + } $annots .= ' /P '.$this->page_obj_id[$n].' 0 R'; $annots .= ' /NM '.$this->_datastring(sprintf('%04u-%04u', $n, $key), $annot_obj_id); $annots .= ' /M '.$this->_datestring($annot_obj_id, $this->doc_modification_timestamp); @@ -8358,7 +8365,7 @@ class TCPDF { break; } case 'link': { - if (is_string($pl['txt'])) { + if (is_string($pl['txt']) && !empty($pl['txt'])) { if ($pl['txt'][0] == '#') { // internal destination $annots .= ' /Dest /'.TCPDF_STATIC::encodeNameObject(substr($pl['txt'], 1)); @@ -9640,7 +9647,7 @@ class TCPDF { protected function _putcatalog() { // put XMP $xmpobj = $this->_putXMP(); - // if required, add standard sRGB_IEC61966-2.1 blackscaled ICC colour profile + // if required, add standard sRGB ICC colour profile if ($this->pdfa_mode OR $this->force_srgb) { $iccobj = $this->_newobj(); $icc = file_get_contents(dirname(__FILE__).'/include/sRGB.icc'); @@ -9798,7 +9805,7 @@ class TCPDF { //$out .= ' /XFA '; $out .= ' >>'; // signatures - if ($this->sign AND isset($this->signature_data['cert_type']) + if ($this->sign AND isset($this->signature_data['cert_type']) AND (empty($this->signature_data['approval']) OR ($this->signature_data['approval'] != 'A'))) { if ($this->signature_data['cert_type'] > 0) { $out .= ' /Perms << /DocMDP '.($this->sig_obj_id + 1).' 0 R >>'; @@ -12576,7 +12583,7 @@ class TCPDF { $k = $this->k; $this->javascript .= sprintf("f".$name."=this.addField('%s','%s',%u,[%F,%F,%F,%F]);", $name, $type, $this->PageNo()-1, $x*$k, ($this->h-$y)*$k+1, ($x+$w)*$k, ($this->h-$y-$h)*$k+1)."\n"; $this->javascript .= 'f'.$name.'.textSize='.$this->FontSizePt.";\n"; - while (list($key, $val) = each($prop)) { + foreach($prop as $key => $val) { if (strcmp(substr($key, -5), 'Color') == 0) { $val = TCPDF_COLORS::_JScolor($val); } else { @@ -15184,7 +15191,7 @@ class TCPDF { * @since 3.1.000 (2008-06-09) * @public */ - public function write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style='', $align='') { + public function write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style=array(), $align='') { if (TCPDF_STATIC::empty_string(trim($code))) { return; } @@ -15503,7 +15510,7 @@ class TCPDF { * @since 4.5.037 (2009-04-07) * @public */ - public function write2DBarcode($code, $type, $x='', $y='', $w='', $h='', $style='', $align='', $distort=false) { + public function write2DBarcode($code, $type, $x='', $y='', $w='', $h='', $style=array(), $align='', $distort=false) { if (TCPDF_STATIC::empty_string(trim($code))) { return; } @@ -16539,9 +16546,9 @@ class TCPDF { // get attributes preg_match_all('/([^=\s]*)[\s]*=[\s]*"([^"]*)"/', $element, $attr_array, PREG_PATTERN_ORDER); $dom[$key]['attribute'] = array(); // reset attribute array - while (list($id, $name) = each($attr_array[1])) { - $dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id]; - } + foreach($attr_array[1] as $id => $name) { + $dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id]; + } if (!empty($css)) { // merge CSS style to current style list($dom[$key]['csssel'], $dom[$key]['cssdata']) = TCPDF_STATIC::getCSSdataArray($dom, $key, $css); @@ -16552,10 +16559,10 @@ class TCPDF { // get style attributes preg_match_all('/([^;:\s]*):([^;]*)/', $dom[$key]['attribute']['style'], $style_array, PREG_PATTERN_ORDER); $dom[$key]['style'] = array(); // reset style attribute array - while (list($id, $name) = each($style_array[1])) { - // in case of duplicate attribute the last replace the previous - $dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]); - } + foreach($style_array[1] as $id => $name) { + // in case of duplicate attribute the last replace the previous + $dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]); + } // --- get some style attributes --- // text direction if (isset($dom[$key]['style']['direction'])) { @@ -17170,10 +17177,10 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if ($cell) { if ($this->rtl) { $this->x -= $this->cell_padding['R']; - $this->lMargin += $this->cell_padding['R']; + $this->lMargin += $this->cell_padding['L']; } else { $this->x += $this->cell_padding['L']; - $this->rMargin += $this->cell_padding['L']; + $this->rMargin += $this->cell_padding['R']; } } if ($this->customlistindent >= 0) { @@ -17723,7 +17730,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $spacew = ($spacewidth * $ns); } $offset = $strpiece[2][1] + strlen($strpiece[2][0]); - $epsposend = strpos($pmid, $this->epsmarker.'Q', $offset); + $epsposend = strpos($pmid, $this->epsmarker.'Q', $offset); if ($epsposend !== null) { $epsposend += strlen($this->epsmarker.'Q'); $epsposbeg = strpos($pmid, 'q'.$this->epsmarker, $offset); @@ -17775,7 +17782,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // justify block if (!TCPDF_STATIC::empty_string($this->lispacer)) { $this->lispacer = ''; - continue; + break; } preg_match('/([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]('.$strpiece[1][0].')[\s](re)([\s]*)/x', $pmid, $xmatches); if (!isset($xmatches[1])) { @@ -18310,7 +18317,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } // text $this->htmlvspace = 0; - if ((!$this->premode) AND $this->isRTLTextDir()) { + $isRTLString = preg_match(TCPDF_FONT_DATA::$uni_RE_PATTERN_RTL, $dom[$key]['value']) || preg_match(TCPDF_FONT_DATA::$uni_RE_PATTERN_ARABIC, $dom[$key]['value']); + if ((!$this->premode) AND $this->isRTLTextDir() AND !$isRTLString) { // reverse spaces order $lsp = ''; // left spaces $rsp = ''; // right spaces @@ -18325,7 +18333,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if ($newline) { if (!$this->premode) { $prelen = strlen($dom[$key]['value']); - if ($this->isRTLTextDir()) { + if ($this->isRTLTextDir() AND !$isRTLString) { // right trim except non-breaking space $dom[$key]['value'] = $this->stringRightTrim($dom[$key]['value']); } else { @@ -18809,102 +18817,124 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: break; } case 'img': { - if (!empty($tag['attribute']['src'])) { - if ($tag['attribute']['src'][0] === '@') { - // data stream - $tag['attribute']['src'] = '@'.base64_decode(substr($tag['attribute']['src'], 1)); - $type = ''; - } else { - // get image type - $type = TCPDF_IMAGES::getImageFileType($tag['attribute']['src']); - } - if (!isset($tag['width'])) { - $tag['width'] = 0; - } - if (!isset($tag['height'])) { - $tag['height'] = 0; - } - //if (!isset($tag['attribute']['align'])) { - // the only alignment supported is "bottom" - // further development is required for other modes. - $tag['attribute']['align'] = 'bottom'; - //} - switch($tag['attribute']['align']) { - case 'top': { - $align = 'T'; - break; - } - case 'middle': { - $align = 'M'; - break; - } - case 'bottom': { - $align = 'B'; - break; - } - default: { - $align = 'B'; - break; - } - } - $prevy = $this->y; - $xpos = $this->x; - $imglink = ''; - if (isset($this->HREF['url']) AND !TCPDF_STATIC::empty_string($this->HREF['url'])) { - $imglink = $this->HREF['url']; - if ($imglink[0] == '#') { - // convert url to internal link - $lnkdata = explode(',', $imglink); - if (isset($lnkdata[0])) { - $page = intval(substr($lnkdata[0], 1)); - if (empty($page) OR ($page <= 0)) { - $page = $this->page; - } - if (isset($lnkdata[1]) AND (strlen($lnkdata[1]) > 0)) { - $lnky = floatval($lnkdata[1]); - } else { - $lnky = 0; - } - $imglink = $this->AddLink(); - $this->SetLink($imglink, $lnky, $page); + if (empty($tag['attribute']['src'])) { + break; + } + $imgsrc = $tag['attribute']['src']; + if ($imgsrc[0] === '@') { + // data stream + $imgsrc = '@'.base64_decode(substr($imgsrc, 1)); + $type = ''; + } else { + if (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { + // fix image path + $findroot = strpos($imgsrc, $_SERVER['DOCUMENT_ROOT']); + if (($findroot === false) OR ($findroot > 1)) { + if (substr($_SERVER['DOCUMENT_ROOT'], -1) == '/') { + $imgsrc = substr($_SERVER['DOCUMENT_ROOT'], 0, -1).$imgsrc; + } else { + $imgsrc = $_SERVER['DOCUMENT_ROOT'].$imgsrc; } } - } - $border = 0; - if (isset($tag['border']) AND !empty($tag['border'])) { - // currently only support 1 (frame) or a combination of 'LTRB' - $border = $tag['border']; - } - $iw = ''; - if (isset($tag['width'])) { - $iw = $this->getHTMLUnitToUnits($tag['width'], ($tag['fontsize'] / $this->k), 'px', false); - } - $ih = ''; - if (isset($tag['height'])) { - $ih = $this->getHTMLUnitToUnits($tag['height'], ($tag['fontsize'] / $this->k), 'px', false); - } - if (($type == 'eps') OR ($type == 'ai')) { - $this->ImageEps($tag['attribute']['src'], $xpos, $this->y, $iw, $ih, $imglink, true, $align, '', $border, true); - } elseif ($type == 'svg') { - $this->ImageSVG($tag['attribute']['src'], $xpos, $this->y, $iw, $ih, $imglink, $align, '', $border, true); - } else { - $this->Image($tag['attribute']['src'], $xpos, $this->y, $iw, $ih, '', $imglink, $align, false, 300, '', false, false, $border, false, false, true); - } - switch($align) { - case 'T': { - $this->y = $prevy; - break; + $imgsrc = urldecode($imgsrc); + $testscrtype = @parse_url($imgsrc); + if (empty($testscrtype['query'])) { + // convert URL to server path + $imgsrc = str_replace(K_PATH_URL, K_PATH_MAIN, $imgsrc); + } elseif (preg_match('|^https?://|', $imgsrc) !== 1) { + // convert URL to server path + $imgsrc = str_replace(K_PATH_MAIN, K_PATH_URL, $imgsrc); } - case 'M': { - $this->y = (($this->img_rb_y + $prevy - ($this->getCellHeight($tag['fontsize'] / $this->k))) / 2); - break; - } - case 'B': { - $this->y = $this->img_rb_y - ($this->getCellHeight($tag['fontsize'] / $this->k) - ($this->getFontDescent($tag['fontname'], $tag['fontstyle'], $tag['fontsize']) * $this->cell_height_ratio)); - break; + } + // get image type + $type = TCPDF_IMAGES::getImageFileType($imgsrc); + } + if (!isset($tag['width'])) { + $tag['width'] = 0; + } + if (!isset($tag['height'])) { + $tag['height'] = 0; + } + //if (!isset($tag['attribute']['align'])) { + // the only alignment supported is "bottom" + // further development is required for other modes. + $tag['attribute']['align'] = 'bottom'; + //} + switch($tag['attribute']['align']) { + case 'top': { + $align = 'T'; + break; + } + case 'middle': { + $align = 'M'; + break; + } + case 'bottom': { + $align = 'B'; + break; + } + default: { + $align = 'B'; + break; + } + } + $prevy = $this->y; + $xpos = $this->x; + $imglink = ''; + if (isset($this->HREF['url']) AND !TCPDF_STATIC::empty_string($this->HREF['url'])) { + $imglink = $this->HREF['url']; + if ($imglink[0] == '#') { + // convert url to internal link + $lnkdata = explode(',', $imglink); + if (isset($lnkdata[0])) { + $page = intval(substr($lnkdata[0], 1)); + if (empty($page) OR ($page <= 0)) { + $page = $this->page; + } + if (isset($lnkdata[1]) AND (strlen($lnkdata[1]) > 0)) { + $lnky = floatval($lnkdata[1]); + } else { + $lnky = 0; + } + $imglink = $this->AddLink(); + $this->SetLink($imglink, $lnky, $page); } } } + $border = 0; + if (isset($tag['border']) AND !empty($tag['border'])) { + // currently only support 1 (frame) or a combination of 'LTRB' + $border = $tag['border']; + } + $iw = ''; + if (isset($tag['width'])) { + $iw = $this->getHTMLUnitToUnits($tag['width'], ($tag['fontsize'] / $this->k), 'px', false); + } + $ih = ''; + if (isset($tag['height'])) { + $ih = $this->getHTMLUnitToUnits($tag['height'], ($tag['fontsize'] / $this->k), 'px', false); + } + if (($type == 'eps') OR ($type == 'ai')) { + $this->ImageEps($imgsrc, $xpos, $this->y, $iw, $ih, $imglink, true, $align, '', $border, true); + } elseif ($type == 'svg') { + $this->ImageSVG($imgsrc, $xpos, $this->y, $iw, $ih, $imglink, $align, '', $border, true); + } else { + $this->Image($imgsrc, $xpos, $this->y, $iw, $ih, '', $imglink, $align, false, 300, '', false, false, $border, false, false, true); + } + switch($align) { + case 'T': { + $this->y = $prevy; + break; + } + case 'M': { + $this->y = (($this->img_rb_y + $prevy - ($this->getCellHeight($tag['fontsize'] / $this->k))) / 2); + break; + } + case 'B': { + $this->y = $this->img_rb_y - ($this->getCellHeight($tag['fontsize'] / $this->k) - ($this->getFontDescent($tag['fontname'], $tag['fontstyle'], $tag['fontsize']) * $this->cell_height_ratio)); + break; + } + } break; } case 'dl': { @@ -19749,7 +19779,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: break; } case 'a': { - $this->HREF = ''; + $this->HREF = array(); break; } case 'sup': { @@ -21505,7 +21535,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } else { // placemark to be replaced with the correct number $pagenum = '{#'.($outline['p']).'}'; - if ($templates['F'.$outline['l']]) { + if (isset($templates['F'.$outline['l']]) && $templates['F'.$outline['l']]) { $pagenum = '{'.$pagenum.'}'; } $maxpage = max($maxpage, $outline['p']); @@ -23681,7 +23711,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } return $name; } - + /** * Sets the opening SVG element handler function for the XML parser. (*** TO BE COMPLETED ***) * @param $parser (resource) The first parameter, parser, is a reference to the XML parser calling the handler. @@ -24198,9 +24228,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } $img = urldecode($img); $testscrtype = @parse_url($img); - if (!isset($testscrtype['query']) OR empty($testscrtype['query'])) { + if (empty($testscrtype['query'])) { // convert URL to server path $img = str_replace(K_PATH_URL, K_PATH_MAIN, $img); + } elseif (preg_match('|^https?://|', $img) !== 1) { + // convert server path to URL + $img = str_replace(K_PATH_MAIN, K_PATH_URL, $img); } } // get image type diff --git a/tcpdf.xml b/tcpdf.xml index 8ffa700..2603446 100644 --- a/tcpdf.xml +++ b/tcpdf.xml @@ -8,7 +8,7 @@ http://www.gnu.org/licenses/gpl-3.0.html GNU/GPL info@tecnick.com www.tecnick.com - 6.2.12 + 6.2.26 This is a PHP class for generating PDF documents without requiring external extensions. @@ -30,4 +30,4 @@ https://raw.githubusercontent.com/vdm-io/tcpdf/master/updates/extension.xml - \ No newline at end of file + diff --git a/tools/tcpdf_addfont.php b/tools/tcpdf_addfont.php old mode 100644 new mode 100755 index c0b258e..2937c75 --- a/tools/tcpdf_addfont.php +++ b/tools/tcpdf_addfont.php @@ -1,4 +1,4 @@ -#!/usr/bin/php -q +#!/usr/bin/env php https://github.com/llewellynvdm - \ No newline at end of file + + TCPDF + This is a PHP class for generating PDF documents without requiring external extensions. + tcpdf + library + site + + 6.2.26 + https://github.com/vdm-io/tcpdf + + https://github.com/vdm-io/tcpdf/archive/v6.2.26.zip + + Llewellyn van der Merwe + https://github.com/llewellynvdm + + + +