Update TCPDF to 6.3.2

This commit is contained in:
Laurent Destailleur 2019-10-08 09:58:47 +02:00
parent b67cc207f1
commit 44025ce4c2
27 changed files with 259 additions and 198 deletions

View File

@ -33,7 +33,7 @@ Restler 3.0.0RC6 LGPL-3+ Yes
Sabre 3.2.2 BSD Yes DAV support
Swift Mailer 5.4.2-DEV MIT license Yes Comprehensive mailing tools for PHP
Stripe 6.41 MIT licence Yes Library for Stripe module
TCPDF 6.2.25 LGPL-3+ Yes PDF generation
TCPDF 6.3.2 LGPL-3+ Yes PDF generation
TCPDI 1.0.0 LGPL-3+ / Apache 2.0 Yes FPDI replacement
JS libraries:

View File

@ -67,7 +67,7 @@ define('QR_FIND_FROM_RANDOM', false);
zapfdingbats.php (for special chars like form checkboxes)
* Optionnaly, made freemono the default monotype font if we removed courier
In htdocs/includes/tcpdf/tcpdf.php
In htdocs/includes/tecnickcom/tcpdf/tcpdf.php
- protected $default_monospaced_font = 'courier';
+ protected $default_monospaced_font = 'freemono';

View File

@ -6,6 +6,8 @@
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.
2002-2019 Nicola Asuni - Tecnick.com LTD
**********************************************************************
**********************************************************************
@ -826,7 +828,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
@ -845,14 +847,14 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/philosophy/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.
**********************************************************************
**********************************************************************

View File

@ -6,8 +6,8 @@
* **category** Library
* **author** Nicola Asuni <info@tecnick.com>
* **copyright** 2002-2018 Nicola Asuni - Tecnick.com LTD
* **license** https://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT)
* **copyright** 2002-2019 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
@ -64,7 +64,7 @@ All the original binary TTF font files have been renamed for compatibility with
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 : https://www.gnu.org/software/freefont/
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

View File

@ -0,0 +1 @@
6.3.2

View File

@ -1,46 +1,47 @@
{
"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"
]
}
}
"name": "tecnickcom/tcpdf",
"version": "6.3.2",
"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"
]
}
}

View File

@ -6,7 +6,7 @@
//
// Description : Configuration file for TCPDF.
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2004-2014 Nicola Asuni - Tecnick.com LTD
//
@ -23,7 +23,7 @@
// 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 TCPDF. If not, see <https://www.gnu.org/licenses/>.
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
//============================================================+

View File

@ -30,7 +30,7 @@ www.nongnu.org/freefont (Copyleft 2002, 2003, 2005 Free Software
Foundation).
These fonts are subject to the GNU GENERAL PUBLIC (GPL) LICENSE (Version 2).
See COPYING for details or https://www.gnu.org/copyleft/gpl.html
See COPYING for details or http://www.gnu.org/copyleft/gpl.html
As a special exception, if you create a document which uses this
font, and embed this font or unaltered portions of this font into the

View File

@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/philosophy/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -645,7 +645,7 @@ the "copyright" line and a pointer to where the full notice is found.
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
along with this program. If not, see <http://www.gnu.org/licenses/>.
Also add information on how to contact you by electronic and paper mail.
@ -664,11 +664,11 @@ might be different; for a GUI interface, you would use an "about box".
You should also get your employer (if you work as a programmer) or school,
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU GPL, see
<https://www.gnu.org/licenses/>.
<http://www.gnu.org/licenses/>.
The GNU General Public License does not permit incorporating your program
into proprietary programs. If your program is a subroutine library, you
may consider it more useful to permit linking proprietary applications with
the library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License. But first, please read
<https://www.gnu.org/philosophy/why-not-lgpl.html>.
<http://www.gnu.org/philosophy/why-not-lgpl.html>.

View File

@ -30,7 +30,7 @@ FreeFont covers the following character ranges
* geometrical shapes, box drawing
* musical symbols, gaming symbols, miscellaneous symbols
etc.
For more detail see <https://www.gnu.org/software/freefont/coverage.html>
For more detail see <http://www.gnu.org/software/freefont/coverage.html>
Editing
-------
@ -108,7 +108,7 @@ Further information
-------------------
Home page of GNU FreeFont:
https://www.gnu.org/software/freefont/
http://www.gnu.org/software/freefont/
More information is at the main project page of Free UCS scalable fonts:
http://savannah.gnu.org/projects/freefont/

View File

@ -27,7 +27,7 @@ a different font.
First double-check that the font in question really contains the character
in question. If you don't have font development software, this can be
tricky. In the case of FreeFont, you can check if a given character
range is supported: <https://www.gnu.org/software/freefont/coverage.html>
range is supported: <http://www.gnu.org/software/freefont/coverage.html>
Next double-check that your application (web browser, text editor, etc)
has indeed been properly instructed to use the font.

View File

@ -5,7 +5,7 @@
// Begin : 2010-06-07
// Last Update : 2014-05-06
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2010-2014 Nicola Asuni - Tecnick.com LTD
//
@ -22,7 +22,7 @@
// 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 TCPDF. If not, see <https://www.gnu.org/licenses/>.
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------

View File

@ -5,7 +5,7 @@
// Begin : 2010-06-03
// Last Update : 2014-04-25
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2010-2013 Nicola Asuni - Tecnick.com LTD
//
@ -22,7 +22,7 @@
// 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 TCPDF. If not, see <https://www.gnu.org/licenses/>.
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------

View File

