This commit is contained in:
+63
-63
@@ -5,9 +5,9 @@
|
||||
// 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 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
// Copyright (C) 2010-2014 Nicola Asuni - Tecnick.com LTD
|
||||
// Copyright (C) 2010-2014 2026 Nicola Asuni - Tecnick.com LTD
|
||||
//
|
||||
// This file is part of TCPDF software library.
|
||||
//
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
// along with TCPDF. If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
// See LICENSE.TXT file for more information.
|
||||
// -------------------------------------------------------------------
|
||||
@@ -229,7 +229,7 @@ class Datamatrix {
|
||||
/**
|
||||
* This is the class constructor.
|
||||
* Creates a datamatrix object
|
||||
* @param $code (string) Code to represent using Datamatrix.
|
||||
* @param string $code Code to represent using Datamatrix.
|
||||
* @public
|
||||
*/
|
||||
public function __construct($code) {
|
||||
@@ -355,11 +355,11 @@ class Datamatrix {
|
||||
|
||||
/**
|
||||
* Product of two numbers in a Power-of-Two Galois Field
|
||||
* @param $a (int) first number to multiply.
|
||||
* @param $b (int) second number to multiply.
|
||||
* @param $log (array) Log table.
|
||||
* @param $alog (array) Anti-Log table.
|
||||
* @param $gf (array) Number of Factors of the Reed-Solomon polynomial.
|
||||
* @param int $a first number to multiply.
|
||||
* @param int $b second number to multiply.
|
||||
* @param array $log Log table.
|
||||
* @param array $alog Anti-Log table.
|
||||
* @param int $gf Number of Factors of the Reed-Solomon polynomial.
|
||||
* @return int product
|
||||
* @protected
|
||||
*/
|
||||
@@ -372,12 +372,12 @@ class Datamatrix {
|
||||
|
||||
/**
|
||||
* Add error correction codewords to data codewords array (ANNEX E).
|
||||
* @param $wd (array) Array of datacodewords.
|
||||
* @param $nb (int) Number of blocks.
|
||||
* @param $nd (int) Number of data codewords per block.
|
||||
* @param $nc (int) Number of correction codewords per block.
|
||||
* @param $gf (int) numner of fields on log/antilog table (power of 2).
|
||||
* @param $pp (int) The value of its prime modulus polynomial (301 for ECC200).
|
||||
* @param array $wd Array of datacodewords.
|
||||
* @param int $nb Number of blocks.
|
||||
* @param int $nd Number of data codewords per block.
|
||||
* @param int $nc Number of correction codewords per block.
|
||||
* @param int $gf numner of fields on log/antilog table (power of 2).
|
||||
* @param int $pp The value of its prime modulus polynomial (301 for ECC200).
|
||||
* @return array data codewords + error codewords
|
||||
* @protected
|
||||
*/
|
||||
@@ -438,9 +438,9 @@ class Datamatrix {
|
||||
|
||||
/**
|
||||
* Return the 253-state codeword
|
||||
* @param $cwpad (int) Pad codeword.
|
||||
* @param $cwpos (int) Number of data codewords from the beginning of encoded data.
|
||||
* @return pad codeword
|
||||
* @param int $cwpad Pad codeword.
|
||||
* @param int $cwpos Number of data codewords from the beginning of encoded data.
|
||||
* @return int pad codeword
|
||||
* @protected
|
||||
*/
|
||||
protected function get253StateCodeword($cwpad, $cwpos) {
|
||||
@@ -453,9 +453,9 @@ class Datamatrix {
|
||||
|
||||
/**
|
||||
* Return the 255-state codeword
|
||||
* @param $cwpad (int) Pad codeword.
|
||||
* @param $cwpos (int) Number of data codewords from the beginning of encoded data.
|
||||
* @return pad codeword
|
||||
* @param int $cwpad Pad codeword.
|
||||
* @param int $cwpos Number of data codewords from the beginning of encoded data.
|
||||
* @return int pad codeword
|
||||
* @protected
|
||||
*/
|
||||
protected function get255StateCodeword($cwpad, $cwpos) {
|
||||
@@ -468,8 +468,8 @@ class Datamatrix {
|
||||
|
||||
/**
|
||||
* Returns true if the char belongs to the selected mode
|
||||
* @param $chr (int) Character (byte) to check.
|
||||
* @param $mode (int) Current encoding mode.
|
||||
* @param int $chr Character (byte) to check.
|
||||
* @param int $mode Current encoding mode.
|
||||
* @return boolean true if the char is of the selected mode.
|
||||
* @protected
|
||||
*/
|
||||
@@ -514,9 +514,9 @@ class Datamatrix {
|
||||
|
||||
/**
|
||||
* The look-ahead test scans the data to be encoded to find the best mode (Annex P - steps from J to S).
|
||||
* @param $data (string) data to encode
|
||||
* @param $pos (int) current position
|
||||
* @param $mode (int) current encoding mode
|
||||
* @param string $data data to encode
|
||||
* @param int $pos current position
|
||||
* @param int $mode current encoding mode
|
||||
* @return int encoding mode
|
||||
* @protected
|
||||
*/
|
||||
@@ -646,8 +646,8 @@ class Datamatrix {
|
||||
|
||||
/**
|
||||
* Get the switching codeword to a new encoding mode (latch codeword)
|
||||
* @param $mode (int) New encoding mode.
|
||||
* @return (int) Switch codeword.
|
||||
* @param int $mode New encoding mode.
|
||||
* @return int Switch codeword.
|
||||
* @protected
|
||||
*/
|
||||
protected function getSwitchEncodingCodeword($mode) {
|
||||
@@ -685,8 +685,8 @@ class Datamatrix {
|
||||
|
||||
/**
|
||||
* Choose the minimum matrix size and return the max number of data codewords.
|
||||
* @param $numcw (int) Number of current codewords.
|
||||
* @return number of data codewords in matrix
|
||||
* @param int $numcw Number of current codewords.
|
||||
* @return int number of data codewords in matrix
|
||||
* @protected
|
||||
*/
|
||||
protected function getMaxDataCodewords($numcw) {
|
||||
@@ -700,7 +700,7 @@ class Datamatrix {
|
||||
|
||||
/**
|
||||
* Get high level encoding using the minimum symbol data characters for ECC 200
|
||||
* @param $data (string) data to encode
|
||||
* @param string $data data to encode
|
||||
* @return array of codewords
|
||||
* @protected
|
||||
*/
|
||||
@@ -778,7 +778,7 @@ class Datamatrix {
|
||||
if (isset($this->chset['SH1'][$chr])) {
|
||||
$temp_cw[] = 0; // shift 1
|
||||
$shiftset = $this->chset['SH1'];
|
||||
} elseif (isset($chr, $this->chset['SH2'][$chr])) {
|
||||
} elseif (isset($this->chset['SH2'][$chr])) {
|
||||
$temp_cw[] = 1; // shift 2
|
||||
$shiftset = $this->chset['SH2'];
|
||||
} elseif (($enc == ENC_C40) AND isset($this->chset['S3C'][$chr])) {
|
||||
@@ -970,13 +970,13 @@ class Datamatrix {
|
||||
/**
|
||||
* Places "chr+bit" with appropriate wrapping within array[].
|
||||
* (Annex F - ECC 200 symbol character placement)
|
||||
* @param $marr (array) Array of symbols.
|
||||
* @param $nrow (int) Number of rows.
|
||||
* @param $ncol (int) Number of columns.
|
||||
* @param $row (int) Row number.
|
||||
* @param $col (int) Column number.
|
||||
* @param $chr (int) Char byte.
|
||||
* @param $bit (int) Bit.
|
||||
* @param array $marr Array of symbols.
|
||||
* @param int $nrow Number of rows.
|
||||
* @param int $ncol Number of columns.
|
||||
* @param int $row Row number.
|
||||
* @param int $col Column number.
|
||||
* @param int $chr Char byte.
|
||||
* @param int $bit Bit.
|
||||
* @return array
|
||||
* @protected
|
||||
*/
|
||||
@@ -996,12 +996,12 @@ class Datamatrix {
|
||||
/**
|
||||
* Places the 8 bits of a utah-shaped symbol character.
|
||||
* (Annex F - ECC 200 symbol character placement)
|
||||
* @param $marr (array) Array of symbols.
|
||||
* @param $nrow (int) Number of rows.
|
||||
* @param $ncol (int) Number of columns.
|
||||
* @param $row (int) Row number.
|
||||
* @param $col (int) Column number.
|
||||
* @param $chr (int) Char byte.
|
||||
* @param array $marr Array of symbols.
|
||||
* @param int $nrow Number of rows.
|
||||
* @param int $ncol Number of columns.
|
||||
* @param int $row Row number.
|
||||
* @param int $col Column number.
|
||||
* @param int $chr Char byte.
|
||||
* @return array
|
||||
* @protected
|
||||
*/
|
||||
@@ -1020,10 +1020,10 @@ class Datamatrix {
|
||||
/**
|
||||
* Places the 8 bits of the first special corner case.
|
||||
* (Annex F - ECC 200 symbol character placement)
|
||||
* @param $marr (array) Array of symbols.
|
||||
* @param $nrow (int) Number of rows.
|
||||
* @param $ncol (int) Number of columns.
|
||||
* @param $chr (int) Char byte.
|
||||
* @param array $marr Array of symbols.
|
||||
* @param int $nrow Number of rows.
|
||||
* @param int $ncol Number of columns.
|
||||
* @param int $chr Char byte.
|
||||
* @return array
|
||||
* @protected
|
||||
*/
|
||||
@@ -1042,10 +1042,10 @@ class Datamatrix {
|
||||
/**
|
||||
* Places the 8 bits of the second special corner case.
|
||||
* (Annex F - ECC 200 symbol character placement)
|
||||
* @param $marr (array) Array of symbols.
|
||||
* @param $nrow (int) Number of rows.
|
||||
* @param $ncol (int) Number of columns.
|
||||
* @param $chr (int) Char byte.
|
||||
* @param array $marr Array of symbols.
|
||||
* @param int $nrow Number of rows.
|
||||
* @param int $ncol Number of columns.
|
||||
* @param int $chr Char byte.
|
||||
* @return array
|
||||
* @protected
|
||||
*/
|
||||
@@ -1064,10 +1064,10 @@ class Datamatrix {
|
||||
/**
|
||||
* Places the 8 bits of the third special corner case.
|
||||
* (Annex F - ECC 200 symbol character placement)
|
||||
* @param $marr (array) Array of symbols.
|
||||
* @param $nrow (int) Number of rows.
|
||||
* @param $ncol (int) Number of columns.
|
||||
* @param $chr (int) Char byte.
|
||||
* @param array $marr Array of symbols.
|
||||
* @param int $nrow Number of rows.
|
||||
* @param int $ncol Number of columns.
|
||||
* @param int $chr Char byte.
|
||||
* @return array
|
||||
* @protected
|
||||
*/
|
||||
@@ -1086,10 +1086,10 @@ class Datamatrix {
|
||||
/**
|
||||
* Places the 8 bits of the fourth special corner case.
|
||||
* (Annex F - ECC 200 symbol character placement)
|
||||
* @param $marr (array) Array of symbols.
|
||||
* @param $nrow (int) Number of rows.
|
||||
* @param $ncol (int) Number of columns.
|
||||
* @param $chr (int) Char byte.
|
||||
* @param array $marr Array of symbols.
|
||||
* @param int $nrow Number of rows.
|
||||
* @param int $ncol Number of columns.
|
||||
* @param int $chr Char byte.
|
||||
* @return array
|
||||
* @protected
|
||||
*/
|
||||
@@ -1108,8 +1108,8 @@ class Datamatrix {
|
||||
/**
|
||||
* Build a placement map.
|
||||
* (Annex F - ECC 200 symbol character placement)
|
||||
* @param $nrow (int) Number of rows.
|
||||
* @param $ncol (int) Number of columns.
|
||||
* @param int $nrow Number of rows.
|
||||
* @param int $ncol Number of columns.
|
||||
* @return array
|
||||
* @protected
|
||||
*/
|
||||
|
||||
+21
-21
@@ -5,9 +5,9 @@
|
||||
// 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 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
// Copyright (C) 2010-2013 Nicola Asuni - Tecnick.com LTD
|
||||
// Copyright (C) 2010-2013 2026 Nicola Asuni - Tecnick.com LTD
|
||||
//
|
||||
// This file is part of TCPDF software library.
|
||||
//
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
// along with TCPDF. If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
// See LICENSE.TXT file for more information.
|
||||
// -------------------------------------------------------------------
|
||||
@@ -523,10 +523,10 @@ class PDF417 {
|
||||
/**
|
||||
* This is the class constructor.
|
||||
* Creates a PDF417 object
|
||||
* @param $code (string) code to represent using PDF417
|
||||
* @param $ecl (int) error correction level (0-8); default -1 = automatic correction level
|
||||
* @param $aspectratio (float) the width to height of the symbol (excluding quiet zones)
|
||||
* @param $macro (array) information for macro block
|
||||
* @param string $code code to represent using PDF417
|
||||
* @param int $ecl error correction level (0-8); default -1 = automatic correction level
|
||||
* @param float $aspectratio the width to height of the symbol (excluding quiet zones)
|
||||
* @param array $macro information for macro block
|
||||
* @public
|
||||
*/
|
||||
public function __construct($code, $ecl=-1, $aspectratio=2, $macro=array()) {
|
||||
@@ -734,12 +734,13 @@ class PDF417 {
|
||||
|
||||
/**
|
||||
* Returns the error correction level (0-8) to be used
|
||||
* @param $ecl (int) error correction level
|
||||
* @param $numcw (int) number of data codewords
|
||||
* @param int $ecl error correction level
|
||||
* @param int $numcw number of data codewords
|
||||
* @return int error correction level
|
||||
* @protected
|
||||
*/
|
||||
protected function getErrorCorrectionLevel($ecl, $numcw) {
|
||||
$maxecl = 8; // starting error level
|
||||
// check for automatic levels
|
||||
if (($ecl < 0) OR ($ecl > 8)) {
|
||||
if ($numcw < 41) {
|
||||
@@ -755,7 +756,6 @@ class PDF417 {
|
||||
}
|
||||
}
|
||||
// get maximum correction level
|
||||
$maxecl = 8; // starting error level
|
||||
$maxerrsize = (928 - $numcw); // available codewords for error
|
||||
while ($maxecl > 0) {
|
||||
$errsize = (2 << $ecl);
|
||||
@@ -772,8 +772,8 @@ class PDF417 {
|
||||
|
||||
/**
|
||||
* Returns the error correction codewords
|
||||
* @param $cw (array) array of codewords including Symbol Length Descriptor and pad
|
||||
* @param $ecl (int) error correction level 0-8
|
||||
* @param array $cw array of codewords including Symbol Length Descriptor and pad
|
||||
* @param int $ecl error correction level 0-8
|
||||
* @return array of error correction codewords
|
||||
* @protected
|
||||
*/
|
||||
@@ -809,8 +809,8 @@ class PDF417 {
|
||||
|
||||
/**
|
||||
* Create array of sequences from input
|
||||
* @param $code (string) code
|
||||
* @return bidimensional array containing characters and classification
|
||||
* @param string $code code
|
||||
* @return array bi-dimensional array containing characters and classification
|
||||
* @protected
|
||||
*/
|
||||
protected function getInputSequences($code) {
|
||||
@@ -864,9 +864,9 @@ class PDF417 {
|
||||
|
||||
/**
|
||||
* Compact data by mode.
|
||||
* @param $mode (int) compaction mode number
|
||||
* @param $code (string) data to compact
|
||||
* @param $addmode (boolean) if true add the mode codeword at first position
|
||||
* @param int $mode compaction mode number
|
||||
* @param string $code data to compact
|
||||
* @param boolean $addmode if true add the mode codeword at first position
|
||||
* @return array of codewords
|
||||
* @protected
|
||||
*/
|
||||
@@ -943,8 +943,8 @@ class PDF417 {
|
||||
// tmp array for the 6 bytes block
|
||||
$cw6 = array();
|
||||
do {
|
||||
$d = bcmod($t, '900');
|
||||
$t = bcdiv($t, '900');
|
||||
$d = bcmod($t, '900', 0);
|
||||
$t = bcdiv($t, '900', 0);
|
||||
// prepend the value to the beginning of the array
|
||||
array_unshift($cw6, $d);
|
||||
} while ($t != '0');
|
||||
@@ -969,8 +969,8 @@ class PDF417 {
|
||||
}
|
||||
$t = '1'.$code;
|
||||
do {
|
||||
$d = bcmod($t, '900');
|
||||
$t = bcdiv($t, '900');
|
||||
$d = bcmod($t, '900', 0);
|
||||
$t = bcdiv($t, '900', 0);
|
||||
array_unshift($cw, $d);
|
||||
} while ($t != '0');
|
||||
$code = $rest;
|
||||
|
||||
+196
-220
File diff suppressed because it is too large
Load Diff
+36
-16
@@ -5,9 +5,9 @@
|
||||
// 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 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
// Copyright (C) 2002-2013 Nicola Asuni - Tecnick.com LTD
|
||||
// Copyright (C) 2002-2013 2026 Nicola Asuni - Tecnick.com LTD
|
||||
//
|
||||
// This file is part of TCPDF software library.
|
||||
//
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
// along with TCPDF. If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
// See LICENSE.TXT file for more information.
|
||||
// -------------------------------------------------------------------
|
||||
@@ -240,9 +240,9 @@ class TCPDF_COLORS {
|
||||
|
||||
/**
|
||||
* Return the Spot color array.
|
||||
* @param $name (string) Name of the spot color.
|
||||
* @param $spotc (array) Reference to an array of spot colors.
|
||||
* @return (array) Spot color array or false if not defined.
|
||||
* @param string $name Name of the spot color.
|
||||
* @param array $spotc Reference to an array of spot colors.
|
||||
* @return array|false Spot color array or false if not defined.
|
||||
* @since 5.9.125 (2011-10-03)
|
||||
* @public static
|
||||
*/
|
||||
@@ -264,10 +264,10 @@ class TCPDF_COLORS {
|
||||
|
||||
/**
|
||||
* Returns an array (RGB or CMYK) from an html color name, or a six-digit (i.e. #3FE5AA), or three-digit (i.e. #7FF) hexadecimal color, or a javascript color array, or javascript color name.
|
||||
* @param $hcolor (string) HTML color.
|
||||
* @param $spotc (array) Reference to an array of spot colors.
|
||||
* @param $defcol (array) Color to return in case of error.
|
||||
* @return array RGB or CMYK color, or false in case of error.
|
||||
* @param string $hcolor HTML color.
|
||||
* @param array $spotc Reference to an array of spot colors.
|
||||
* @param array $defcol Color to return in case of error.
|
||||
* @return array|false RGB or CMYK color, or false in case of error.
|
||||
* @public static
|
||||
*/
|
||||
public static function convertHTMLColorToDec($hcolor, &$spotc, $defcol=array('R'=>128,'G'=>128,'B'=>128)) {
|
||||
@@ -275,7 +275,7 @@ class TCPDF_COLORS {
|
||||
$color = strtolower($color);
|
||||
// check for javascript color array syntax
|
||||
if (strpos($color, '[') !== false) {
|
||||
if (preg_match('/[\[][\"\'](t|g|rgb|cmyk)[\"\'][\,]?([0-9\.]*)[\,]?([0-9\.]*)[\,]?([0-9\.]*)[\,]?([0-9\.]*)[\]]/', $color, $m) > 0) {
|
||||
if (preg_match('/[\[][\"\'](t|g|rgba|rgb|cmyk)[\"\'][\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\]]/', $color, $m) > 0) {
|
||||
$returncolor = array();
|
||||
switch ($m[1]) {
|
||||
case 'cmyk': {
|
||||
@@ -286,7 +286,8 @@ class TCPDF_COLORS {
|
||||
$returncolor['K'] = max(0, min(100, (floatval($m[5]) * 100)));
|
||||
break;
|
||||
}
|
||||
case 'rgb': {
|
||||
case 'rgb':
|
||||
case 'rgba': {
|
||||
// RGB
|
||||
$returncolor['R'] = max(0, min(255, (floatval($m[2]) * 255)));
|
||||
$returncolor['G'] = max(0, min(255, (floatval($m[3]) * 255)));
|
||||
@@ -317,6 +318,25 @@ class TCPDF_COLORS {
|
||||
if (strlen($color) == 0) {
|
||||
return $defcol;
|
||||
}
|
||||
// RGBA ARRAY
|
||||
if (substr($color, 0, 4) == 'rgba') {
|
||||
$codes = substr($color, 5);
|
||||
$codes = str_replace(')', '', $codes);
|
||||
$returncolor = explode(',', $codes);
|
||||
// remove alpha component
|
||||
array_pop($returncolor);
|
||||
foreach ($returncolor as $key => $val) {
|
||||
if (strpos($val, '%') > 0) {
|
||||
// percentage
|
||||
$returncolor[$key] = (255 * intval($val) / 100);
|
||||
} else {
|
||||
$returncolor[$key] = intval($val); /* floatize */
|
||||
}
|
||||
// normalize value
|
||||
$returncolor[$key] = max(0, min(255, $returncolor[$key]));
|
||||
}
|
||||
return $returncolor;
|
||||
}
|
||||
// RGB ARRAY
|
||||
if (substr($color, 0, 3) == 'rgb') {
|
||||
$codes = substr($color, 4);
|
||||
@@ -407,8 +427,8 @@ class TCPDF_COLORS {
|
||||
|
||||
/**
|
||||
* Convert a color array into a string representation.
|
||||
* @param $c (array) Array of colors.
|
||||
* @return (string) The color array representation.
|
||||
* @param array $c Array of colors.
|
||||
* @return string The color array representation.
|
||||
* @since 5.9.137 (2011-12-01)
|
||||
* @public static
|
||||
*/
|
||||
@@ -438,7 +458,7 @@ class TCPDF_COLORS {
|
||||
|
||||
/**
|
||||
* Convert color to javascript color.
|
||||
* @param $color (string) color name or "#RRGGBB"
|
||||
* @param string $color color name or "#RRGGBB"
|
||||
* @protected
|
||||
* @since 2.1.002 (2008-02-12)
|
||||
* @public static
|
||||
@@ -449,7 +469,7 @@ class TCPDF_COLORS {
|
||||
}
|
||||
if (!in_array($color, self::$jscolor)) {
|
||||
// default transparent color
|
||||
$color = $jscolor[0];
|
||||
$color = self::$jscolor[0];
|
||||
}
|
||||
return 'color.'.$color;
|
||||
}
|
||||
|
||||
+28
-28
@@ -5,9 +5,9 @@
|
||||
// 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 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
// Copyright (C) 2011-2013 Nicola Asuni - Tecnick.com LTD
|
||||
// Copyright (C) 2011-2026 Nicola Asuni - Tecnick.com LTD
|
||||
//
|
||||
// This file is part of TCPDF software library.
|
||||
//
|
||||
@@ -60,7 +60,7 @@ class TCPDF_FILTERS {
|
||||
|
||||
/**
|
||||
* Get a list of available decoding filters.
|
||||
* @return (array) Array of available filter decoders.
|
||||
* @return array Array of available filter decoders.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@@ -70,9 +70,9 @@ class TCPDF_FILTERS {
|
||||
|
||||
/**
|
||||
* Decode data using the specified filter type.
|
||||
* @param $filter (string) Filter name.
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @param string $filter Filter name.
|
||||
* @param string $data Data to decode.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@@ -130,8 +130,8 @@ class TCPDF_FILTERS {
|
||||
/**
|
||||
* Standard
|
||||
* Default decoding filter (leaves data unchanged).
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @param string $data Data to decode.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@@ -142,8 +142,8 @@ class TCPDF_FILTERS {
|
||||
/**
|
||||
* ASCIIHexDecode
|
||||
* Decodes data encoded in an ASCII hexadecimal representation, reproducing the original binary data.
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @param string $data Data to decode.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@@ -182,8 +182,8 @@ class TCPDF_FILTERS {
|
||||
/**
|
||||
* ASCII85Decode
|
||||
* Decodes data encoded in an ASCII base-85 representation, reproducing the original binary data.
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @param string $data Data to decode.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@@ -266,8 +266,8 @@ class TCPDF_FILTERS {
|
||||
/**
|
||||
* LZWDecode
|
||||
* Decompresses data encoded using the LZW (Lempel-Ziv-Welch) adaptive compression method, reproducing the original text or binary data.
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @param string $data Data to decode.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@@ -347,8 +347,8 @@ class TCPDF_FILTERS {
|
||||
/**
|
||||
* FlateDecode
|
||||
* Decompresses data encoded using the zlib/deflate compression method, reproducing the original text or binary data.
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @param string $data Data to decode.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@@ -364,7 +364,7 @@ class TCPDF_FILTERS {
|
||||
/**
|
||||
* RunLengthDecode
|
||||
* Decompresses data encoded using a byte-oriented run-length encoding algorithm.
|
||||
* @param $data (string) Data to decode.
|
||||
* @param string $data Data to decode.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@@ -400,8 +400,8 @@ class TCPDF_FILTERS {
|
||||
/**
|
||||
* CCITTFaxDecode (NOT IMPLEMETED - RETURN AN EXCEPTION)
|
||||
* Decompresses data encoded using the CCITT facsimile standard, reproducing the original data (typically monochrome image data at 1 bit per pixel).
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @param string $data Data to decode.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@@ -413,8 +413,8 @@ class TCPDF_FILTERS {
|
||||
/**
|
||||
* JBIG2Decode (NOT IMPLEMETED - RETURN AN EXCEPTION)
|
||||
* Decompresses data encoded using the JBIG2 standard, reproducing the original monochrome (1 bit per pixel) image data (or an approximation of that data).
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @param string $data Data to decode.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@@ -426,8 +426,8 @@ class TCPDF_FILTERS {
|
||||
/**
|
||||
* DCTDecode (NOT IMPLEMETED - RETURN AN EXCEPTION)
|
||||
* Decompresses data encoded using a DCT (discrete cosine transform) technique based on the JPEG standard, reproducing image sample data that approximates the original data.
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @param string $data Data to decode.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@@ -439,8 +439,8 @@ class TCPDF_FILTERS {
|
||||
/**
|
||||
* JPXDecode (NOT IMPLEMETED - RETURN AN EXCEPTION)
|
||||
* Decompresses data encoded using the wavelet-based JPEG2000 standard, reproducing the original image data.
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @param string $data Data to decode.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@@ -452,8 +452,8 @@ class TCPDF_FILTERS {
|
||||
/**
|
||||
* Crypt (NOT IMPLEMETED - RETURN AN EXCEPTION)
|
||||
* Decrypts data encrypted by a security handler, reproducing the data as it was before encryption.
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
* @param string $data Data to decode.
|
||||
* @return string Decoded data string.
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
@@ -466,7 +466,7 @@ class TCPDF_FILTERS {
|
||||
|
||||
/**
|
||||
* Throw an exception.
|
||||
* @param $msg (string) The error message
|
||||
* @param string $msg The error message
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
|
||||
+3
-3
@@ -5,9 +5,9 @@
|
||||
// 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 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
// Copyright (C) 2008-2013 Nicola Asuni - Tecnick.com LTD
|
||||
// Copyright (C) 2008-2026 Nicola Asuni - Tecnick.com LTD
|
||||
//
|
||||
// This file is part of TCPDF software library.
|
||||
//
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
// along with TCPDF. If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
// See LICENSE.TXT file for more information.
|
||||
// -------------------------------------------------------------------
|
||||
|
||||
+140
-136
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf_fonts.php
|
||||
// Version : 1.1.0
|
||||
// Version : 1.1.1
|
||||
// Begin : 2008-01-01
|
||||
// Last Update : 2014-12-10
|
||||
// Last Update : 2024-12-23
|
||||
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
|
||||
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
// Copyright (C) 2008-2014 Nicola Asuni - Tecnick.com LTD
|
||||
// Copyright (C) 2008-2026 Nicola Asuni - Tecnick.com LTD
|
||||
//
|
||||
// This file is part of TCPDF software library.
|
||||
//
|
||||
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
// along with TCPDF. If not, see <https://www.gnu.org/licenses/>.
|
||||
//
|
||||
// See LICENSE.TXT file for more information.
|
||||
// -------------------------------------------------------------------
|
||||
@@ -42,7 +42,7 @@
|
||||
* @class TCPDF_FONTS
|
||||
* Font methods for TCPDF library.
|
||||
* @package com.tecnick.tcpdf
|
||||
* @version 1.1.0
|
||||
* @version 1.1.1
|
||||
* @author Nicola Asuni - info@tecnick.com
|
||||
*/
|
||||
class TCPDF_FONTS {
|
||||
@@ -55,16 +55,16 @@ class TCPDF_FONTS {
|
||||
|
||||
/**
|
||||
* Convert and add the selected TrueType or Type1 font to the fonts folder (that must be writeable).
|
||||
* @param $fontfile (string) Font file (full path).
|
||||
* @param $fonttype (string) Font type. Leave empty for autodetect mode. Valid values are: TrueTypeUnicode, TrueType, Type1, CID0JP = CID-0 Japanese, CID0KR = CID-0 Korean, CID0CS = CID-0 Chinese Simplified, CID0CT = CID-0 Chinese Traditional.
|
||||
* @param $enc (string) Name of the encoding table to use. Leave empty for default mode. Omit this parameter for TrueType Unicode and symbolic fonts like Symbol or ZapfDingBats.
|
||||
* @param $flags (int) Unsigned 32-bit integer containing flags specifying various characteristics of the font (PDF32000:2008 - 9.8.2 Font Descriptor Flags): +1 for fixed font; +4 for symbol or +32 for non-symbol; +64 for italic. Fixed and Italic mode are generally autodetected so you have to set it to 32 = non-symbolic font (default) or 4 = symbolic font.
|
||||
* @param $outpath (string) Output path for generated font files (must be writeable by the web server). Leave empty for default font folder.
|
||||
* @param $platid (int) Platform ID for CMAP table to extract (when building a Unicode font for Windows this value should be 3, for Macintosh should be 1).
|
||||
* @param $encid (int) Encoding ID for CMAP table to extract (when building a Unicode font for Windows this value should be 1, for Macintosh should be 0). When Platform ID is 3, legal values for Encoding ID are: 0=Symbol, 1=Unicode, 2=ShiftJIS, 3=PRC, 4=Big5, 5=Wansung, 6=Johab, 7=Reserved, 8=Reserved, 9=Reserved, 10=UCS-4.
|
||||
* @param $addcbbox (boolean) If true includes the character bounding box information on the php font file.
|
||||
* @param $link (boolean) If true link to system font instead of copying the font data (not transportable) - Note: do not work with Type1 fonts.
|
||||
* @return (string) TCPDF font name or boolean false in case of error.
|
||||
* @param string $fontfile Font file (full path).
|
||||
* @param string $fonttype Font type. Leave empty for autodetect mode. Valid values are: TrueTypeUnicode, TrueType, Type1, CID0JP = CID-0 Japanese, CID0KR = CID-0 Korean, CID0CS = CID-0 Chinese Simplified, CID0CT = CID-0 Chinese Traditional.
|
||||
* @param string $enc Name of the encoding table to use. Leave empty for default mode. Omit this parameter for TrueType Unicode and symbolic fonts like Symbol or ZapfDingBats.
|
||||
* @param int $flags Unsigned 32-bit integer containing flags specifying various characteristics of the font (PDF32000:2008 - 9.8.2 Font Descriptor Flags): +1 for fixed font; +4 for symbol or +32 for non-symbol; +64 for italic. Fixed and Italic mode are generally autodetected so you have to set it to 32 = non-symbolic font (default) or 4 = symbolic font.
|
||||
* @param string $outpath Output path for generated font files (must be writeable by the web server). Leave empty for default font folder.
|
||||
* @param int $platid Platform ID for CMAP table to extract (when building a Unicode font for Windows this value should be 3, for Macintosh should be 1).
|
||||
* @param int $encid Encoding ID for CMAP table to extract (when building a Unicode font for Windows this value should be 1, for Macintosh should be 0). When Platform ID is 3, legal values for Encoding ID are: 0=Symbol, 1=Unicode, 2=ShiftJIS, 3=PRC, 4=Big5, 5=Wansung, 6=Johab, 7=Reserved, 8=Reserved, 9=Reserved, 10=UCS-4.
|
||||
* @param boolean $addcbbox If true includes the character bounding box information on the php font file.
|
||||
* @param boolean $link If true link to system font instead of copying the font data (not transportable) - Note: do not work with Type1 fonts.
|
||||
* @return string|false TCPDF font name or boolean false in case of error.
|
||||
* @author Nicola Asuni
|
||||
* @since 5.9.123 (2010-09-30)
|
||||
* @public static
|
||||
@@ -191,29 +191,30 @@ class TCPDF_FONTS {
|
||||
fclose($fp);
|
||||
// get font info
|
||||
$fmetric['Flags'] = $flags;
|
||||
preg_match ('#/FullName[\s]*\(([^\)]*)#', $font, $matches);
|
||||
preg_match ('#/FullName[\s]*+\(([^\)]*+)#', $font, $matches);
|
||||
$fmetric['name'] = preg_replace('/[^a-zA-Z0-9_\-]/', '', $matches[1]);
|
||||
preg_match('#/FontBBox[\s]*{([^}]*)#', $font, $matches);
|
||||
$fmetric['bbox'] = trim($matches[1]);
|
||||
$bv = explode(' ', $fmetric['bbox']);
|
||||
$fmetric['Ascent'] = intval($bv[3]);
|
||||
$fmetric['Descent'] = intval($bv[1]);
|
||||
preg_match('#/ItalicAngle[\s]*([0-9\+\-]*)#', $font, $matches);
|
||||
preg_match('#/FontBBox[\s]*+{([^}]*+)#', $font, $matches);
|
||||
$rawbvl = explode(' ', trim($matches[1]));
|
||||
$bvl = [(int) $rawbvl[0], (int) $rawbvl[1], (int) $rawbvl[2], (int) $rawbvl[3]];
|
||||
$fmetric['bbox'] = implode(' ', $bvl);
|
||||
$fmetric['Ascent'] = $bvl[3];
|
||||
$fmetric['Descent'] = $bvl[1];
|
||||
preg_match('#/ItalicAngle[\s]*+([0-9\+\-]*+)#', $font, $matches);
|
||||
$fmetric['italicAngle'] = intval($matches[1]);
|
||||
if ($fmetric['italicAngle'] != 0) {
|
||||
$fmetric['Flags'] |= 64;
|
||||
}
|
||||
preg_match('#/UnderlinePosition[\s]*([0-9\+\-]*)#', $font, $matches);
|
||||
preg_match('#/UnderlinePosition[\s]*+([0-9\+\-]*+)#', $font, $matches);
|
||||
$fmetric['underlinePosition'] = intval($matches[1]);
|
||||
preg_match('#/UnderlineThickness[\s]*([0-9\+\-]*)#', $font, $matches);
|
||||
preg_match('#/UnderlineThickness[\s]*+([0-9\+\-]*+)#', $font, $matches);
|
||||
$fmetric['underlineThickness'] = intval($matches[1]);
|
||||
preg_match('#/isFixedPitch[\s]*([^\s]*)#', $font, $matches);
|
||||
preg_match('#/isFixedPitch[\s]*+([^\s]*+)#', $font, $matches);
|
||||
if ($matches[1] == 'true') {
|
||||
$fmetric['Flags'] |= 1;
|
||||
}
|
||||
// get internal map
|
||||
$imap = array();
|
||||
if (preg_match_all('#dup[\s]([0-9]+)[\s]*/([^\s]*)[\s]put#sU', $font, $fmap, PREG_SET_ORDER) > 0) {
|
||||
if (preg_match_all('#dup[\s]([0-9]+)[\s]*+/([^\s]*+)[\s]put#sU', $font, $fmap, PREG_SET_ORDER) > 0) {
|
||||
foreach ($fmap as $v) {
|
||||
$imap[$v[2]] = $v[1];
|
||||
}
|
||||
@@ -229,22 +230,22 @@ class TCPDF_FONTS {
|
||||
$eplain .= chr($chr ^ ($r >> 8));
|
||||
$r = ((($chr + $r) * $c1 + $c2) % 65536);
|
||||
}
|
||||
if (preg_match('#/ForceBold[\s]*([^\s]*)#', $eplain, $matches) > 0) {
|
||||
if (preg_match('#/ForceBold[\s]*+([^\s]*+)#', $eplain, $matches) > 0) {
|
||||
if ($matches[1] == 'true') {
|
||||
$fmetric['Flags'] |= 0x40000;
|
||||
}
|
||||
}
|
||||
if (preg_match('#/StdVW[\s]*\[([^\]]*)#', $eplain, $matches) > 0) {
|
||||
if (preg_match('#/StdVW[\s]*+\[([^\]]*+)#', $eplain, $matches) > 0) {
|
||||
$fmetric['StemV'] = intval($matches[1]);
|
||||
} else {
|
||||
$fmetric['StemV'] = 70;
|
||||
}
|
||||
if (preg_match('#/StdHW[\s]*\[([^\]]*)#', $eplain, $matches) > 0) {
|
||||
if (preg_match('#/StdHW[\s]*+\[([^\]]*+)#', $eplain, $matches) > 0) {
|
||||
$fmetric['StemH'] = intval($matches[1]);
|
||||
} else {
|
||||
$fmetric['StemH'] = 30;
|
||||
}
|
||||
if (preg_match('#/BlueValues[\s]*\[([^\]]*)#', $eplain, $matches) > 0) {
|
||||
if (preg_match('#/BlueValues[\s]*+\[([^\]]*+)#', $eplain, $matches) > 0) {
|
||||
$bv = explode(' ', $matches[1]);
|
||||
if (count($bv) >= 6) {
|
||||
$v1 = intval($bv[2]);
|
||||
@@ -265,7 +266,7 @@ class TCPDF_FONTS {
|
||||
$fmetric['CapHeight'] = 700;
|
||||
}
|
||||
// get the number of random bytes at the beginning of charstrings
|
||||
if (preg_match('#/lenIV[\s]*([0-9]*)#', $eplain, $matches) > 0) {
|
||||
if (preg_match('#/lenIV[\s]*+([\d]*+)#', $eplain, $matches) > 0) {
|
||||
$lenIV = intval($matches[1]);
|
||||
} else {
|
||||
$lenIV = 4;
|
||||
@@ -273,7 +274,7 @@ class TCPDF_FONTS {
|
||||
$fmetric['Leading'] = 0;
|
||||
// get charstring data
|
||||
$eplain = substr($eplain, (strpos($eplain, '/CharStrings') + 1));
|
||||
preg_match_all('#/([A-Za-z0-9\.]*)[\s][0-9]+[\s]RD[\s](.*)[\s]ND#sU', $eplain, $matches, PREG_SET_ORDER);
|
||||
preg_match_all('#/([A-Za-z0-9\.]*+)[\s][0-9]+[\s]RD[\s](.*)[\s]ND#sU', $eplain, $matches, PREG_SET_ORDER);
|
||||
if (!empty($enc) AND isset(TCPDF_FONT_DATA::$encmap[$enc])) {
|
||||
$enc_map = TCPDF_FONT_DATA::$encmap[$enc];
|
||||
} else {
|
||||
@@ -557,6 +558,7 @@ class TCPDF_FONTS {
|
||||
$numGlyphs = TCPDF_STATIC::_getUSHORT($font, $offset);
|
||||
// ---------- get CIDToGIDMap ----------
|
||||
$ctg = array();
|
||||
$c = 0;
|
||||
foreach ($encodingTables as $enctable) {
|
||||
// get only specified Platform ID and Encoding ID
|
||||
if (($enctable['platformID'] == $platid) AND ($enctable['encodingID'] == $encid)) {
|
||||
@@ -920,8 +922,8 @@ class TCPDF_FONTS {
|
||||
|
||||
/**
|
||||
* Returs the checksum of a TTF table.
|
||||
* @param $table (string) table to check
|
||||
* @param $length (int) length of table in bytes
|
||||
* @param string $table table to check
|
||||
* @param int $length length of table in bytes
|
||||
* @return int checksum
|
||||
* @author Nicola Asuni
|
||||
* @since 5.2.000 (2010-06-02)
|
||||
@@ -942,9 +944,9 @@ class TCPDF_FONTS {
|
||||
|
||||
/**
|
||||
* Returns a subset of the TrueType font data without the unused glyphs.
|
||||
* @param $font (string) TrueType font data.
|
||||
* @param $subsetchars (array) Array of used characters (the glyphs to keep).
|
||||
* @return (string) A subset of TrueType font data without the unused glyphs.
|
||||
* @param string $font TrueType font data.
|
||||
* @param array $subsetchars Array of used characters (the glyphs to keep).
|
||||
* @return string A subset of TrueType font data without the unused glyphs.
|
||||
* @author Nicola Asuni
|
||||
* @since 5.2.000 (2010-06-02)
|
||||
* @public static
|
||||
@@ -956,6 +958,7 @@ class TCPDF_FONTS {
|
||||
// sfnt version must be 0x00010000 for TrueType version 1.0.
|
||||
return $font;
|
||||
}
|
||||
$c = 0;
|
||||
$offset += 4;
|
||||
// get number of tables
|
||||
$numTables = TCPDF_STATIC::_getUSHORT($font, $offset);
|
||||
@@ -1149,7 +1152,7 @@ class TCPDF_FONTS {
|
||||
$subsetglyphs[$g] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 6: { // Format 6: Trimmed table mapping
|
||||
@@ -1321,43 +1324,43 @@ class TCPDF_FONTS {
|
||||
// set the checkSumAdjustment to 0
|
||||
$table[$tag]['data'] = substr($table[$tag]['data'], 0, 8)."\x0\x0\x0\x0".substr($table[$tag]['data'], 12);
|
||||
}
|
||||
$pad = 4 - ($table[$tag]['length'] % 4);
|
||||
if ($pad != 4) {
|
||||
// the length of a table must be a multiple of four bytes
|
||||
$table[$tag]['length'] += $pad;
|
||||
$table[$tag]['data'] .= str_repeat("\x0", $pad);
|
||||
}
|
||||
$table[$tag]['offset'] = $offset;
|
||||
$offset += $table[$tag]['length'];
|
||||
$numPad = ($offset + 3 & ~3) - $offset;
|
||||
if($numPad > 0) {
|
||||
$table[$tag]['data'] .= str_repeat("\x0", $numPad);
|
||||
$offset += $numPad;
|
||||
}
|
||||
// check sum is not changed (so keep the following line commented)
|
||||
//$table[$tag]['checkSum'] = self::_getTTFtableChecksum($table[$tag]['data'], $table[$tag]['length']);
|
||||
//$table[$tag]['checkSum'] = self::_getTTFtableChecksum($table[$tag]['data'], $table[$tag]['length'] + $numPad);
|
||||
} else {
|
||||
unset($table[$tag]);
|
||||
}
|
||||
}
|
||||
// add loca
|
||||
$table['loca'] = array();
|
||||
$table['loca']['data'] = $loca;
|
||||
$table['loca']['length'] = strlen($loca);
|
||||
$pad = 4 - ($table['loca']['length'] % 4);
|
||||
if ($pad != 4) {
|
||||
// the length of a table must be a multiple of four bytes
|
||||
$table['loca']['length'] += $pad;
|
||||
$table['loca']['data'] .= str_repeat("\x0", $pad);
|
||||
}
|
||||
$table['loca']['offset'] = $offset;
|
||||
$table['loca']['checkSum'] = self::_getTTFtableChecksum($table['loca']['data'], $table['loca']['length']);
|
||||
$offset += $table['loca']['length'];
|
||||
$numPad = ($offset + 3 & ~3) - $offset;
|
||||
if($numPad > 0) {
|
||||
$table['loca']['data'] .= str_repeat("\x0", $numPad);
|
||||
$offset += $numPad;
|
||||
}
|
||||
$table['loca']['checkSum'] = self::_getTTFtableChecksum($table['loca']['data'], $table['loca']['length'] + $numPad);
|
||||
// add glyf
|
||||
$table['glyf'] = array();
|
||||
$table['glyf']['data'] = $glyf;
|
||||
$table['glyf']['length'] = strlen($glyf);
|
||||
$pad = 4 - ($table['glyf']['length'] % 4);
|
||||
if ($pad != 4) {
|
||||
// the length of a table must be a multiple of four bytes
|
||||
$table['glyf']['length'] += $pad;
|
||||
$table['glyf']['data'] .= str_repeat("\x0", $pad);
|
||||
}
|
||||
$table['glyf']['offset'] = $offset;
|
||||
$table['glyf']['checkSum'] = self::_getTTFtableChecksum($table['glyf']['data'], $table['glyf']['length']);
|
||||
$offset += $table['glyf']['length'];
|
||||
$numPad = ($offset + 3 & ~3) - $offset;
|
||||
if($numPad > 0) {
|
||||
$table['glyf']['data'] .= str_repeat("\x0", $numPad);
|
||||
$offset += $numPad;
|
||||
}
|
||||
$table['glyf']['checkSum'] = self::_getTTFtableChecksum($table['glyf']['data'], $table['glyf']['length'] + $numPad);
|
||||
// rebuild font
|
||||
$font = '';
|
||||
$font .= pack('N', 0x10000); // sfnt version
|
||||
@@ -1381,15 +1384,15 @@ class TCPDF_FONTS {
|
||||
}
|
||||
// set checkSumAdjustment on head table
|
||||
$checkSumAdjustment = 0xB1B0AFBA - self::_getTTFtableChecksum($font, strlen($font));
|
||||
$font = substr($font, 0, $table['head']['offset'] + 8).pack('N', $checkSumAdjustment).substr($font, $table['head']['offset'] + 12);
|
||||
$font = substr($font, 0, $table['head']['offset'] + $offset + 4).pack('N', $checkSumAdjustment).substr($font, $table['head']['offset'] + $offset + 8);
|
||||
return $font;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs font widths
|
||||
* @param $font (array) font data
|
||||
* @param $cidoffset (int) offset for CID values
|
||||
* @return PDF command string for font widths
|
||||
* @param array $font font data
|
||||
* @param int $cidoffset offset for CID values
|
||||
* @return string PDF command string for font widths
|
||||
* @author Nicola Asuni
|
||||
* @since 4.4.000 (2008-12-07)
|
||||
* @public static
|
||||
@@ -1495,10 +1498,10 @@ class TCPDF_FONTS {
|
||||
|
||||
/**
|
||||
* Update the CIDToGIDMap string with a new value.
|
||||
* @param $map (string) CIDToGIDMap.
|
||||
* @param $cid (int) CID value.
|
||||
* @param $gid (int) GID value.
|
||||
* @return (string) CIDToGIDMap.
|
||||
* @param string $map CIDToGIDMap.
|
||||
* @param int $cid CID value.
|
||||
* @param int $gid GID value.
|
||||
* @return string CIDToGIDMap.
|
||||
* @author Nicola Asuni
|
||||
* @since 5.9.123 (2011-09-29)
|
||||
* @public static
|
||||
@@ -1533,8 +1536,8 @@ class TCPDF_FONTS {
|
||||
|
||||
/**
|
||||
* Return font full path
|
||||
* @param $file (string) Font file name.
|
||||
* @param $fontdir (string) Font directory (set to false fto search on default directories)
|
||||
* @param string $file Font file name.
|
||||
* @param string $fontdir Font directory (set to false fto search on default directories)
|
||||
* @return string Font full path or empty string
|
||||
* @author Nicola Asuni
|
||||
* @since 6.0.025
|
||||
@@ -1558,8 +1561,8 @@ class TCPDF_FONTS {
|
||||
|
||||
/**
|
||||
* Get a reference font size.
|
||||
* @param $size (string) String containing font size value.
|
||||
* @param $refsize (float) Reference font size in points.
|
||||
* @param string $size String containing font size value.
|
||||
* @param float $refsize Reference font size in points.
|
||||
* @return float value in points
|
||||
* @public static
|
||||
*/
|
||||
@@ -1657,9 +1660,9 @@ class TCPDF_FONTS {
|
||||
|
||||
/**
|
||||
* Returns the unicode caracter specified by the value
|
||||
* @param $c (int) UTF-8 value
|
||||
* @param $unicode (boolean) True if we are in unicode mode, false otherwise.
|
||||
* @return Returns the specified character.
|
||||
* @param int $c UTF-8 value
|
||||
* @param boolean $unicode True if we are in unicode mode, false otherwise.
|
||||
* @return string Returns the specified character.
|
||||
* @since 2.3.000 (2008-03-05)
|
||||
* @public static
|
||||
*/
|
||||
@@ -1686,8 +1689,8 @@ class TCPDF_FONTS {
|
||||
|
||||
/**
|
||||
* Returns the unicode caracter specified by UTF-8 value
|
||||
* @param $c (int) UTF-8 value
|
||||
* @return Returns the specified character.
|
||||
* @param int $c UTF-8 value
|
||||
* @return string Returns the specified character.
|
||||
* @public static
|
||||
*/
|
||||
public static function unichrUnicode($c) {
|
||||
@@ -1696,8 +1699,8 @@ class TCPDF_FONTS {
|
||||
|
||||
/**
|
||||
* Returns the unicode caracter specified by ASCII value
|
||||
* @param $c (int) UTF-8 value
|
||||
* @return Returns the specified character.
|
||||
* @param int $c UTF-8 value
|
||||
* @return string Returns the specified character.
|
||||
* @public static
|
||||
*/
|
||||
public static function unichrASCII($c) {
|
||||
@@ -1734,8 +1737,8 @@ class TCPDF_FONTS {
|
||||
* W1 = 110110yyyyyyyyyy
|
||||
* W2 = 110111xxxxxxxxxx
|
||||
* </pre>
|
||||
* @param $unicode (array) array containing UTF-8 unicode values
|
||||
* @param $setbom (boolean) if true set the Byte Order Mark (BOM = 0xFEFF)
|
||||
* @param array $unicode array containing UTF-8 unicode values
|
||||
* @param boolean $setbom if true set the Byte Order Mark (BOM = 0xFEFF)
|
||||
* @return string
|
||||
* @protected
|
||||
* @author Nicola Asuni
|
||||
@@ -1770,26 +1773,26 @@ class TCPDF_FONTS {
|
||||
|
||||
/**
|
||||
* Convert an array of UTF8 values to array of unicode characters
|
||||
* @param $ta (array) The input array of UTF8 values.
|
||||
* @param $isunicode (boolean) True for Unicode mode, false otherwise.
|
||||
* @return Return array of unicode characters
|
||||
* @param array $ta The input array of UTF8 values.
|
||||
* @param boolean $isunicode True for Unicode mode, false otherwise.
|
||||
* @return array Return array of unicode characters
|
||||
* @since 4.5.037 (2009-04-07)
|
||||
* @public static
|
||||
*/
|
||||
public static function UTF8ArrayToUniArray($ta, $isunicode=true) {
|
||||
if ($isunicode) {
|
||||
return array_map(array('TCPDF_FONTS', 'unichrUnicode'), $ta);
|
||||
return array_map(static::class.'::unichrUnicode', $ta);
|
||||
}
|
||||
return array_map(array('TCPDF_FONTS', 'unichrASCII'), $ta);
|
||||
return array_map(static::class.'::unichrASCII', $ta);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract a slice of the $strarr array and return it as string.
|
||||
* @param $strarr (string) The input array of characters.
|
||||
* @param $start (int) the starting element of $strarr.
|
||||
* @param $end (int) first element that will not be returned.
|
||||
* @param $unicode (boolean) True if we are in unicode mode, false otherwise.
|
||||
* @return Return part of a string
|
||||
* @param string[] $strarr The input array of characters.
|
||||
* @param int $start the starting element of $strarr.
|
||||
* @param int $end first element that will not be returned.
|
||||
* @param boolean $unicode True if we are in unicode mode, false otherwise.
|
||||
* @return string Return part of a string
|
||||
* @public static
|
||||
*/
|
||||
public static function UTF8ArrSubString($strarr, $start='', $end='', $unicode=true) {
|
||||
@@ -1808,10 +1811,10 @@ class TCPDF_FONTS {
|
||||
|
||||
/**
|
||||
* Extract a slice of the $uniarr array and return it as string.
|
||||
* @param $uniarr (string) The input array of characters.
|
||||
* @param $start (int) the starting element of $strarr.
|
||||
* @param $end (int) first element that will not be returned.
|
||||
* @return Return part of a string
|
||||
* @param string[] $uniarr The input array of characters.
|
||||
* @param int $start the starting element of $strarr.
|
||||
* @param int $end first element that will not be returned.
|
||||
* @return string Return part of a string
|
||||
* @since 4.5.037 (2009-04-07)
|
||||
* @public static
|
||||
*/
|
||||
@@ -1831,7 +1834,7 @@ class TCPDF_FONTS {
|
||||
|
||||
/**
|
||||
* Converts UTF-8 characters array to array of Latin1 characters array<br>
|
||||
* @param $unicode (array) array containing UTF-8 unicode values
|
||||
* @param array $unicode array containing UTF-8 unicode values
|
||||
* @return array
|
||||
* @author Nicola Asuni
|
||||
* @since 4.8.023 (2010-01-15)
|
||||
@@ -1855,9 +1858,9 @@ class TCPDF_FONTS {
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts UTF-8 characters array to array of Latin1 string<br>
|
||||
* @param $unicode (array) array containing UTF-8 unicode values
|
||||
* @return array
|
||||
* Converts UTF-8 characters array to Latin1 string<br>
|
||||
* @param array $unicode array containing UTF-8 unicode values
|
||||
* @return string
|
||||
* @author Nicola Asuni
|
||||
* @since 4.8.023 (2010-01-15)
|
||||
* @public static
|
||||
@@ -1882,8 +1885,8 @@ class TCPDF_FONTS {
|
||||
/**
|
||||
* Converts UTF-8 character to integer value.<br>
|
||||
* Uses the getUniord() method if the value is not cached.
|
||||
* @param $uch (string) character string to process.
|
||||
* @return integer Unicode value
|
||||
* @param string $uch character string to process.
|
||||
* @return int Unicode value
|
||||
* @public static
|
||||
*/
|
||||
public static function uniord($uch) {
|
||||
@@ -1921,8 +1924,8 @@ class TCPDF_FONTS {
|
||||
* UTF8-tail = %x80-BF
|
||||
* ---------------------------------------------------------------------
|
||||
* </pre>
|
||||
* @param $uch (string) character string to process.
|
||||
* @return integer Unicode value
|
||||
* @param string $uch character string to process.
|
||||
* @return int Unicode value
|
||||
* @author Nicola Asuni
|
||||
* @public static
|
||||
*/
|
||||
@@ -1988,18 +1991,19 @@ class TCPDF_FONTS {
|
||||
/**
|
||||
* Converts UTF-8 strings to codepoints array.<br>
|
||||
* Invalid byte sequences will be replaced with 0xFFFD (replacement character)<br>
|
||||
* @param $str (string) string to process.
|
||||
* @param $isunicode (boolean) True when the documetn is in Unicode mode, false otherwise.
|
||||
* @param $currentfont (array) Reference to current font array.
|
||||
* @param string $str string to process.
|
||||
* @param boolean $isunicode True when the documetn is in Unicode mode, false otherwise.
|
||||
* @param array $currentfont Reference to current font array.
|
||||
* @return array containing codepoints (UTF-8 characters values)
|
||||
* @author Nicola Asuni
|
||||
* @public static
|
||||
*/
|
||||
public static function UTF8StringToArray($str, $isunicode=true, &$currentfont) {
|
||||
public static function UTF8StringToArray($str, $isunicode, &$currentfont) {
|
||||
$str = is_null($str) ? '' : $str;
|
||||
if ($isunicode) {
|
||||
// requires PCRE unicode support turned on
|
||||
$chars = TCPDF_STATIC::pregSplit('//','u', $str, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$carr = array_map(array('TCPDF_FONTS', 'uniord'), $chars);
|
||||
$carr = array_map(static::class.'::uniord', $chars);
|
||||
} else {
|
||||
$chars = str_split($str);
|
||||
$carr = array_map('ord', $chars);
|
||||
@@ -2014,30 +2018,30 @@ class TCPDF_FONTS {
|
||||
|
||||
/**
|
||||
* Converts UTF-8 strings to Latin1 when using the standard 14 core fonts.<br>
|
||||
* @param $str (string) string to process.
|
||||
* @param $isunicode (boolean) True when the documetn is in Unicode mode, false otherwise.
|
||||
* @param $currentfont (array) Reference to current font array.
|
||||
* @param string $str string to process.
|
||||
* @param boolean $isunicode True when the documetn is in Unicode mode, false otherwise.
|
||||
* @param array $currentfont Reference to current font array.
|
||||
* @return string
|
||||
* @since 3.2.000 (2008-06-23)
|
||||
* @public static
|
||||
*/
|
||||
public static function UTF8ToLatin1($str, $isunicode=true, &$currentfont) {
|
||||
public static function UTF8ToLatin1($str, $isunicode, &$currentfont) {
|
||||
$unicode = self::UTF8StringToArray($str, $isunicode, $currentfont); // array containing UTF-8 unicode values
|
||||
return self::UTF8ArrToLatin1($unicode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts UTF-8 strings to UTF16-BE.<br>
|
||||
* @param $str (string) string to process.
|
||||
* @param $setbom (boolean) if true set the Byte Order Mark (BOM = 0xFEFF)
|
||||
* @param $isunicode (boolean) True when the documetn is in Unicode mode, false otherwise.
|
||||
* @param $currentfont (array) Reference to current font array.
|
||||
* @param string $str string to process.
|
||||
* @param boolean $setbom if true set the Byte Order Mark (BOM = 0xFEFF)
|
||||
* @param boolean $isunicode True when the documetn is in Unicode mode, false otherwise.
|
||||
* @param array $currentfont Reference to current font array.
|
||||
* @return string
|
||||
* @author Nicola Asuni
|
||||
* @since 1.53.0.TC005 (2005-01-05)
|
||||
* @public static
|
||||
*/
|
||||
public static function UTF8ToUTF16BE($str, $setbom=false, $isunicode=true, &$currentfont) {
|
||||
public static function UTF8ToUTF16BE($str, $setbom, $isunicode, &$currentfont) {
|
||||
if (!$isunicode) {
|
||||
return $str; // string is not in unicode
|
||||
}
|
||||
@@ -2047,50 +2051,50 @@ class TCPDF_FONTS {
|
||||
|
||||
/**
|
||||
* Reverse the RLT substrings using the Bidirectional Algorithm (http://unicode.org/reports/tr9/).
|
||||
* @param $str (string) string to manipulate.
|
||||
* @param $setbom (bool) if true set the Byte Order Mark (BOM = 0xFEFF)
|
||||
* @param $forcertl (bool) if true forces RTL text direction
|
||||
* @param $isunicode (boolean) True if the document is in Unicode mode, false otherwise.
|
||||
* @param $currentfont (array) Reference to current font array.
|
||||
* @param string $str string to manipulate.
|
||||
* @param bool $setbom if true set the Byte Order Mark (BOM = 0xFEFF)
|
||||
* @param bool $forcertl if true forces RTL text direction
|
||||
* @param boolean $isunicode True if the document is in Unicode mode, false otherwise.
|
||||
* @param array $currentfont Reference to current font array.
|
||||
* @return string
|
||||
* @author Nicola Asuni
|
||||
* @since 2.1.000 (2008-01-08)
|
||||
* @public static
|
||||
*/
|
||||
public static function utf8StrRev($str, $setbom=false, $forcertl=false, $isunicode=true, &$currentfont) {
|
||||
public static function utf8StrRev($str, $setbom, $forcertl, $isunicode, &$currentfont) {
|
||||
return self::utf8StrArrRev(self::UTF8StringToArray($str, $isunicode, $currentfont), $str, $setbom, $forcertl, $isunicode, $currentfont);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the RLT substrings array using the Bidirectional Algorithm (http://unicode.org/reports/tr9/).
|
||||
* @param $arr (array) array of unicode values.
|
||||
* @param $str (string) string to manipulate (or empty value).
|
||||
* @param $setbom (bool) if true set the Byte Order Mark (BOM = 0xFEFF)
|
||||
* @param $forcertl (bool) if true forces RTL text direction
|
||||
* @param $isunicode (boolean) True if the document is in Unicode mode, false otherwise.
|
||||
* @param $currentfont (array) Reference to current font array.
|
||||
* @param array $arr array of unicode values.
|
||||
* @param string $str string to manipulate (or empty value).
|
||||
* @param bool $setbom if true set the Byte Order Mark (BOM = 0xFEFF)
|
||||
* @param bool $forcertl if true forces RTL text direction
|
||||
* @param boolean $isunicode True if the document is in Unicode mode, false otherwise.
|
||||
* @param array $currentfont Reference to current font array.
|
||||
* @return string
|
||||
* @author Nicola Asuni
|
||||
* @since 4.9.000 (2010-03-27)
|
||||
* @public static
|
||||
*/
|
||||
public static function utf8StrArrRev($arr, $str='', $setbom=false, $forcertl=false, $isunicode=true, &$currentfont) {
|
||||
public static function utf8StrArrRev($arr, $str, $setbom, $forcertl, $isunicode, &$currentfont) {
|
||||
return self::arrUTF8ToUTF16BE(self::utf8Bidi($arr, $str, $forcertl, $isunicode, $currentfont), $setbom);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the RLT substrings using the Bidirectional Algorithm (http://unicode.org/reports/tr9/).
|
||||
* @param $ta (array) array of characters composing the string.
|
||||
* @param $str (string) string to process
|
||||
* @param $forcertl (bool) if 'R' forces RTL, if 'L' forces LTR
|
||||
* @param $isunicode (boolean) True if the document is in Unicode mode, false otherwise.
|
||||
* @param $currentfont (array) Reference to current font array.
|
||||
* @param array $ta array of characters composing the string.
|
||||
* @param string $str string to process
|
||||
* @param bool $forcertl if 'R' forces RTL, if 'L' forces LTR
|
||||
* @param boolean $isunicode True if the document is in Unicode mode, false otherwise.
|
||||
* @param array $currentfont Reference to current font array.
|
||||
* @return array of unicode chars
|
||||
* @author Nicola Asuni
|
||||
* @since 2.4.000 (2008-03-06)
|
||||
* @public static
|
||||
*/
|
||||
public static function utf8Bidi($ta, $str='', $forcertl=false, $isunicode=true, &$currentfont) {
|
||||
public static function utf8Bidi($ta, $str, $forcertl, $isunicode, &$currentfont) {
|
||||
// paragraph embedding level
|
||||
$pel = 0;
|
||||
// max level
|
||||
|
||||
+29
-26
@@ -5,9 +5,9 @@
|
||||
// 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 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
// Copyright (C) 2002-2014 Nicola Asuni - Tecnick.com LTD
|
||||
// Copyright (C) 2002-2026 Nicola Asuni - Tecnick.com LTD
|
||||
//
|
||||
// This file is part of TCPDF software library.
|
||||
//
|
||||
@@ -55,6 +55,8 @@ class TCPDF_IMAGES {
|
||||
* Array of hinheritable SVG properties.
|
||||
* @since 5.0.000 (2010-05-02)
|
||||
* @public static
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
public static $svginheritprop = array('clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cursor', 'direction', 'display', 'fill', 'fill-opacity', 'fill-rule', 'font', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'image-rendering', 'kerning', 'letter-spacing', 'marker', 'marker-end', 'marker-mid', 'marker-start', 'pointer-events', 'shape-rendering', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-rendering', 'visibility', 'word-spacing', 'writing-mode');
|
||||
|
||||
@@ -62,8 +64,8 @@ class TCPDF_IMAGES {
|
||||
|
||||
/**
|
||||
* Return the image type given the file name or array returned by getimagesize() function.
|
||||
* @param $imgfile (string) image file name
|
||||
* @param $iminfo (array) array of image information returned by getimagesize() function.
|
||||
* @param string $imgfile image file name
|
||||
* @param array $iminfo array of image information returned by getimagesize() function.
|
||||
* @return string image type
|
||||
* @since 4.8.017 (2009-11-27)
|
||||
* @public static
|
||||
@@ -77,10 +79,7 @@ class TCPDF_IMAGES {
|
||||
}
|
||||
}
|
||||
if (empty($type)) {
|
||||
$fileinfo = pathinfo($imgfile);
|
||||
if (isset($fileinfo['extension']) AND (!TCPDF_STATIC::empty_string($fileinfo['extension']))) {
|
||||
$type = strtolower(trim($fileinfo['extension']));
|
||||
}
|
||||
$type = strtolower(trim(pathinfo(parse_url($imgfile, PHP_URL_PATH), PATHINFO_EXTENSION)));
|
||||
}
|
||||
if ($type == 'jpg') {
|
||||
$type = 'jpeg';
|
||||
@@ -90,9 +89,9 @@ class TCPDF_IMAGES {
|
||||
|
||||
/**
|
||||
* Set the transparency for the given GD image.
|
||||
* @param $new_image (image) GD image object
|
||||
* @param $image (image) GD image object.
|
||||
* return GD image object.
|
||||
* @param resource $new_image GD image object
|
||||
* @param resource $image GD image object.
|
||||
* @return resource GD image object $new_image
|
||||
* @since 4.9.016 (2010-04-20)
|
||||
* @public static
|
||||
*/
|
||||
@@ -115,8 +114,8 @@ class TCPDF_IMAGES {
|
||||
/**
|
||||
* Convert the loaded image to a PNG and then return a structure for the PDF creator.
|
||||
* This function requires GD library and write access to the directory defined on K_PATH_CACHE constant.
|
||||
* @param $image (image) Image object.
|
||||
* @param $tempfile (string) Temporary file name.
|
||||
* @param resource $image Image object.
|
||||
* @param string $tempfile Temporary file name.
|
||||
* return image PNG image object.
|
||||
* @since 4.9.016 (2010-04-20)
|
||||
* @public static
|
||||
@@ -127,7 +126,9 @@ class TCPDF_IMAGES {
|
||||
// create temporary PNG image
|
||||
imagepng($image, $tempfile);
|
||||
// remove image from memory
|
||||
imagedestroy($image);
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
imagedestroy($image);
|
||||
}
|
||||
// get PNG image data
|
||||
$retvars = self::_parsepng($tempfile);
|
||||
// tidy up by removing temporary image
|
||||
@@ -138,15 +139,17 @@ class TCPDF_IMAGES {
|
||||
/**
|
||||
* Convert the loaded image to a JPEG and then return a structure for the PDF creator.
|
||||
* This function requires GD library and write access to the directory defined on K_PATH_CACHE constant.
|
||||
* @param $image (image) Image object.
|
||||
* @param $quality (int) JPEG quality.
|
||||
* @param $tempfile (string) Temporary file name.
|
||||
* return image JPEG image object.
|
||||
* @param resource $image Image object.
|
||||
* @param int $quality JPEG quality.
|
||||
* @param string $tempfile Temporary file name.
|
||||
* return array|false image JPEG image object.
|
||||
* @public static
|
||||
*/
|
||||
public static function _toJPEG($image, $quality, $tempfile) {
|
||||
imagejpeg($image, $tempfile, $quality);
|
||||
imagedestroy($image);
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
imagedestroy($image);
|
||||
}
|
||||
$retvars = self::_parsejpeg($tempfile);
|
||||
// tidy up by removing temporary image
|
||||
unlink($tempfile);
|
||||
@@ -155,8 +158,8 @@ class TCPDF_IMAGES {
|
||||
|
||||
/**
|
||||
* Extract info from a JPEG file without using the GD library.
|
||||
* @param $file (string) image file to parse
|
||||
* @return array structure containing the image data
|
||||
* @param string $file image file to parse
|
||||
* @return array|false structure containing the image data
|
||||
* @public static
|
||||
*/
|
||||
public static function _parsejpeg($file) {
|
||||
@@ -234,8 +237,8 @@ class TCPDF_IMAGES {
|
||||
|
||||
/**
|
||||
* Extract info from a PNG file without using the GD library.
|
||||
* @param $file (string) image file to parse
|
||||
* @return array structure containing the image data
|
||||
* @param string $file image file to parse
|
||||
* @return array|false structure containing the image data
|
||||
* @public static
|
||||
*/
|
||||
public static function _parsepng($file) {
|
||||
@@ -271,12 +274,12 @@ class TCPDF_IMAGES {
|
||||
return 'pngalpha';
|
||||
}
|
||||
if (ord(fread($f, 1)) != 0) {
|
||||
// Unknown compression method
|
||||
// Unknownn compression method
|
||||
fclose($f);
|
||||
return false;
|
||||
}
|
||||
if (ord(fread($f, 1)) != 0) {
|
||||
// Unknown filter method
|
||||
// Unknownn filter method
|
||||
fclose($f);
|
||||
return false;
|
||||
}
|
||||
@@ -328,7 +331,7 @@ class TCPDF_IMAGES {
|
||||
}
|
||||
// get compression method
|
||||
if (ord(fread($f, 1)) != 0) {
|
||||
// Unknown filter method
|
||||
// Unknownn filter method
|
||||
fclose($f);
|
||||
return false;
|
||||
}
|
||||
|
||||
+255
-230
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf_static.php
|
||||
// Version : 1.1.4
|
||||
// Version : 1.1.5
|
||||
// Begin : 2002-08-03
|
||||
// Last Update : 2019-11-01
|
||||
// Last Update : 2024-12-23
|
||||
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
|
||||
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// License : GNU-LGPL v3 (https://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
// Copyright (C) 2002-2015 Nicola Asuni - Tecnick.com LTD
|
||||
// Copyright (C) 2002-2026 Nicola Asuni - Tecnick.com LTD
|
||||
//
|
||||
// This file is part of TCPDF software library.
|
||||
//
|
||||
@@ -38,7 +38,7 @@
|
||||
* This is a PHP class that contains static methods for the TCPDF class.<br>
|
||||
* @package com.tecnick.tcpdf
|
||||
* @author Nicola Asuni
|
||||
* @version 1.1.2
|
||||
* @version 1.1.5
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -46,7 +46,7 @@
|
||||
* Static methods used by the TCPDF class.
|
||||
* @package com.tecnick.tcpdf
|
||||
* @brief PHP class for generating PDF documents without requiring external extensions.
|
||||
* @version 1.1.1
|
||||
* @version 1.1.5
|
||||
* @author Nicola Asuni - info@tecnick.com
|
||||
*/
|
||||
class TCPDF_STATIC {
|
||||
@@ -55,7 +55,7 @@ class TCPDF_STATIC {
|
||||
* Current TCPDF version.
|
||||
* @private static
|
||||
*/
|
||||
private static $tcpdf_version = '6.3.5';
|
||||
private static $tcpdf_version = '6.11.3';
|
||||
|
||||
/**
|
||||
* String alias for total number of pages.
|
||||
@@ -106,11 +106,36 @@ class TCPDF_STATIC {
|
||||
*/
|
||||
public static $pageboxes = array('MediaBox', 'CropBox', 'BleedBox', 'TrimBox', 'ArtBox');
|
||||
|
||||
/**
|
||||
* Array of default cURL options for curl_setopt_array.
|
||||
*
|
||||
* @var array<int, bool|int|string> cURL options.
|
||||
*/
|
||||
protected const CURLOPT_DEFAULT = [
|
||||
CURLOPT_CONNECTTIMEOUT => 5,
|
||||
CURLOPT_MAXREDIRS => 5,
|
||||
CURLOPT_PROTOCOLS => CURLPROTO_HTTPS | CURLPROTO_HTTP | CURLPROTO_FTP | CURLPROTO_FTPS,
|
||||
CURLOPT_SSL_VERIFYHOST => 2,
|
||||
CURLOPT_SSL_VERIFYPEER => true,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_USERAGENT => 'tcpdf',
|
||||
];
|
||||
|
||||
/**
|
||||
* Array of fixed cURL options for curl_setopt_array.
|
||||
*
|
||||
* @var array<int, bool|int|string> cURL options.
|
||||
*/
|
||||
protected const CURLOPT_FIXED = [
|
||||
CURLOPT_FAILONERROR => true,
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
];
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
/**
|
||||
* Return the current TCPDF version.
|
||||
* @return TCPDF version string
|
||||
* @return string TCPDF version string
|
||||
* @since 5.9.012 (2010-11-10)
|
||||
* @public static
|
||||
*/
|
||||
@@ -120,7 +145,7 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Return the current TCPDF producer.
|
||||
* @return TCPDF producer string
|
||||
* @return string TCPDF producer string
|
||||
* @since 6.0.000 (2013-03-16)
|
||||
* @public static
|
||||
*/
|
||||
@@ -128,48 +153,18 @@ class TCPDF_STATIC {
|
||||
return "\x54\x43\x50\x44\x46\x20".self::getTCPDFVersion()."\x20\x28\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29";
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the current active configuration setting of magic_quotes_runtime (if the set_magic_quotes_runtime function exist)
|
||||
* @param $mqr (boolean) FALSE for off, TRUE for on.
|
||||
* @since 4.6.025 (2009-08-17)
|
||||
* @public static
|
||||
*/
|
||||
public static function set_mqr($mqr) {
|
||||
if (!defined('PHP_VERSION_ID')) {
|
||||
$version = PHP_VERSION;
|
||||
define('PHP_VERSION_ID', (($version[0] * 10000) + ($version[2] * 100) + $version[4]));
|
||||
}
|
||||
if (PHP_VERSION_ID < 50300) {
|
||||
@set_magic_quotes_runtime($mqr);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current active configuration setting of magic_quotes_runtime (if the get_magic_quotes_runtime function exist)
|
||||
* @return Returns 0 if magic quotes runtime is off or get_magic_quotes_runtime doesn't exist, 1 otherwise.
|
||||
* @since 4.6.025 (2009-08-17)
|
||||
* @public static
|
||||
*/
|
||||
public static function get_mqr() {
|
||||
if (!defined('PHP_VERSION_ID')) {
|
||||
$version = PHP_VERSION;
|
||||
define('PHP_VERSION_ID', (($version[0] * 10000) + ($version[2] * 100) + $version[4]));
|
||||
}
|
||||
if (PHP_VERSION_ID < 50300) {
|
||||
return @get_magic_quotes_runtime();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the URL exist.
|
||||
* @param $url (string) URL to check.
|
||||
* @return Boolean true if the URl exist, false otherwise.
|
||||
* @param string $url URL to check.
|
||||
* @return boolean true if the URl exist, false otherwise.
|
||||
* @since 5.9.204 (2013-01-28)
|
||||
* @public static
|
||||
*/
|
||||
public static function isValidURL($url) {
|
||||
$headers = @get_headers($url);
|
||||
if ($headers === false) {
|
||||
return false;
|
||||
}
|
||||
return (strpos($headers[0], '200') !== false);
|
||||
}
|
||||
|
||||
@@ -184,8 +179,8 @@ class TCPDF_STATIC {
|
||||
* <li>UTF-8 (hex): 0xC2 0xAD (c2ad)</li>
|
||||
* <li>UTF-8 character: chr(194).chr(173)</li>
|
||||
* </ul>
|
||||
* @param $txt (string) input string
|
||||
* @param $unicode (boolean) True if we are in unicode mode, false otherwise.
|
||||
* @param string $txt input string
|
||||
* @param boolean $unicode True if we are in unicode mode, false otherwise.
|
||||
* @return string without SHY characters.
|
||||
* @since (4.5.019) 2009-02-28
|
||||
* @public static
|
||||
@@ -201,10 +196,10 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Get the border mode accounting for multicell position (opens bottom side of multicell crossing pages)
|
||||
* @param $brd (mixed) Indicates if borders must be drawn around the cell block. The value can be a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul>or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> or an array of line styles for each border group: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
|
||||
* @param $position (string) multicell position: 'start', 'middle', 'end'
|
||||
* @param $opencell (boolean) True when the cell is left open at the page bottom, false otherwise.
|
||||
* @return border mode array
|
||||
* @param string|array|int $brd Indicates if borders must be drawn around the cell block. The value can be a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul>or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> or an array of line styles for each border group: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
|
||||
* @param string $position multicell position: 'start', 'middle', 'end'
|
||||
* @param boolean $opencell True when the cell is left open at the page bottom, false otherwise.
|
||||
* @return array border mode array
|
||||
* @since 4.4.002 (2008-12-09)
|
||||
* @public static
|
||||
*/
|
||||
@@ -275,8 +270,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Determine whether a string is empty.
|
||||
* @param $str (string) string to be checked
|
||||
* @return boolean true if string is empty
|
||||
* @param string $str string to be checked
|
||||
* @return bool true if string is empty
|
||||
* @since 4.5.044 (2009-04-16)
|
||||
* @public static
|
||||
*/
|
||||
@@ -286,8 +281,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Returns a temporary filename for caching object on filesystem.
|
||||
* @param $type (string) Type of file (name of the subdir on the tcpdf cache folder).
|
||||
* @param $file_id (string) TCPDF file_id.
|
||||
* @param string $type Type of file (name of the subdir on the tcpdf cache folder).
|
||||
* @param string $file_id TCPDF file_id.
|
||||
* @return string filename.
|
||||
* @since 4.5.000 (2008-12-31)
|
||||
* @public static
|
||||
@@ -298,7 +293,7 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Add "\" before "\", "(" and ")"
|
||||
* @param $s (string) string to escape.
|
||||
* @param string $s string to escape.
|
||||
* @return string escaped string.
|
||||
* @public static
|
||||
*/
|
||||
@@ -309,21 +304,21 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Escape some special characters (< > &) for XML output.
|
||||
* @param $str (string) Input string to convert.
|
||||
* @return converted string
|
||||
* @param string $str Input string to convert.
|
||||
* @return string converted string
|
||||
* @since 5.9.121 (2011-09-28)
|
||||
* @public static
|
||||
*/
|
||||
public static function _escapeXML($str) {
|
||||
$replaceTable = array("\0" => '', '&' => '&', '<' => '<', '>' => '>');
|
||||
$str = strtr($str, $replaceTable);
|
||||
$str = strtr($str === null ? '' : $str, $replaceTable);
|
||||
return $str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a copy of a class object
|
||||
* @param $object (object) class object to be cloned
|
||||
* @return cloned object
|
||||
* @param object $object class object to be cloned
|
||||
* @return object cloned object
|
||||
* @since 4.5.029 (2009-03-19)
|
||||
* @public static
|
||||
*/
|
||||
@@ -337,8 +332,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Output input data and compress it if possible.
|
||||
* @param $data (string) Data to output.
|
||||
* @param $length (int) Data length in bytes.
|
||||
* @param string $data Data to output.
|
||||
* @param int $length Data length in bytes.
|
||||
* @since 5.9.086
|
||||
* @public static
|
||||
*/
|
||||
@@ -352,10 +347,10 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Replace page number aliases with number.
|
||||
* @param $page (string) Page content.
|
||||
* @param $replace (array) Array of replacements (array keys are replacement strings, values are alias arrays).
|
||||
* @param $diff (int) If passed, this will be set to the total char number difference between alias and replacements.
|
||||
* @return replaced page content and updated $diff parameter as array.
|
||||
* @param string $page Page content.
|
||||
* @param array $replace Array of replacements (array keys are replacement strings, values are alias arrays).
|
||||
* @param int $diff If passed, this will be set to the total char number difference between alias and replacements.
|
||||
* @return array replaced page content and updated $diff parameter as array.
|
||||
* @public static
|
||||
*/
|
||||
public static function replacePageNumAliases($page, $replace, $diff=0) {
|
||||
@@ -372,7 +367,7 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Returns timestamp in seconds from formatted date-time.
|
||||
* @param $date (string) Formatted date-time.
|
||||
* @param string $date Formatted date-time.
|
||||
* @return int seconds.
|
||||
* @since 5.9.152 (2012-03-23)
|
||||
* @public static
|
||||
@@ -387,7 +382,7 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Returns a formatted date-time.
|
||||
* @param $time (int) Time in seconds.
|
||||
* @param int $time Time in seconds.
|
||||
* @return string escaped date string.
|
||||
* @since 5.9.152 (2012-03-23)
|
||||
* @public static
|
||||
@@ -398,7 +393,7 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Returns a string containing random data to be used as a seed for encryption methods.
|
||||
* @param $seed (string) starting seed value
|
||||
* @param string $seed starting seed value
|
||||
* @return string containing random data
|
||||
* @author Nicola Asuni
|
||||
* @since 5.9.006 (2010-10-19)
|
||||
@@ -409,7 +404,10 @@ class TCPDF_STATIC {
|
||||
if (function_exists('posix_getpid')) {
|
||||
$rnd .= posix_getpid();
|
||||
}
|
||||
if (function_exists('openssl_random_pseudo_bytes') AND (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')) {
|
||||
|
||||
if (function_exists('random_bytes')) {
|
||||
$rnd .= random_bytes(512);
|
||||
} elseif (function_exists('openssl_random_pseudo_bytes') AND (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN')) {
|
||||
// this is not used on windows systems because it is very slow for a know bug
|
||||
$rnd .= openssl_random_pseudo_bytes(512);
|
||||
} else {
|
||||
@@ -417,13 +415,13 @@ class TCPDF_STATIC {
|
||||
$rnd .= uniqid('', true);
|
||||
}
|
||||
}
|
||||
return $rnd.$seed.__FILE__.serialize($_SERVER).microtime(true);
|
||||
return $rnd.$seed.__FILE__.microtime(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Encrypts a string using MD5 and returns it's value as a binary string.
|
||||
* @param $str (string) input string
|
||||
* @return String MD5 encrypted binary string
|
||||
* @param string $str input string
|
||||
* @return string MD5 encrypted binary string
|
||||
* @since 2.0.000 (2008-01-02)
|
||||
* @public static
|
||||
*/
|
||||
@@ -432,11 +430,11 @@ class TCPDF_STATIC {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the input text exrypted using AES algorithm and the specified key.
|
||||
* Returns the input text encrypted using AES algorithm and the specified key.
|
||||
* This method requires openssl or mcrypt. Text is padded to 16bytes blocks
|
||||
* @param $key (string) encryption key
|
||||
* @param $text (String) input text to be encrypted
|
||||
* @return String encrypted text
|
||||
* @param string $key encryption key
|
||||
* @param string $text input text to be encrypted
|
||||
* @return string encrypted text
|
||||
* @author Nicola Asuni
|
||||
* @since 5.0.005 (2010-05-11)
|
||||
* @public static
|
||||
@@ -446,8 +444,12 @@ class TCPDF_STATIC {
|
||||
$padding = 16 - (strlen($text) % 16);
|
||||
$text .= str_repeat(chr($padding), $padding);
|
||||
if (extension_loaded('openssl')) {
|
||||
$iv = openssl_random_pseudo_bytes (openssl_cipher_iv_length('aes-256-cbc'));
|
||||
$text = openssl_encrypt($text, 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $iv);
|
||||
$algo = 'aes-256-cbc';
|
||||
if (strlen($key) == 16) {
|
||||
$algo = 'aes-128-cbc';
|
||||
}
|
||||
$iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length($algo));
|
||||
$text = openssl_encrypt($text, $algo, $key, OPENSSL_RAW_DATA, $iv);
|
||||
return $iv.substr($text, 0, -16);
|
||||
}
|
||||
$iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), MCRYPT_RAND);
|
||||
@@ -457,19 +459,23 @@ class TCPDF_STATIC {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the input text exrypted using AES algorithm and the specified key.
|
||||
* Returns the input text encrypted using AES algorithm and the specified key.
|
||||
* This method requires openssl or mcrypt. Text is not padded
|
||||
* @param $key (string) encryption key
|
||||
* @param $text (String) input text to be encrypted
|
||||
* @return String encrypted text
|
||||
* @param string $key encryption key
|
||||
* @param string $text input text to be encrypted
|
||||
* @return string encrypted text
|
||||
* @author Nicola Asuni
|
||||
* @since TODO
|
||||
* @public static
|
||||
*/
|
||||
public static function _AESnopad($key, $text) {
|
||||
if (extension_loaded('openssl')) {
|
||||
$iv = str_repeat("\x00", openssl_cipher_iv_length('aes-256-cbc'));
|
||||
$text = openssl_encrypt($text, 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $iv);
|
||||
$algo = 'aes-256-cbc';
|
||||
if (strlen($key) == 16) {
|
||||
$algo = 'aes-128-cbc';
|
||||
}
|
||||
$iv = str_repeat("\x00", openssl_cipher_iv_length($algo));
|
||||
$text = openssl_encrypt($text, $algo, $key, OPENSSL_RAW_DATA, $iv);
|
||||
return substr($text, 0, -16);
|
||||
}
|
||||
$iv = str_repeat("\x00", mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC));
|
||||
@@ -480,13 +486,13 @@ class TCPDF_STATIC {
|
||||
/**
|
||||
* Returns the input text encrypted using RC4 algorithm and the specified key.
|
||||
* RC4 is the standard encryption algorithm used in PDF format
|
||||
* @param $key (string) Encryption key.
|
||||
* @param $text (String) Input text to be encrypted.
|
||||
* @param $last_enc_key (String) Reference to last RC4 key encrypted.
|
||||
* @param $last_enc_key_c (String) Reference to last RC4 computed key.
|
||||
* @return String encrypted text
|
||||
* @param string $key Encryption key.
|
||||
* @param string $text Input text to be encrypted.
|
||||
* @param string $last_enc_key Reference to last RC4 key encrypted.
|
||||
* @param string $last_enc_key_c Reference to last RC4 computed key.
|
||||
* @return string encrypted text
|
||||
* @since 2.0.000 (2008-01-02)
|
||||
* @author Klemen Vodopivec, Nicola Asuni
|
||||
* @author Klemen Vodopivec,2026 Nicola Asuni
|
||||
* @public static
|
||||
*/
|
||||
public static function _RC4($key, $text, &$last_enc_key, &$last_enc_key_c) {
|
||||
@@ -495,7 +501,7 @@ class TCPDF_STATIC {
|
||||
return $out;
|
||||
}
|
||||
if ($last_enc_key != $key) {
|
||||
$k = str_repeat($key, ((256 / strlen($key)) + 1));
|
||||
$k = str_repeat($key, (int) ((256 / strlen($key)) + 1));
|
||||
$rc4 = range(0, 255);
|
||||
$j = 0;
|
||||
for ($i = 0; $i < 256; ++$i) {
|
||||
@@ -527,8 +533,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Return the permission code used on encryption (P value).
|
||||
* @param $permissions (Array) the set of permissions (specify the ones you want to block).
|
||||
* @param $mode (int) encryption strength: 0 = RC4 40 bit; 1 = RC4 128 bit; 2 = AES 128 bit; 3 = AES 256 bit.
|
||||
* @param array $permissions the set of permissions (specify the ones you want to block).
|
||||
* @param int $mode encryption strength: 0 = RC4 40 bit; 1 = RC4 128 bit; 2 = AES 128 bit; 3 = AES 256 bit.
|
||||
* @since 5.0.005 (2010-05-12)
|
||||
* @author Nicola Asuni
|
||||
* @public static
|
||||
@@ -564,8 +570,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Convert hexadecimal string to string
|
||||
* @param $bs (string) byte-string to convert
|
||||
* @return String
|
||||
* @param string $bs byte-string to convert
|
||||
* @return string
|
||||
* @since 5.0.005 (2010-05-12)
|
||||
* @author Nicola Asuni
|
||||
* @public static
|
||||
@@ -586,8 +592,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Convert string to hexadecimal string (byte string)
|
||||
* @param $s (string) string to convert
|
||||
* @return byte string
|
||||
* @param string $s string to convert
|
||||
* @return string byte string
|
||||
* @since 5.0.010 (2010-05-17)
|
||||
* @author Nicola Asuni
|
||||
* @public static
|
||||
@@ -603,8 +609,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Convert encryption P value to a string of bytes, low-order byte first.
|
||||
* @param $protection (string) 32bit encryption permission value (P value)
|
||||
* @return String
|
||||
* @param string $protection 32bit encryption permission value (P value)
|
||||
* @return string
|
||||
* @since 5.0.005 (2010-05-12)
|
||||
* @author Nicola Asuni
|
||||
* @public static
|
||||
@@ -620,8 +626,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Encode a name object.
|
||||
* @param $name (string) Name object to encode.
|
||||
* @return (string) Encoded name object.
|
||||
* @param string $name Name object to encode.
|
||||
* @return string Encoded name object.
|
||||
* @author Nicola Asuni
|
||||
* @since 5.9.097 (2011-06-23)
|
||||
* @public static
|
||||
@@ -642,9 +648,9 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Convert JavaScript form fields properties array to Annotation Properties array.
|
||||
* @param $prop (array) javascript field properties. Possible values are described on official Javascript for Acrobat API reference.
|
||||
* @param $spot_colors (array) Reference to spot colors array.
|
||||
* @param $rtl (boolean) True if in Right-To-Left text direction mode, false otherwise.
|
||||
* @param array $prop javascript field properties. Possible values are described on official Javascript for Acrobat API reference.
|
||||
* @param array $spot_colors Reference to spot colors array.
|
||||
* @param boolean $rtl True if in Right-To-Left text direction mode, false otherwise.
|
||||
* @return array of annotation properties
|
||||
* @author Nicola Asuni
|
||||
* @since 4.8.000 (2009-09-06)
|
||||
@@ -652,7 +658,7 @@ class TCPDF_STATIC {
|
||||
*/
|
||||
public static function getAnnotOptFromJSProp($prop, &$spot_colors, $rtl=false) {
|
||||
if (isset($prop['aopt']) AND is_array($prop['aopt'])) {
|
||||
// the annotation options area lready defined
|
||||
// the annotation options are already defined
|
||||
return $prop['aopt'];
|
||||
}
|
||||
$opt = array(); // value to be returned
|
||||
@@ -841,9 +847,7 @@ class TCPDF_STATIC {
|
||||
if (isset($prop['charLimit'])) {
|
||||
$opt['maxlen'] = intval($prop['charLimit']);
|
||||
}
|
||||
if (!isset($ff)) {
|
||||
$ff = 0; // default value
|
||||
}
|
||||
$ff = 0;
|
||||
// readonly: The read-only characteristic of a field. If a field is read-only, the user can see the field but cannot change it.
|
||||
if (isset($prop['readonly']) AND ($prop['readonly'] == 'true')) {
|
||||
$ff += 1 << 0;
|
||||
@@ -1011,8 +1015,9 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Format the page numbers.
|
||||
* This method can be overriden for custom formats.
|
||||
* @param $num (int) page number
|
||||
* This method can be overridden for custom formats.
|
||||
* @param int $num page number
|
||||
* @return string
|
||||
* @since 4.2.005 (2008-11-06)
|
||||
* @public static
|
||||
*/
|
||||
@@ -1022,8 +1027,9 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Format the page numbers on the Table Of Content.
|
||||
* This method can be overriden for custom formats.
|
||||
* @param $num (int) page number
|
||||
* This method can be overridden for custom formats.
|
||||
* @param int $num page number
|
||||
* @return string
|
||||
* @since 4.5.001 (2009-01-04)
|
||||
* @see addTOC(), addHTMLTOC()
|
||||
* @public static
|
||||
@@ -1034,8 +1040,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Extracts the CSS properties from a CSS string.
|
||||
* @param $cssdata (string) string containing CSS definitions.
|
||||
* @return An array where the keys are the CSS selectors and the values are the CSS properties.
|
||||
* @param string $cssdata string containing CSS definitions.
|
||||
* @return array An array where the keys are the CSS selectors and the values are the CSS properties.
|
||||
* @author Nicola Asuni
|
||||
* @since 5.1.000 (2010-05-25)
|
||||
* @public static
|
||||
@@ -1125,20 +1131,20 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Cleanup HTML code (requires HTML Tidy library).
|
||||
* @param $html (string) htmlcode to fix
|
||||
* @param $default_css (string) CSS commands to add
|
||||
* @param $tagvs (array) parameters for setHtmlVSpace method
|
||||
* @param $tidy_options (array) options for tidy_parse_string function
|
||||
* @param $tagvspaces (array) Array of vertical spaces for tags.
|
||||
* @param string $html htmlcode to fix
|
||||
* @param string $default_css CSS commands to add
|
||||
* @param array|null $tagvs parameters for setHtmlVSpace method
|
||||
* @param array|null $tidy_options options for tidy_parse_string function
|
||||
* @param array $tagvspaces Array of vertical spaces for tags.
|
||||
* @return string XHTML code cleaned up
|
||||
* @author Nicola Asuni
|
||||
* @since 5.9.017 (2010-11-16)
|
||||
* @see setHtmlVSpace()
|
||||
* @public static
|
||||
*/
|
||||
public static function fixHTMLCode($html, $default_css='', $tagvs='', $tidy_options='', &$tagvspaces) {
|
||||
public static function fixHTMLCode($html, $default_css, $tagvs, $tidy_options, &$tagvspaces) {
|
||||
// configure parameters for HTML Tidy
|
||||
if ($tidy_options === '') {
|
||||
if (TCPDF_STATIC::empty_string($tidy_options)) {
|
||||
$tidy_options = array (
|
||||
'clean' => 1,
|
||||
'drop-empty-paras' => 0,
|
||||
@@ -1185,7 +1191,7 @@ class TCPDF_STATIC {
|
||||
// remove some empty tag blocks
|
||||
$html = preg_replace('/<div([^\>]*)><\/div>/', '', $html);
|
||||
$html = preg_replace('/<p([^\>]*)><\/p>/', '', $html);
|
||||
if ($tagvs !== '') {
|
||||
if (!TCPDF_STATIC::empty_string($tagvs)) {
|
||||
// set vertical space for some XHTML tags
|
||||
$tagvspaces = $tagvs;
|
||||
}
|
||||
@@ -1195,9 +1201,9 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Returns true if the CSS selector is valid for the selected HTML tag
|
||||
* @param $dom (array) array of HTML tags and properties
|
||||
* @param $key (int) key of the current HTML tag
|
||||
* @param $selector (string) CSS selector string
|
||||
* @param array $dom array of HTML tags and properties
|
||||
* @param int $key key of the current HTML tag
|
||||
* @param string $selector CSS selector string
|
||||
* @return true if the selector is valid, false otherwise
|
||||
* @since 5.1.000 (2010-05-25)
|
||||
* @public static
|
||||
@@ -1355,9 +1361,9 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Returns the styles array that apply for the selected HTML tag.
|
||||
* @param $dom (array) array of HTML tags and properties
|
||||
* @param $key (int) key of the current HTML tag
|
||||
* @param $css (array) array of CSS properties
|
||||
* @param array $dom array of HTML tags and properties
|
||||
* @param int $key key of the current HTML tag
|
||||
* @param array $css array of CSS properties
|
||||
* @return array containing CSS properties
|
||||
* @since 5.1.000 (2010-05-25)
|
||||
* @public static
|
||||
@@ -1402,7 +1408,7 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Compact CSS data array into single string.
|
||||
* @param $css (array) array of CSS properties
|
||||
* @param array $css array of CSS properties
|
||||
* @return string containing merged CSS properties
|
||||
* @since 5.9.070 (2011-04-19)
|
||||
* @public static
|
||||
@@ -1433,13 +1439,17 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Returns the Roman representation of an integer number
|
||||
* @param $number (int) number to convert
|
||||
* @param int $number number to convert
|
||||
* @return string roman representation of the specified number
|
||||
* @since 4.4.004 (2008-12-10)
|
||||
* @public static
|
||||
*/
|
||||
public static function intToRoman($number) {
|
||||
$roman = '';
|
||||
if ($number >= 4000) {
|
||||
// do not represent numbers above 4000 in Roman numerals
|
||||
return strval($number);
|
||||
}
|
||||
while ($number >= 1000) {
|
||||
$roman .= 'M';
|
||||
$number -= 1000;
|
||||
@@ -1497,10 +1507,10 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Find position of last occurrence of a substring in a string
|
||||
* @param $haystack (string) The string to search in.
|
||||
* @param $needle (string) substring to search.
|
||||
* @param $offset (int) May be specified to begin searching an arbitrary number of characters into the string.
|
||||
* @return Returns the position where the needle exists. Returns FALSE if the needle was not found.
|
||||
* @param string $haystack The string to search in.
|
||||
* @param string $needle substring to search.
|
||||
* @param int $offset May be specified to begin searching an arbitrary number of characters into the string.
|
||||
* @return int|false Returns the position where the needle exists. Returns FALSE if the needle was not found.
|
||||
* @since 4.8.038 (2010-03-13)
|
||||
* @public static
|
||||
*/
|
||||
@@ -1513,7 +1523,7 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Returns an array of hyphenation patterns.
|
||||
* @param $file (string) TEX file containing hypenation patterns. TEX pattrns can be downloaded from http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/
|
||||
* @param string $file TEX file containing hypenation patterns. TEX patterns can be downloaded from http://www.ctan.org/tex-archive/language/hyph-utf8/tex/generic/hyph-utf8/patterns/
|
||||
* @return array of hyphenation patterns
|
||||
* @author Nicola Asuni
|
||||
* @since 4.9.012 (2010-04-12)
|
||||
@@ -1546,7 +1556,7 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Get the Path-Painting Operators.
|
||||
* @param $style (string) Style of rendering. Possible values are:
|
||||
* @param string $style Style of rendering. Possible values are:
|
||||
* <ul>
|
||||
* <li>S or D: Stroke the path.</li>
|
||||
* <li>s or d: Close and stroke the path.</li>
|
||||
@@ -1560,7 +1570,8 @@ class TCPDF_STATIC {
|
||||
* <li>CEO: Clipping mode using the nonzero winding number rule to determine which regions lie inside the clipping path</li>
|
||||
* <li>n: End the path object without filling or stroking it.</li>
|
||||
* </ul>
|
||||
* @param $default (string) default style
|
||||
* @param string $default default style
|
||||
* @return string
|
||||
* @author Nicola Asuni
|
||||
* @since 5.0.000 (2010-04-30)
|
||||
* @public static
|
||||
@@ -1637,9 +1648,9 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Get the product of two SVG tranformation matrices
|
||||
* @param $ta (array) first SVG tranformation matrix
|
||||
* @param $tb (array) second SVG tranformation matrix
|
||||
* @return transformation array
|
||||
* @param array $ta first SVG tranformation matrix
|
||||
* @param array $tb second SVG tranformation matrix
|
||||
* @return array transformation array
|
||||
* @author Nicola Asuni
|
||||
* @since 5.0.000 (2010-05-02)
|
||||
* @public static
|
||||
@@ -1657,7 +1668,7 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Get the tranformation matrix from SVG transform attribute
|
||||
* @param $attribute (string) transformation
|
||||
* @param string $attribute transformation
|
||||
* @return array of transformations
|
||||
* @author Nicola Asuni
|
||||
* @since 5.0.000 (2010-05-02)
|
||||
@@ -1752,10 +1763,10 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Returns the angle in radiants between two vectors
|
||||
* @param $x1 (int) X coordinate of first vector point
|
||||
* @param $y1 (int) Y coordinate of first vector point
|
||||
* @param $x2 (int) X coordinate of second vector point
|
||||
* @param $y2 (int) Y coordinate of second vector point
|
||||
* @param int $x1 X coordinate of first vector point
|
||||
* @param int $y1 Y coordinate of first vector point
|
||||
* @param int $x2 X coordinate of second vector point
|
||||
* @param int $y2 Y coordinate of second vector point
|
||||
* @author Nicola Asuni
|
||||
* @since 5.0.000 (2010-05-04)
|
||||
* @public static
|
||||
@@ -1777,20 +1788,27 @@ class TCPDF_STATIC {
|
||||
/**
|
||||
* 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
|
||||
* @param $pattern (string) The regular expression pattern to search for without the modifiers, as a string.
|
||||
* @param $modifiers (string) The modifiers part of the pattern,
|
||||
* @param $subject (string) The input string.
|
||||
* @param $limit (int) If specified, then only substrings up to limit are returned with the rest of the string being placed in the last substring. A limit of -1, 0 or NULL means "no limit" and, as is standard across PHP, you can use NULL to skip to the flags parameter.
|
||||
* @param $flags (int) The flags as specified on the preg_split PHP function.
|
||||
* @return Returns an array containing substrings of subject split along boundaries matched by pattern.modifier
|
||||
* @param string $pattern The regular expression pattern to search for without the modifiers, as a string.
|
||||
* @param string $modifiers The modifiers part of the pattern,
|
||||
* @param string $subject The input string.
|
||||
* @param int $limit If specified, then only substrings up to limit are returned with the rest of the string being placed in the last substring. A limit of -1, 0 or NULL means "no limit" and, as is standard across PHP, you can use NULL to skip to the flags parameter.
|
||||
* @param int $flags The flags as specified on the preg_split PHP function.
|
||||
* @return array Returns an array containing substrings of subject split along boundaries matched by pattern.modifier
|
||||
* @author Nicola Asuni
|
||||
* @since 6.0.023
|
||||
* @public static
|
||||
*/
|
||||
public static function pregSplit($pattern, $modifiers, $subject, $limit=NULL, $flags=NULL) {
|
||||
// PHP 8.1 deprecates nulls for $limit and $flags
|
||||
$limit = $limit === null ? -1 : $limit;
|
||||
$flags = $flags === null ? 0 : $flags;
|
||||
// the bug only happens on PHP 5.2 when using the u modifier
|
||||
if ((strpos($modifiers, 'u') === FALSE) OR (count(preg_split('//u', "\n\t", -1, PREG_SPLIT_NO_EMPTY)) == 2)) {
|
||||
return preg_split($pattern.$modifiers, $subject, $limit, $flags);
|
||||
$ret = preg_split($pattern.$modifiers, $subject, $limit, $flags);
|
||||
if ($ret === false) {
|
||||
return array();
|
||||
}
|
||||
return is_array($ret) ? $ret : array();
|
||||
}
|
||||
// preg_split is bugged - try alternative solution
|
||||
$ret = array();
|
||||
@@ -1807,9 +1825,9 @@ 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 string $filename Name of the file to open
|
||||
* @param string $mode
|
||||
* @return resource|false Returns a file pointer resource on success, or FALSE on error.
|
||||
* @public static
|
||||
*/
|
||||
public static function fopenLocal($filename, $mode) {
|
||||
@@ -1823,28 +1841,31 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Check if the URL exist.
|
||||
* @param url (string) URL to check.
|
||||
* @return Returns TRUE if the URL exists; FALSE otherwise.
|
||||
* @param string $url URL to check.
|
||||
* @return bool Returns TRUE if the URL exists; FALSE otherwise.
|
||||
* @public static
|
||||
* @since 6.2.25
|
||||
*/
|
||||
public static function url_exists($url) {
|
||||
$crs = curl_init();
|
||||
// encode query params in URL to get right response form the server
|
||||
$url = self::encodeUrlQuery($url);
|
||||
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');
|
||||
$curlopts = [];
|
||||
if (
|
||||
(ini_get('open_basedir') == '')
|
||||
&& (ini_get('safe_mode') === ''
|
||||
|| ini_get('safe_mode') === false)
|
||||
) {
|
||||
$curlopts[CURLOPT_FOLLOWLOCATION] = true;
|
||||
}
|
||||
$curlopts = array_replace($curlopts, self::CURLOPT_DEFAULT);
|
||||
$curlopts = array_replace($curlopts, K_CURLOPTS);
|
||||
$curlopts = array_replace($curlopts, self::CURLOPT_FIXED);
|
||||
$curlopts[CURLOPT_URL] = $url;
|
||||
curl_setopt_array($crs, $curlopts);
|
||||
curl_exec($crs);
|
||||
$code = curl_getinfo($crs, CURLINFO_HTTP_CODE);
|
||||
curl_close($crs);
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
curl_close($crs);
|
||||
}
|
||||
return ($code == 200);
|
||||
}
|
||||
|
||||
@@ -1859,9 +1880,10 @@ class TCPDF_STATIC {
|
||||
public static function encodeUrlQuery($url) {
|
||||
$urlData = parse_url($url);
|
||||
if (isset($urlData['query']) && $urlData['query']) {
|
||||
$urlQueryData = [];
|
||||
$urlQueryData = array();
|
||||
parse_str(urldecode($urlData['query']), $urlQueryData);
|
||||
$updatedUrl = $urlData['scheme'] . '://' . $urlData['host'] . $urlData['path'] . '?' . http_build_query($urlQueryData);
|
||||
$port = isset($urlData['port']) ? ':'.$urlData['port'] : '';
|
||||
$updatedUrl = $urlData['scheme'].'://'.$urlData['host'].$port.$urlData['path'].'?'.http_build_query($urlQueryData);
|
||||
} else {
|
||||
$updatedUrl = $url;
|
||||
}
|
||||
@@ -1872,8 +1894,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 string $filename Path to the file or directory.
|
||||
* @return bool Returns TRUE if the file or directory specified by filename exists; FALSE otherwise.
|
||||
* @public static
|
||||
*/
|
||||
public static function file_exists($filename) {
|
||||
@@ -1889,8 +1911,8 @@ 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.
|
||||
* @param string $file Name of the file or URL to read.
|
||||
* @return string|false The function returns the read data or FALSE on failure.
|
||||
* @author Nicola Asuni
|
||||
* @since 6.0.025
|
||||
* @public static
|
||||
@@ -1961,20 +1983,23 @@ class TCPDF_STATIC {
|
||||
) {
|
||||
// try to get remote file data using cURL
|
||||
$crs = curl_init();
|
||||
curl_setopt($crs, CURLOPT_URL, $path);
|
||||
curl_setopt($crs, CURLOPT_BINARYTRANSFER, true);
|
||||
curl_setopt($crs, CURLOPT_FAILONERROR, true);
|
||||
curl_setopt($crs, CURLOPT_RETURNTRANSFER, true);
|
||||
if ((ini_get('open_basedir') == '') && (!ini_get('safe_mode'))) {
|
||||
curl_setopt($crs, CURLOPT_FOLLOWLOCATION, true);
|
||||
$curlopts = [];
|
||||
if (
|
||||
(ini_get('open_basedir') == '')
|
||||
&& (ini_get('safe_mode') === ''
|
||||
|| ini_get('safe_mode') === false)
|
||||
) {
|
||||
$curlopts[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');
|
||||
$curlopts = array_replace($curlopts, self::CURLOPT_DEFAULT);
|
||||
$curlopts = array_replace($curlopts, K_CURLOPTS);
|
||||
$curlopts = array_replace($curlopts, self::CURLOPT_FIXED);
|
||||
$curlopts[CURLOPT_URL] = $url;
|
||||
curl_setopt_array($crs, $curlopts);
|
||||
$ret = curl_exec($crs);
|
||||
curl_close($crs);
|
||||
if (PHP_VERSION_ID < 80000) {
|
||||
curl_close($crs);
|
||||
}
|
||||
if ($ret !== false) {
|
||||
return $ret;
|
||||
}
|
||||
@@ -1985,8 +2010,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Get ULONG from string (Big Endian 32-bit unsigned integer).
|
||||
* @param $str (string) string from where to extract value
|
||||
* @param $offset (int) point from where to read the data
|
||||
* @param string $str string from where to extract value
|
||||
* @param int $offset point from where to read the data
|
||||
* @return int 32 bit value
|
||||
* @author Nicola Asuni
|
||||
* @since 5.2.000 (2010-06-02)
|
||||
@@ -1999,8 +2024,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Get USHORT from string (Big Endian 16-bit unsigned integer).
|
||||
* @param $str (string) string from where to extract value
|
||||
* @param $offset (int) point from where to read the data
|
||||
* @param string $str string from where to extract value
|
||||
* @param int $offset point from where to read the data
|
||||
* @return int 16 bit value
|
||||
* @author Nicola Asuni
|
||||
* @since 5.2.000 (2010-06-02)
|
||||
@@ -2013,8 +2038,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Get SHORT from string (Big Endian 16-bit signed integer).
|
||||
* @param $str (string) String from where to extract value.
|
||||
* @param $offset (int) Point from where to read the data.
|
||||
* @param string $str String from where to extract value.
|
||||
* @param int $offset Point from where to read the data.
|
||||
* @return int 16 bit value
|
||||
* @author Nicola Asuni
|
||||
* @since 5.2.000 (2010-06-02)
|
||||
@@ -2027,8 +2052,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Get FWORD from string (Big Endian 16-bit signed integer).
|
||||
* @param $str (string) String from where to extract value.
|
||||
* @param $offset (int) Point from where to read the data.
|
||||
* @param string $str String from where to extract value.
|
||||
* @param int $offset Point from where to read the data.
|
||||
* @return int 16 bit value
|
||||
* @author Nicola Asuni
|
||||
* @since 5.9.123 (2011-09-30)
|
||||
@@ -2044,8 +2069,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Get UFWORD from string (Big Endian 16-bit unsigned integer).
|
||||
* @param $str (string) string from where to extract value
|
||||
* @param $offset (int) point from where to read the data
|
||||
* @param string $str string from where to extract value
|
||||
* @param int $offset point from where to read the data
|
||||
* @return int 16 bit value
|
||||
* @author Nicola Asuni
|
||||
* @since 5.9.123 (2011-09-30)
|
||||
@@ -2058,8 +2083,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Get FIXED from string (32-bit signed fixed-point number (16.16).
|
||||
* @param $str (string) string from where to extract value
|
||||
* @param $offset (int) point from where to read the data
|
||||
* @param string $str string from where to extract value
|
||||
* @param int $offset point from where to read the data
|
||||
* @return int 16 bit value
|
||||
* @author Nicola Asuni
|
||||
* @since 5.9.123 (2011-09-30)
|
||||
@@ -2076,8 +2101,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Get BYTE from string (8-bit unsigned integer).
|
||||
* @param $str (string) String from where to extract value.
|
||||
* @param $offset (int) Point from where to read the data.
|
||||
* @param string $str String from where to extract value.
|
||||
* @param int $offset Point from where to read the data.
|
||||
* @return int 8 bit value
|
||||
* @author Nicola Asuni
|
||||
* @since 5.2.000 (2010-06-02)
|
||||
@@ -2090,9 +2115,9 @@ class TCPDF_STATIC {
|
||||
/**
|
||||
* Binary-safe and URL-safe file read.
|
||||
* Reads up to length bytes from the file pointer referenced by handle. Reading stops as soon as one of the following conditions is met: length bytes have been read; EOF (end of file) is reached.
|
||||
* @param $handle (resource)
|
||||
* @param $length (int)
|
||||
* @return Returns the read string or FALSE in case of error.
|
||||
* @param resource $handle
|
||||
* @param int $length
|
||||
* @return string|false Returns the read string or FALSE in case of error.
|
||||
* @author Nicola Asuni
|
||||
* @since 4.5.027 (2009-03-16)
|
||||
* @public static
|
||||
@@ -2111,8 +2136,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Read a 4-byte (32 bit) integer from file.
|
||||
* @param $f (string) file name.
|
||||
* @return 4-byte integer
|
||||
* @param resource $f file resource.
|
||||
* @return int 4-byte integer
|
||||
* @public static
|
||||
*/
|
||||
public static function _freadint($f) {
|
||||
@@ -2120,11 +2145,12 @@ class TCPDF_STATIC {
|
||||
return $a['i'];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Array of page formats
|
||||
* measures are calculated in this way: (inches * 72) or (millimeters * 72 / 25.4)
|
||||
* @public static
|
||||
*
|
||||
* @var array<string,float[]>
|
||||
*/
|
||||
public static $page_formats = array(
|
||||
// ISO 216 A Series + 2 SIS 014711 extensions
|
||||
@@ -2480,7 +2506,7 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Get page dimensions from format name.
|
||||
* @param $format (mixed) The format name @see self::$page_format<ul>
|
||||
* @param mixed $format The format name @see self::$page_format<ul>
|
||||
* @return array containing page width and height in points
|
||||
* @since 5.0.010 (2010-05-17)
|
||||
* @public static
|
||||
@@ -2494,20 +2520,20 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Set page boundaries.
|
||||
* @param $page (int) page number
|
||||
* @param $type (string) valid values are: <ul><li>'MediaBox' : the boundaries of the physical medium on which the page shall be displayed or printed;</li><li>'CropBox' : the visible region of default user space;</li><li>'BleedBox' : the region to which the contents of the page shall be clipped when output in a production environment;</li><li>'TrimBox' : the intended dimensions of the finished page after trimming;</li><li>'ArtBox' : the page's meaningful content (including potential white space).</li></ul>
|
||||
* @param $llx (float) lower-left x coordinate in user units.
|
||||
* @param $lly (float) lower-left y coordinate in user units.
|
||||
* @param $urx (float) upper-right x coordinate in user units.
|
||||
* @param $ury (float) upper-right y coordinate in user units.
|
||||
* @param $points (boolean) If true uses user units as unit of measure, otherwise uses PDF points.
|
||||
* @param $k (float) Scale factor (number of points in user unit).
|
||||
* @param $pagedim (array) Array of page dimensions.
|
||||
* @return pagedim array of page dimensions.
|
||||
* @param int $page page number
|
||||
* @param string $type valid values are: <ul><li>'MediaBox' : the boundaries of the physical medium on which the page shall be displayed or printed;</li><li>'CropBox' : the visible region of default user space;</li><li>'BleedBox' : the region to which the contents of the page shall be clipped when output in a production environment;</li><li>'TrimBox' : the intended dimensions of the finished page after trimming;</li><li>'ArtBox' : the page's meaningful content (including potential white space).</li></ul>
|
||||
* @param float $llx lower-left x coordinate in user units.
|
||||
* @param float $lly lower-left y coordinate in user units.
|
||||
* @param float $urx upper-right x coordinate in user units.
|
||||
* @param float $ury upper-right y coordinate in user units.
|
||||
* @param boolean $points If true uses user units as unit of measure, otherwise uses PDF points.
|
||||
* @param float $k Scale factor (number of points in user unit).
|
||||
* @param array $pagedim Array of page dimensions.
|
||||
* @return array pagedim array of page dimensions.
|
||||
* @since 5.0.010 (2010-05-17)
|
||||
* @public static
|
||||
*/
|
||||
public static function setPageBoxes($page, $type, $llx, $lly, $urx, $ury, $points=false, $k, $pagedim=array()) {
|
||||
public static function setPageBoxes($page, $type, $llx, $lly, $urx, $ury, $points, $k, $pagedim=array()) {
|
||||
if (!isset($pagedim[$page])) {
|
||||
// initialize array
|
||||
$pagedim[$page] = array();
|
||||
@@ -2527,9 +2553,9 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Swap X and Y coordinates of page boxes (change page boxes orientation).
|
||||
* @param $page (int) page number
|
||||
* @param $pagedim (array) Array of page dimensions.
|
||||
* @return pagedim array of page dimensions.
|
||||
* @param int $page page number
|
||||
* @param array $pagedim Array of page dimensions.
|
||||
* @return array pagedim array of page dimensions.
|
||||
* @since 5.0.010 (2010-05-17)
|
||||
* @public static
|
||||
*/
|
||||
@@ -2550,8 +2576,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Get the canonical page layout mode.
|
||||
* @param $layout (string) The page layout. Possible values are:<ul><li>SinglePage Display one page at a time</li><li>OneColumn Display the pages in one column</li><li>TwoColumnLeft Display the pages in two columns, with odd-numbered pages on the left</li><li>TwoColumnRight Display the pages in two columns, with odd-numbered pages on the right</li><li>TwoPageLeft (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the left</li><li>TwoPageRight (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the right</li></ul>
|
||||
* @return (string) Canonical page layout name.
|
||||
* @param string $layout The page layout. Possible values are:<ul><li>SinglePage Display one page at a time</li><li>OneColumn Display the pages in one column</li><li>TwoColumnLeft Display the pages in two columns, with odd-numbered pages on the left</li><li>TwoColumnRight Display the pages in two columns, with odd-numbered pages on the right</li><li>TwoPageLeft (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the left</li><li>TwoPageRight (PDF 1.5) Display the pages two at a time, with odd-numbered pages on the right</li></ul>
|
||||
* @return string Canonical page layout name.
|
||||
* @public static
|
||||
*/
|
||||
public static function getPageLayoutMode($layout='SinglePage') {
|
||||
@@ -2593,8 +2619,8 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Get the canonical page layout mode.
|
||||
* @param $mode (string) A name object specifying how the document should be displayed when opened:<ul><li>UseNone Neither document outline nor thumbnail images visible</li><li>UseOutlines Document outline visible</li><li>UseThumbs Thumbnail images visible</li><li>FullScreen Full-screen mode, with no menu bar, window controls, or any other window visible</li><li>UseOC (PDF 1.5) Optional content group panel visible</li><li>UseAttachments (PDF 1.6) Attachments panel visible</li></ul>
|
||||
* @return (string) Canonical page mode name.
|
||||
* @param string $mode A name object specifying how the document should be displayed when opened:<ul><li>UseNone Neither document outline nor thumbnail images visible</li><li>UseOutlines Document outline visible</li><li>UseThumbs Thumbnail images visible</li><li>FullScreen Full-screen mode, with no menu bar, window controls, or any other window visible</li><li>UseOC (PDF 1.5) Optional content group panel visible</li><li>UseAttachments (PDF 1.6) Attachments panel visible</li></ul>
|
||||
* @return string Canonical page mode name.
|
||||
* @public static
|
||||
*/
|
||||
public static function getPageMode($mode='UseNone') {
|
||||
@@ -2630,7 +2656,6 @@ class TCPDF_STATIC {
|
||||
return $page_mode;
|
||||
}
|
||||
|
||||
|
||||
} // END OF TCPDF_STATIC CLASS
|
||||
|
||||
//============================================================+
|
||||
|
||||
Reference in New Issue
Block a user