@ -5,7 +5,7 @@
// Begin : 2010-03-22
// Last Update : 2012-07-25
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2010-2012 Nicola Asuni - Tecnick.com LTD
//
@ -22,7 +22,7 @@
// 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 TCPDF. If not, see <https://www.gnu.org/licenses/>.
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
@ -236,7 +236,6 @@ if (!defined('QRCODEDEFS')) {
/**
* if false, checks all masks available, otherwise value tells count of masks need to be checked, mask id are got randomly
*/
// @CHANGE LDR
define('QR_FIND_FROM_RANDOM', false);
/**

View File

@ -5,7 +5,7 @@
// Begin : 2002-04-09
// Last Update : 2014-04-25
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2002-2013 Nicola Asuni - Tecnick.com LTD
//
@ -22,7 +22,7 @@
// 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 TCPDF. If not, see <https://www.gnu.org/licenses/>.
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
@ -358,7 +358,7 @@ class TCPDF_COLORS {
$color_code = self::$webcolor[$color];
} else {
// spot color
$returncolor = self::getSpotColor($color, $spotc);
$returncolor = self::getSpotColor($hcolor, $spotc);
if ($returncolor === false) {
$returncolor = $defcol;
}

View File

@ -5,7 +5,7 @@
// Begin : 2011-05-23
// Last Update : 2014-04-25
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2011-2013 Nicola Asuni - Tecnick.com LTD
//
@ -279,7 +279,7 @@ class TCPDF_FILTERS {
// convert string to binary string
$bitstring = '';
for ($i = 0; $i < $data_length; ++$i) {
$bitstring .= sprintf('%08b', ord($data{$i}));
$bitstring .= sprintf('%08b', ord($data[$i]));
}
// get the number of bits
$data_length = strlen($bitstring);
@ -376,7 +376,7 @@ class TCPDF_FILTERS {
$i = 0;
while($i < $data_length) {
// get current byte value
$byte = ord($data{$i});
$byte = ord($data[$i]);
if ($byte == 128) {
// a length value of 128 denote EOD
break;
@ -389,7 +389,7 @@ class TCPDF_FILTERS {
} else {
// if length is in the range 129 to 255,
// the following single byte shall be copied 257 - length (2 to 128) times during decompression
$decoded .= str_repeat($data{($i + 1)}, (257 - $byte));
$decoded .= str_repeat($data[($i + 1)], (257 - $byte));
// move to next block
$i += 2;
}

View File

@ -5,7 +5,7 @@
// Begin : 2008-01-01
// Last Update : 2013-04-01
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2008-2013 Nicola Asuni - Tecnick.com LTD
//
@ -22,7 +22,7 @@
// 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 TCPDF. If not, see <https://www.gnu.org/licenses/>.
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------

View File

@ -5,7 +5,7 @@
// Begin : 2008-01-01
// Last Update : 2014-12-10
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2008-2014 Nicola Asuni - Tecnick.com LTD
//
@ -22,7 +22,7 @@
// 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 TCPDF. If not, see <https://www.gnu.org/licenses/>.
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
@ -1664,6 +1664,7 @@ class TCPDF_FONTS {
* @public static
*/
public static function unichr($c, $unicode=true) {
$c = intval($c);
if (!$unicode) {
return chr($c);
} elseif ($c <= 0x7F) {

View File

@ -5,7 +5,7 @@
// Begin : 2002-08-03
// Last Update : 2014-11-15
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2002-2014 Nicola Asuni - Tecnick.com LTD
//
@ -311,7 +311,7 @@ class TCPDF_IMAGES {
if ($n > 0) {
$trns = array();
for ($i = 0; $i < $n; ++ $i) {
$trns[] = ord($t{$i});
$trns[] = ord($t[$i]);
}
}
}

View File

@ -5,7 +5,7 @@
// Begin : 2002-08-03
// Last Update : 2015-04-28
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2002-2015 Nicola Asuni - Tecnick.com LTD
//
@ -55,7 +55,7 @@ class TCPDF_STATIC {
* Current TCPDF version.
* @private static
*/
private static $tcpdf_version = '6.2.26';
private static $tcpdf_version = '6.3.2';
/**
* String alias for total number of pages.
@ -1808,8 +1808,8 @@ class TCPDF_STATIC {
/**
* Wrapper to use fopen only with local files
* @param filename (string) Name of the file to open
* @param $mode (string)
* @return Returns a file pointer resource on success, or FALSE on error.
* @param $mode (string)
* @return Returns a file pointer resource on success, or FALSE on error.
* @public static
*/
public static function fopenLocal($filename, $mode) {
@ -1850,8 +1850,8 @@ class TCPDF_STATIC {
* 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.
* @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) {
@ -1868,7 +1868,7 @@ class TCPDF_STATIC {
* Reads entire file into a string.
* The file can be also an URL.
* @param $file (string) Name of the file or URL to read.
* @return The function returns the read data or FALSE on failure.
* @return The function returns the read data or FALSE on failure.
* @author Nicola Asuni
* @since 6.0.025
* @public static
@ -1926,10 +1926,10 @@ class TCPDF_STATIC {
$alt = array_unique($alt);
foreach ($alt as $path) {
if (!self::file_exists($path)) {
return false;
continue;
}
$ret = @file_get_contents($path);
if ($ret !== false) {
if ( $ret != false ) {
return $ret;
}
// try to use CURL for URLs
@ -2098,7 +2098,7 @@ class TCPDF_STATIC {
return $a['i'];
}
/**
* Array of page formats
* measures are calculated in this way: (inches * 72) or (millimeters * 72 / 25.4)

View File

@ -1,13 +1,13 @@
<?php
//============================================================+
// File name : tcpdf.php
// Version : 6.2.26
// Version : 6.3.2
// Begin : 2002-08-03
// Last Update : 2018-09-14
// Last Update : 2019-09-20
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2002-2018 Nicola Asuni - Tecnick.com LTD
// Copyright (C) 2002-2019 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
@ -45,7 +45,7 @@
// * 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/www/formats.html)
// * 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 ImageMagick (http://www.imagemagick.org/www/formats.html)
// * 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;
@ -80,7 +80,7 @@
* <li>font subsetting;</li>
* <li>methods to publish some XHTML + CSS code, Javascript and Forms;</li>
* <li>images, graphic (geometric figures) and transformation methods;
* <li>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/www/formats.html)</li>
* <li>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 ImageMagick (http://www.imagemagick.org/www/formats.html)</li>
* <li>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;</li>
* <li>JPEG and PNG ICC profiles, Grayscale, RGB, CMYK, Spot Colors and Transparencies;</li>
* <li>automatic page header and footer management;</li>
@ -104,7 +104,7 @@
* Tools to encode your unicode fonts are on fonts/utils directory.</p>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 6.2.26
* @version 6.3.2
*/
// TCPDF configuration
@ -128,7 +128,7 @@ 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.<br>
* @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions.
* @version 6.2.26
* @version 6.3.2
* @author Nicola Asuni - info@tecnick.com
* @IgnoreAnnotation("protected")
* @IgnoreAnnotation("public")
@ -1219,7 +1219,7 @@ class TCPDF {
* @protected
* @since 4.5.025 (2009-03-10)
*/
protected $default_monospaced_font = 'courier';
protected $default_monospaced_font = 'freemono';
/**
* Cloned copy of the current class object.
@ -1760,6 +1760,13 @@ class TCPDF {
*/
protected $pdfa_mode = false;
/**
* version of PDF/A mode (1 - 3).
* @protected
* @since 6.2.26 (2019-03-12)
*/
protected $pdfa_version = 1;
/**
* Document creation date-time
* @protected
@ -1781,6 +1788,13 @@ class TCPDF {
*/
protected $custom_xmp = '';
/**
* Custom XMP RDF data.
* @protected
* @since 6.3.0 (2019-09-19)
*/
protected $custom_xmp_rdf = '';
/**
* Overprint mode array.
* (Check the "Entries in a Graphics State Parameter Dictionary" on PDF 32000-1:2008).
@ -1834,7 +1848,7 @@ class TCPDF {
* @param $unicode (boolean) TRUE means that the input text is unicode (default = true)
* @param $encoding (string) Charset encoding (used only when converting back html entities); default is UTF-8.
* @param $diskcache (boolean) DEPRECATED FEATURE
* @param $pdfa (boolean) If TRUE set the document to PDF/A mode.
* @param $pdfa (integer) If not false, set the document to PDF/A mode and the good version (1 or 3).
* @public
* @see getPageSizeFromFormat(), setPageFormat()
*/
@ -1850,8 +1864,14 @@ class TCPDF {
$this->font_obj_ids = array();
$this->page_obj_id = array();
$this->form_obj_id = array();
// set pdf/a mode
$this->pdfa_mode = $pdfa;
if ($pdfa != false) {
$this->pdfa_mode = true;
$this->pdfa_version = $pdfa; // 1 or 3
} else
$this->pdfa_mode = false;
$this->force_srgb = false;
// set language direction
$this->rtl = false;
@ -1960,7 +1980,7 @@ class TCPDF {
// set default JPEG quality
$this->jpeg_quality = 75;
// initialize some settings
TCPDF_FONTS::utf8Bidi(array(''), '', false, $this->isunicode, $this->CurrentFont);
TCPDF_FONTS::utf8Bidi(array(), '', false, $this->isunicode, $this->CurrentFont);
// set default font
$this->SetFont($this->FontFamily, $this->FontStyle, $this->FontSizePt);
$this->setHeaderFont(array($this->FontFamily, $this->FontStyle, $this->FontSizePt));
@ -1986,6 +2006,7 @@ class TCPDF {
$this->default_graphic_vars = $this->getGraphicVars();
$this->header_xobj_autoreset = false;
$this->custom_xmp = '';
$this->custom_xmp_rdf = '';
// Call cleanup method after script execution finishes or exit() is called.
// NOTE: This will not be executed if the process is killed with a SIGTERM or SIGKILL signal.
register_shutdown_function(array($this, '_destroy'), true);
@ -2828,10 +2849,13 @@ class TCPDF {
* @since 1.4
*/
public function SetCompression($compress=true) {
$this->compress = false;
if (function_exists('gzcompress')) {
$this->compress = $compress ? true : false;
} else {
$this->compress = false;
if ($compress) {
if ( !$this->pdfa_mode) {
$this->compress = true;
}
}
}
}
@ -4807,7 +4831,7 @@ class TCPDF {
$this->PageAnnots[$page] = array();
}
$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 (!$this->pdfa_mode || ($this->pdfa_mode && $this->pdfa_version == 3)) {
if ((($opt['Subtype'] == 'FileAttachment') OR ($opt['Subtype'] == 'Sound')) AND (!TCPDF_STATIC::empty_string($opt['FS']))
AND (@TCPDF_STATIC::file_exists($opt['FS']) OR TCPDF_STATIC::isValidURL($opt['FS']))
AND (!isset($this->embeddedfiles[basename($opt['FS'])]))) {
@ -4833,8 +4857,8 @@ class TCPDF {
* @see Annotation()
*/
protected function _putEmbeddedFiles() {
if ($this->pdfa_mode) {
// embedded files are not allowed in PDF/A mode
if ($this->pdfa_mode && $this->pdfa_version != 3) {
// embedded files are not allowed in PDF/A mode version 1 and 2
return;
}
reset($this->embeddedfiles);
@ -4847,7 +4871,10 @@ class TCPDF {
$this->efnames[$filename] = $filedata['f'].' 0 R';
// embedded file specification object
$out = $this->_getobj($filedata['f'])."\n";
$out .= '<</Type /Filespec /F '.$this->_datastring($filename, $filedata['f']).' /EF <</F '.$filedata['n'].' 0 R>> >>';
$out .= '<</Type /Filespec /F '.$this->_datastring($filename, $filedata['f']);
$out .= ' /UF '.$this->_datastring($filename, $filedata['f']);
$out .= ' /AFRelationship /Source';
$out .= ' /EF <</F '.$filedata['n'].' 0 R>> >>';
$out .= "\n".'endobj';
$this->_out($out);
// embedded file object
@ -4856,6 +4883,11 @@ class TCPDF {
$data = gzcompress($data);
$filter = ' /Filter /FlateDecode';
}
if ($this->pdfa_version == 3) {
$filter = ' /Subtype /text#2Fxml';
}
$stream = $this->_getrawstream($data, $filedata['n']);
$out = $this->_getobj($filedata['n'])."\n";
$out .= '<< /Type /EmbeddedFile'.$filter.' /Length '.strlen($stream).' /Params <</Size '.$rawsize.'>> >>';
@ -6219,12 +6251,12 @@ class TCPDF {
* $this->setPage($page);
* if ($page == $start_page) {
* // first page
* $height = $this->h - $start_y - $this->bMargin;
* $height += $this->h - $start_y - $this->bMargin;
* } elseif ($page == $end_page) {
* // last page
* $height = $end_y - $this->tMargin;
* $height += $end_y - $this->tMargin;
* } else {
* $height = $this->h - $this->tMargin - $this->bMargin;
* $height += $this->h - $this->tMargin - $this->bMargin;
* }
* }
* }
@ -7737,6 +7769,7 @@ class TCPDF {
return '';
}
protected static $cleaned_ids = array();
/**
* Unset all class variables except the following critical variables.
* @param $destroyall (boolean) if true destroys all class variables, otherwise preserves critical variables.
@ -7749,11 +7782,24 @@ class TCPDF {
if (isset($this->internal_encoding) AND !empty($this->internal_encoding)) {
mb_internal_encoding($this->internal_encoding);
}
if (isset(self::$cleaned_ids[$this->file_id])) {
$destroyall = false;
}
if ($destroyall AND !$preserve_objcopy) {
self::$cleaned_ids[$this->file_id] = true;
// remove all temporary files
$tmpfiles = glob(K_PATH_CACHE.'__tcpdf_'.$this->file_id.'_*');
if (!empty($tmpfiles)) {
array_map('unlink', $tmpfiles);
if ($handle = opendir(K_PATH_CACHE)) {
while ( false !== ( $file_name = readdir( $handle ) ) ) {
if (strpos($file_name, '__tcpdf_'.$this->file_id.'_') === 0) {
unlink(K_PATH_CACHE.$file_name);
}
}
closedir($handle);
}
if (isset($this->imagekeys)) {
foreach($this->imagekeys as $file) {
unlink($file);
}
}
}
$preserve = array(
@ -8368,7 +8414,7 @@ class TCPDF {
if (is_string($pl['txt']) && !empty($pl['txt'])) {
if ($pl['txt'][0] == '#') {
// internal destination
$annots .= ' /Dest /'.TCPDF_STATIC::encodeNameObject(substr($pl['txt'], 1));
$annots .= ' /A <</S /GoTo /D '.TCPDF_STATIC::encodeNameObject(substr($pl['txt'], 1)).'>>';
} elseif ($pl['txt'][0] == '%') {
// embedded PDF file
$filename = basename(substr($pl['txt'], 1));
@ -8380,7 +8426,7 @@ class TCPDF {
$annots .= ' /A << /S /JavaScript /JS '.$this->_textstring($jsa, $annot_obj_id).'>>';
} else {
$parsedUrl = parse_url($pl['txt']);
if (empty($parsedUrl['scheme']) AND (strtolower(substr($parsedUrl['path'], -4)) == '.pdf')) {
if (empty($parsedUrl['scheme']) AND (!empty($parsedUrl['path']) && strtolower(substr($parsedUrl['path'], -4)) == '.pdf')) {
// relative link to a PDF file
$dest = '[0 /Fit]'; // default page 0
if (!empty($parsedUrl['fragment'])) {
@ -8487,8 +8533,8 @@ class TCPDF {
break;
}
case 'fileattachment': {
if ($this->pdfa_mode) {
// embedded files are not allowed in PDF/A mode
if ($this->pdfa_mode && $this->pdfa_version != 3) {
// embedded files are not allowed in PDF/A mode version 1 and 2
break;
}
if (!isset($pl['opt']['fs'])) {
@ -9500,6 +9546,17 @@ class TCPDF {
$this->custom_xmp = $xmp;
}
/**
* Set additional XMP data to be added on the default XMP data just before the end of "rdf:RDF" tag.
* IMPORTANT: This data is added as-is without controls, so you have to validate your data before using this method!
* @param $xmp (string) Custom XMP RDF data.
* @since 6.3.0 (2019-09-19)
* @public
*/
public function setExtraXMPRDF($xmp) {
$this->custom_xmp_rdf = $xmp;
}
/**
* Put XMP data object and return ID.
* @return (int) The object ID.
@ -9569,7 +9626,7 @@ class TCPDF {
$xmp .= "\t\t".'</rdf:Description>'."\n";
if ($this->pdfa_mode) {
$xmp .= "\t\t".'<rdf:Description rdf:about="" xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/">'."\n";
$xmp .= "\t\t\t".'<pdfaid:part>1</pdfaid:part>'."\n";
$xmp .= "\t\t\t".'<pdfaid:part>'.$this->pdfa_version.'</pdfaid:part>'."\n";
$xmp .= "\t\t\t".'<pdfaid:conformance>B</pdfaid:conformance>'."\n";
$xmp .= "\t\t".'</rdf:Description>'."\n";
}
@ -9627,6 +9684,7 @@ class TCPDF {
$xmp .= "\t\t\t\t".'</rdf:Bag>'."\n";
$xmp .= "\t\t\t".'</pdfaExtension:schemas>'."\n";
$xmp .= "\t\t".'</rdf:Description>'."\n";
$xmp .= $this->custom_xmp_rdf;
$xmp .= "\t".'</rdf:RDF>'."\n";
$xmp .= $this->custom_xmp;
$xmp .= '</x:xmpmeta>'."\n";
@ -13988,7 +14046,7 @@ class TCPDF {
* @since 3.1.000 (2008-06-09)
*/
public function setPDFVersion($version='1.7') {
if ($this->pdfa_mode) {
if ($this->pdfa_mode && $this->pdfa_version == 1 ) {
// PDF/A mode
$this->PDFVersion = '1.4';
} else {
@ -15502,8 +15560,7 @@ class TCPDF {
* <li>int $style['module_height'] height of a single module in points</li>
* <li>array $style['fgcolor'] color array for bars and text</li>
* <li>mixed $style['bgcolor'] color array for background or false for transparent</li>
* <li>string $style['position'] barcode position on the page: L = left margin; C = center; R = right margin; S = stretch</li><li>$style['module_width'] width of a single module in points</li>
* <li>$style['module_height'] height of a single module in points</li></ul>
* <li>string $style['position'] barcode position on the page: L = left margin; C = center; R = right margin; S = stretch</li>
* @param $align (string) Indicates the alignment of the pointer next to barcode insertion relative to barcode height. The value can be:<ul><li>T: top-right for LTR or top-left for RTL</li><li>M: middle-right for LTR or middle-left for RTL</li><li>B: bottom-right for LTR or bottom-left for RTL</li><li>N: next line</li></ul>
* @param $distort (boolean) if true distort the barcode to fit width and height, otherwise preserve aspect ratio
* @author Nicola Asuni
@ -16897,10 +16954,10 @@ class TCPDF {
if (($dom[$key]['value'] == 'pre') OR ($dom[$key]['value'] == 'tt')) {
$dom[$key]['fontname'] = $this->default_monospaced_font;
}
if (!empty($dom[$key]['value']) AND ($dom[$key]['value'][0] == 'h') AND (intval($dom[$key]['value']{1}) > 0) AND (intval($dom[$key]['value']{1}) < 7)) {
if (!empty($dom[$key]['value']) AND ($dom[$key]['value'][0] == 'h') AND (intval($dom[$key]['value'][1]) > 0) AND (intval($dom[$key]['value'][1]) < 7)) {
// headings h1, h2, h3, h4, h5, h6
if (!isset($dom[$key]['attribute']['size']) AND !isset($dom[$key]['style']['font-size'])) {
$headsize = (4 - intval($dom[$key]['value']{1})) * 2;
$headsize = (4 - intval($dom[$key]['value'][1])) * 2;
$dom[$key]['fontsize'] = $dom[0]['fontsize'] + $headsize;
}
if (!isset($dom[$key]['style']['font-weight'])) {
@ -18686,7 +18743,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$hbz = 0; // distance from y to line bottom
$hb = 0; // vertical space between block tags
// calculate vertical space for block tags
if (isset($this->tagvspaces[$tag['value']][0]['h']) AND ($this->tagvspaces[$tag['value']][0]['h'] >= 0)) {
if (isset($this->tagvspaces[$tag['value']][0]['h']) && !empty($this->tagvspaces[$tag['value']][0]['h']) && ($this->tagvspaces[$tag['value']][0]['h'] >= 0)) {
$cur_h = $this->tagvspaces[$tag['value']][0]['h'];
} elseif (isset($tag['fontsize'])) {
$cur_h = $this->getCellHeight($tag['fontsize'] / $this->k);
@ -18718,7 +18775,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
}
// closing vertical space
$hbc = 0;
if (isset($this->tagvspaces[$tag['value']][1]['h']) AND ($this->tagvspaces[$tag['value']][1]['h'] >= 0)) {
if (isset($this->tagvspaces[$tag['value']][1]['h']) && !empty($this->tagvspaces[$tag['value']][1]['h']) && ($this->tagvspaces[$tag['value']][1]['h'] >= 0)) {
$pre_h = $this->tagvspaces[$tag['value']][1]['h'];
} elseif (isset($parent['fontsize'])) {
$pre_h = $this->getCellHeight($parent['fontsize'] / $this->k);
@ -19379,7 +19436,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$hbz = 0; // distance from y to line bottom
$hb = 0; // vertical space between block tags
// calculate vertical space for block tags
if (isset($this->tagvspaces[$tag['value']][1]['h']) AND ($this->tagvspaces[$tag['value']][1]['h'] >= 0)) {
if (isset($this->tagvspaces[$tag['value']][1]['h']) && !empty($this->tagvspaces[$tag['value']][1]['h']) && ($this->tagvspaces[$tag['value']][1]['h'] >= 0)) {
$pre_h = $this->tagvspaces[$tag['value']][1]['h'];
} elseif (isset($parent['fontsize'])) {
$pre_h = $this->getCellHeight($parent['fontsize'] / $this->k);
@ -23995,7 +24052,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
case 'stop': {
// gradient stops
if (substr($attribs['offset'], -1) == '%') {
$offset = floatval(substr($attribs['offset'], -1)) / 100;
$offset = floatval(substr($attribs['offset'], 0, -1)) / 100;
} else {
$offset = floatval($attribs['offset']);
if ($offset > 1) {

View File

@ -5,7 +5,7 @@
// Begin : 2013-05-16
// Last Update : 2014-12-18
// Authors : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2011-2014 Nicola Asuni - Tecnick.com LTD
//

View File

@ -5,7 +5,7 @@
// Begin : 2008-06-09
// Last Update : 2014-10-20
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2008-2014 Nicola Asuni - Tecnick.com LTD
//
@ -22,7 +22,7 @@
// 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 TCPDF. If not, see <https://www.gnu.org/licenses/>.
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------
@ -453,7 +453,7 @@ class TCPDFBarcode {
$k = 0;
$clen = strlen($code);
for ($i = 0; $i < $clen; ++$i) {
$char = $code{$i};
$char = $code[$i];
if(!isset($chr[$char])) {
// invalid character
return false;
@ -464,7 +464,7 @@ class TCPDFBarcode {
} else {
$t = false; // space
}
$w = $chr[$char]{$j};
$w = $chr[$char][$j];
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
$bararray['maxw'] += $w;
++$k;
@ -520,10 +520,10 @@ class TCPDFBarcode {
$code_ext = '';
$clen = strlen($code);
for ($i = 0 ; $i < $clen; ++$i) {
if (ord($code{$i}) > 127) {
if (ord($code[$i]) > 127) {
return false;
}
$code_ext .= $encode[$code{$i}];
$code_ext .= $encode[$code[$i]];
}
return $code_ext;
}
@ -543,7 +543,7 @@ class TCPDFBarcode {
$sum = 0;
$clen = strlen($code);
for ($i = 0 ; $i < $clen; ++$i) {
$k = array_keys($chars, $code{$i});
$k = array_keys($chars, $code[$i]);
$sum += $k[0];
}
$j = ($sum % 43);
@ -643,10 +643,10 @@ class TCPDFBarcode {
$code_ext = '';
$clen = strlen($code);
for ($i = 0 ; $i < $clen; ++$i) {
if (ord($code{$i}) > 127) {
if (ord($code[$i]) > 127) {
return false;
}
$code_ext .= $encode[$code{$i}];
$code_ext .= $encode[$code[$i]];
}
// checksum
$code_ext .= $this->checksum_code93($code_ext);
@ -656,7 +656,7 @@ class TCPDFBarcode {
$k = 0;
$clen = strlen($code);
for ($i = 0; $i < $clen; ++$i) {
$char = ord($code{$i});
$char = ord($code[$i]);
if(!isset($chr[$char])) {
// invalid character
return false;
@ -667,7 +667,7 @@ class TCPDFBarcode {
} else {
$t = false; // space
}
$w = $chr[$char]{$j};
$w = $chr[$char][$j];
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
$bararray['maxw'] += $w;
++$k;
@ -699,7 +699,7 @@ class TCPDFBarcode {
$p = 1;
$check = 0;
for ($i = ($len - 1); $i >= 0; --$i) {
$k = array_keys($chars, $code{$i});
$k = array_keys($chars, $code[$i]);
$check += ($k[0] * $p);
++$p;
if ($p > 20) {
@ -713,7 +713,7 @@ class TCPDFBarcode {
$p = 1;
$check = 0;
for ($i = $len; $i >= 0; --$i) {
$k = array_keys($chars, $code{$i});
$k = array_keys($chars, $code[$i]);
$check += ($k[0] * $p);
++$p;
if ($p > 15) {
@ -738,11 +738,11 @@ class TCPDFBarcode {
$len = strlen($code);
$sum = 0;
for ($i = 0; $i < $len; $i+=2) {
$sum += $code{$i};
$sum += $code[$i];
}
$sum *= 3;
for ($i = 1; $i < $len; $i+=2) {
$sum += ($code{$i});
$sum += ($code[$i]);
}
$r = $sum % 10;
if($r > 0) {
@ -783,7 +783,7 @@ class TCPDFBarcode {
$p = 2;
$check = 0;
for ($i = ($clen - 1); $i >= 0; --$i) {
$check += (hexdec($code{$i}) * $p);
$check += (hexdec($code[$i]) * $p);
++$p;
if ($p > 7) {
$p = 2;
@ -798,7 +798,7 @@ class TCPDFBarcode {
$seq = '110'; // left guard
$clen = strlen($code);
for ($i = 0; $i < $clen; ++$i) {
$digit = $code{$i};
$digit = $code[$i];
if (!isset($chr[$digit])) {
// invalid character
return false;
@ -841,7 +841,7 @@ class TCPDFBarcode {
$seq = '11011010';
$clen = strlen($code);
for ($i = 0; $i < $clen; ++$i) {
$digit = $code{$i};
$digit = $code[$i];
if (!isset($chr[$digit])) {
// invalid character
return false;
@ -867,8 +867,8 @@ class TCPDFBarcode {
$k = 0;
for ($i = 0; $i < $len; ++$i) {
$w += 1;
if (($i == ($len - 1)) OR (($i < ($len - 1)) AND ($seq{$i} != $seq{($i+1)}))) {
if ($seq{$i} == '1') {
if (($i == ($len - 1)) OR (($i < ($len - 1)) AND ($seq[$i] != $seq[($i+1)]))) {
if ($seq[$i] == '1') {
$t = true; // bar
} else {
$t = false; // space
@ -919,8 +919,8 @@ class TCPDFBarcode {
$k = 0;
$clen = strlen($code);
for ($i = 0; $i < $clen; $i = ($i + 2)) {
$char_bar = $code{$i};
$char_space = $code{$i+1};
$char_bar = $code[$i];
$char_space = $code[$i+1];
if((!isset($chr[$char_bar])) OR (!isset($chr[$char_space]))) {
// invalid character
return false;
@ -929,7 +929,7 @@ class TCPDFBarcode {
$seq = '';
$chrlen = strlen($chr[$char_bar]);
for ($s = 0; $s < $chrlen; $s++){
$seq .= $chr[$char_bar]{$s} . $chr[$char_space]{$s};
$seq .= $chr[$char_bar][$s] . $chr[$char_space][$s];
}
$seqlen = strlen($seq);
for ($j = 0; $j < $seqlen; ++$j) {
@ -938,7 +938,7 @@ class TCPDFBarcode {
} else {
$t = false; // space
}
$w = $seq{$j};
$w = $seq[$j];
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
$bararray['maxw'] += $w;
++$k;
@ -1085,7 +1085,7 @@ class TCPDFBarcode {
case 'A': { // MODE A
$startid = 103;
for ($i = 0; $i < $len; ++$i) {
$char = $code{$i};
$char = $code[$i];
$char_id = ord($char);
if (($char_id >= 241) AND ($char_id <= 244)) {
$code_data[] = $fnc_a[$char_id];
@ -1100,7 +1100,7 @@ class TCPDFBarcode {
case 'B': { // MODE B
$startid = 104;
for ($i = 0; $i < $len; ++$i) {
$char = $code{$i};
$char = $code[$i];
$char_id = ord($char);
if (($char_id >= 241) AND ($char_id <= 244)) {
$code_data[] = $fnc_b[$char_id];
@ -1124,7 +1124,7 @@ class TCPDFBarcode {
return false;
}
for ($i = 0; $i < $len; $i+=2) {
$chrnum = $code{$i}.$code{$i+1};
$chrnum = $code[$i].$code[$i+1];
if (preg_match('/([0-9]{2})/', $chrnum) > 0) {
$code_data[] = intval($chrnum);
} else {
@ -1180,7 +1180,7 @@ class TCPDFBarcode {
}
}
for ($i = 0; $i < $seq[2]; ++$i) {
$char = $seq[1]{$i};
$char = $seq[1][$i];
$char_id = ord($char);
if (($char_id >= 241) AND ($char_id <= 244)) {
$code_data[] = $fnc_a[$char_id];
@ -1223,7 +1223,7 @@ class TCPDFBarcode {
}
}
for ($i = 0; $i < $seq[2]; ++$i) {
$char = $seq[1]{$i};
$char = $seq[1][$i];
$char_id = ord($char);
if (($char_id >= 241) AND ($char_id <= 244)) {
$code_data[] = $fnc_b[$char_id];
@ -1240,7 +1240,7 @@ class TCPDFBarcode {
$code_data[] = 99;
}
for ($i = 0; $i < $seq[2]; $i+=2) {
$chrnum = $seq[1]{$i}.$seq[1]{$i+1};
$chrnum = $seq[1][$i].$seq[1][$i+1];
$code_data[] = intval($chrnum);
}
break;
@ -1271,7 +1271,7 @@ class TCPDFBarcode {
} else {
$t = false; // space
}
$w = $seq{$j};
$w = $seq[$j];
$bararray['bcode'][] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
$bararray['maxw'] += $w;
}
@ -1337,14 +1337,14 @@ class TCPDFBarcode {
// calculate check digit
$sum_a = 0;
for ($i = 1; $i < $data_len; $i+=2) {
$sum_a += $code{$i};
$sum_a += $code[$i];
}
if ($len > 12) {
$sum_a *= 3;
}
$sum_b = 0;
for ($i = 0; $i < $data_len; $i+=2) {
$sum_b += ($code{$i});
$sum_b += ($code[$i]);
}
if ($len < 13) {
$sum_b *= 3;
@ -1356,7 +1356,7 @@ class TCPDFBarcode {
if ($code_len == $data_len) {
// add check digit
$code .= $r;
} elseif ($r !== intval($code{$data_len})) {
} elseif ($r !== intval($code[$data_len])) {
// wrong checkdigit
return false;
}
@ -1467,7 +1467,7 @@ class TCPDFBarcode {
$bararray = array('code' => $upce_code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
$p = $upce_parities[$code[1]][$r];
for ($i = 0; $i < 6; ++$i) {
$seq .= $codes[$p[$i]][$upce_code{$i}];
$seq .= $codes[$p[$i]][$upce_code[$i]];
}
$seq .= '010101'; // right guard bar
} else {
@ -1475,17 +1475,17 @@ class TCPDFBarcode {
$half_len = intval(ceil($len / 2));
if ($len == 8) {
for ($i = 0; $i < $half_len; ++$i) {
$seq .= $codes['A'][$code{$i}];
$seq .= $codes['A'][$code[$i]];
}
} else {
$p = $parities[$code[0]];
for ($i = 1; $i < $half_len; ++$i) {
$seq .= $codes[$p[$i-1]][$code{$i}];
$seq .= $codes[$p[$i-1]][$code[$i]];
}
}
$seq .= '01010'; // center guard bar
for ($i = $half_len; $i < $len; ++$i) {
$seq .= $codes['C'][$code{$i}];
$seq .= $codes['C'][$code[$i]];
}
$seq .= '101'; // right guard bar
}
@ -1493,8 +1493,8 @@ class TCPDFBarcode {
$w = 0;
for ($i = 0; $i < $clen; ++$i) {
$w += 1;
if (($i == ($clen - 1)) OR (($i < ($clen - 1)) AND ($seq{$i} != $seq{($i+1)}))) {
if ($seq{$i} == '1') {
if (($i == ($clen - 1)) OR (($i < ($clen - 1)) AND ($seq[$i] != $seq[$i+1]))) {
if ($seq[$i] == '1') {
$t = true; // bar
} else {
$t = false; // space
@ -1578,7 +1578,7 @@ class TCPDFBarcode {
$seq .= $codes[$p[0]][$code[0]];
for ($i = 1; $i < $len; ++$i) {
$seq .= '01'; // separator
$seq .= $codes[$p[$i]][$code{$i}];
$seq .= $codes[$p[$i]][$code[$i]];
}
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 1, 'bcode' => array());
return $this->binseq_to_array($seq, $bararray);
@ -1629,7 +1629,7 @@ class TCPDFBarcode {
// calculate checksum
$sum = 0;
for ($i = 0; $i < $len; ++$i) {
$sum += intval($code{$i});
$sum += intval($code[$i]);
}
$chkd = ($sum % 10);
if($chkd > 0) {
@ -1643,7 +1643,7 @@ class TCPDFBarcode {
$bararray['maxw'] += 2;
for ($i = 0; $i < $len; ++$i) {
for ($j = 0; $j < 5; ++$j) {
$h = $barlen[$code{$i}][$j];
$h = $barlen[$code[$i]][$j];
$p = floor(1 / $h);
$bararray['bcode'][$k++] = array('t' => 1, 'w' => 1, 'h' => $h, 'p' => $p);
$bararray['bcode'][$k++] = array('t' => 0, 'w' => 1, 'h' => 2, 'p' => 0);
@ -1756,8 +1756,8 @@ class TCPDFBarcode {
$row = 0;
$col = 0;
for ($i = 0; $i < $len; ++$i) {
$row += $checktable[$code{$i}][0];
$col += $checktable[$code{$i}][1];
$row += $checktable[$code[$i]][0];
$col += $checktable[$code[$i]][1];
}
$row %= 6;
$col %= 6;
@ -1774,7 +1774,7 @@ class TCPDFBarcode {
}
for ($i = 0; $i < $len; ++$i) {
for ($j = 0; $j < 4; ++$j) {
switch ($barmode[$code{$i}][$j]) {
switch ($barmode[$code[$i]][$j]) {
case 1: {
$p = 0;
$h = 2;
@ -1846,17 +1846,17 @@ class TCPDFBarcode {
$code = 'A'.strtoupper($code).'A';
$len = strlen($code);
for ($i = 0; $i < $len; ++$i) {
if (!isset($chr[$code{$i}])) {
if (!isset($chr[$code[$i]])) {
return false;
}
$seq = $chr[$code{$i}];
$seq = $chr[$code[$i]];
for ($j = 0; $j < 8; ++$j) {
if (($j % 2) == 0) {
$t = true; // bar
} else {
$t = false; // space
}
$w = $seq{$j};
$w = $seq[$j];
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
$bararray['maxw'] += $w;
++$k;
@ -1896,7 +1896,7 @@ class TCPDFBarcode {
$p = 1;
$check = 0;
for ($i = ($len - 1); $i >= 0; --$i) {
$digit = $code{$i};
$digit = $code[$i];
if ($digit == '-') {
$dval = 10;
} else {
@ -1918,7 +1918,7 @@ class TCPDFBarcode {
$p = 1;
$check = 0;
for ($i = $len; $i >= 0; --$i) {
$digit = $code{$i};
$digit = $code[$i];
if ($digit == '-') {
$dval = 10;
} else {
@ -1937,17 +1937,17 @@ class TCPDFBarcode {
$code = 'S'.$code.'S';
$len += 3;
for ($i = 0; $i < $len; ++$i) {
if (!isset($chr[$code{$i}])) {
if (!isset($chr[$code[$i]])) {
return false;
}
$seq = $chr[$code{$i}];
$seq = $chr[$code[$i]];
for ($j = 0; $j < 6; ++$j) {
if (($j % 2) == 0) {
$t = true; // bar
} else {
$t = false; // space
}
$w = $seq{$j};
$w = $seq[$j];
$bararray['bcode'][$k] = array('t' => $t, 'w' => $w, 'h' => 1, 'p' => 0);
$bararray['maxw'] += $w;
++$k;
@ -2016,7 +2016,7 @@ class TCPDFBarcode {
$bararray = array('code' => $code, 'maxw' => 0, 'maxh' => 2, 'bcode' => array());
$len = strlen($seq);
for ($i = 0; $i < $len; ++$i) {
switch ($seq{$i}) {
switch ($seq[$i]) {
case '1': {
$p = 1;
$h = 1;
@ -2171,7 +2171,7 @@ class TCPDFBarcode {
/**
* IMB - Intelligent Mail Barcode - Onecode - USPS-B-3200
*
*
* @param $code (string) pre-formatted IMB barcode (65 chars "FADT")
* @return array barcode representation.
* @protected
@ -2255,7 +2255,7 @@ class TCPDFBarcode {
$bitval = 1;
$len = strlen($hex);
for($pos = ($len - 1); $pos >= 0; --$pos) {
$dec = bcadd($dec, bcmul(hexdec($hex{$pos}), $bitval));
$dec = bcadd($dec, bcmul(hexdec($hex[$pos]), $bitval));
$bitval = bcmul($bitval, 16);
}
return $dec;

View File

@ -5,7 +5,7 @@
// Begin : 2009-04-07
// Last Update : 2014-05-20
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2009-2014 Nicola Asuni - Tecnick.com LTD
//
@ -22,7 +22,7 @@
// 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 TCPDF. If not, see <https://www.gnu.org/licenses/>.
// along with TCPDF. If not, see <http://www.gnu.org/licenses/>.
//
// See LICENSE.TXT file for more information.
// -------------------------------------------------------------------

View File

@ -5,7 +5,7 @@
// Begin : 2011-05-23
// Last Update : 2013-09-17
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2011-2013 Nicola Asuni - Tecnick.com LTD
//

View File

@ -531,10 +531,10 @@ class TCPDF_PARSER {
if ($char == '(') {
$open_bracket = 1;
while ($open_bracket > 0) {
if (!isset($this->pdfdata{$strpos})) {
if (!isset($this->pdfdata[$strpos])) {
break;
}
$ch = $this->pdfdata{$strpos};
$ch = $this->pdfdata[$strpos];
switch ($ch) {
case '\\': { // REVERSE SOLIDUS (5Ch) (Backslash)
// skip next character
@ -578,7 +578,7 @@ class TCPDF_PARSER {
}
case '<': // \x3C LESS-THAN SIGN
case '>': { // \x3E GREATER-THAN SIGN
if (isset($this->pdfdata{($offset + 1)}) AND ($this->pdfdata{($offset + 1)} == $char)) {
if (isset($this->pdfdata[($offset + 1)]) AND ($this->pdfdata[($offset + 1)] == $char)) {
// dictionary object
$objtype = $char.$char;
$offset += 2;