Updated tcpdf to v6.2.17 for better compatibility with different PHP versions

SVN:trunk[5990]
This commit is contained in:
Stephen Abello
2018-07-31 13:29:18 +00:00
parent a3c6e62bd5
commit c852d91a72
11 changed files with 1105 additions and 913 deletions

View File

@@ -1,3 +1,30 @@
Unreleased
- fix Undesired mouseover effect on links in PDF on Chrome Pdf Viewer
6.2.13 (2016-06-10)
- IMPORTANT: A new version of this library is under development at https://github.com/tecnickcom/tc-lib-pdf and as a consequence this version will not receive any additional development or support. This version should be considered obsolete, new projects should use the new version as soon it will become stable.
6.2.12 (2015-09-12)
- fix composer package name to tecnickcom/tcpdf
6.2.11 (2015-08-02)
- Bug #1070 "PNG regression in 6.2.9 (they appear as their alpha channel)" was fixed.
- Bug #1069 "Encoded SRC URLs in <img> tags don't work anymore" was fixed.
6.2.10 (2015-07-28)
- Minor mod to PNG parsing.
- Make dependency on mcrypt optional.
6.2.8 (2015-04-29)
- Removed unwanted file.
6.2.7 (2015-04-28)
- Merged PR 17: Avoid warning when iterating a non-array variable.
- Merged PR 16: Improve MuliCell param definition.
- Improved column check (PR 15).
- Merged PR 11: Use stream_is_local instead of limit to file://.
- Merged PR 10: ImageMagick link on README.txt.
6.2.6 (2015-01-28)
- Bug #1008 "UTC offset sing breaks PDF/A-1b compliance" was fixed.

View File

@@ -1,40 +1,47 @@
{
"name": "tecnick.com/tcpdf",
"version": "6.2.6",
"homepage": "http://www.tcpdf.org/",
"type": "library",
"description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
"keywords": ["PDF","tcpdf","PDFD32000-2008","qrcode","datamatrix","pdf417","barcodes"],
"license": "LGPLv3",
"authors": [
{
"name": "Nicola Asuni",
"email": "info@tecnick.com",
"homepage": "http://nicolaasuni.tecnick.com"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"classmap": [
"fonts",
"config",
"include",
"tcpdf.php",
"tcpdf_parser.php",
"tcpdf_import.php",
"tcpdf_barcodes_1d.php",
"tcpdf_barcodes_2d.php",
"include/tcpdf_colors.php",
"include/tcpdf_filters.php",
"include/tcpdf_font_data.php",
"include/tcpdf_fonts.php",
"include/tcpdf_images.php",
"include/tcpdf_static.php",
"include/barcodes/datamatrix.php",
"include/barcodes/pdf417.php",
"include/barcodes/qrcode.php"
]
}
"name": "tecnickcom/tcpdf",
"version": "6.2.17",
"homepage": "http://www.tcpdf.org/",
"type": "library",
"description": "TCPDF is a PHP class for generating PDF documents and barcodes.",
"keywords": [
"PDF",
"tcpdf",
"PDFD32000-2008",
"qrcode",
"datamatrix",
"pdf417",
"barcodes"
],
"license": "LGPL-3.0",
"authors": [
{
"name": "Nicola Asuni",
"email": "info@tecnick.com",
"role": "lead"
}
],
"require": {
"php": ">=5.3.0"
},
"autoload": {
"classmap": [
"config",
"include",
"tcpdf.php",
"tcpdf_parser.php",
"tcpdf_import.php",
"tcpdf_barcodes_1d.php",
"tcpdf_barcodes_2d.php",
"include/tcpdf_colors.php",
"include/tcpdf_filters.php",
"include/tcpdf_font_data.php",
"include/tcpdf_fonts.php",
"include/tcpdf_images.php",
"include/tcpdf_static.php",
"include/barcodes/datamatrix.php",
"include/barcodes/pdf417.php",
"include/barcodes/qrcode.php"
]
}
}

View File

@@ -740,16 +740,6 @@ class PDF417 {
* @protected
*/
protected function getErrorCorrectionLevel($ecl, $numcw) {
// get maximum correction level
$maxecl = 8; // starting error level
$maxerrsize = (928 - $numcw); // available codewords for error
while ($maxecl > 0) {
$errsize = (2 << $ecl);
if ($maxerrsize >= $errsize) {
break;
}
--$maxecl;
}
// check for automatic levels
if (($ecl < 0) OR ($ecl > 8)) {
if ($numcw < 41) {
@@ -764,6 +754,16 @@ class PDF417 {
$ecl = $maxecl;
}
}
// get maximum correction level
$maxecl = 8; // starting error level
$maxerrsize = (928 - $numcw); // available codewords for error
while ($maxecl > 0) {
$errsize = (2 << $ecl);
if ($maxerrsize >= $errsize) {
break;
}
--$maxecl;
}
if ($ecl > $maxecl) {
$ecl = $maxecl;
}

View File

@@ -720,6 +720,7 @@ class QRcode {
protected function encodeMask($mask) {
$spec = array(0, 0, 0, 0, 0);
$this->datacode = $this->getByteStream($this->items);
if (is_null($this->datacode)) {
return NULL;
}

Binary file not shown.

View File

@@ -154,7 +154,7 @@ class TCPDF_FONTS {
$enc_target = TCPDF_FONT_DATA::$encmap[$enc];
$last = 0;
for ($i = 32; $i <= 255; ++$i) {
if ($enc_target != $enc_ref[$i]) {
if ($enc_target[$i] != $enc_ref[$i]) {
if ($i != ($last + 1)) {
$fmetric['diff'] .= $i.' ';
}
@@ -665,7 +665,7 @@ class TCPDF_FONTS {
$glyphIdArray[$k] = TCPDF_STATIC::_getUSHORT($font, $offset);
$offset += 2;
}
for ($k = 0; $k < $segCount; ++$k) {
for ($k = 0; $k < $segCount - 1; ++$k) {
for ($c = $startCount[$k]; $c <= $endCount[$k]; ++$c) {
if ($idRangeOffset[$k] == 0) {
$g = ($idDelta[$k] + $c) % 65536;
@@ -1490,6 +1490,171 @@ class TCPDF_FONTS {
return '/W ['.$w.' ]';
}
/**
* 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.
* @author Nicola Asuni
* @since 5.9.123 (2011-09-29)
* @public static
*/
public static function updateCIDtoGIDmap($map, $cid, $gid) {
if (($cid >= 0) AND ($cid <= 0xFFFF) AND ($gid >= 0)) {
if ($gid > 0xFFFF) {
$gid -= 0x10000;
}
$map[($cid * 2)] = chr($gid >> 8);
$map[(($cid * 2) + 1)] = chr($gid & 0xFF);
}
return $map;
}
/**
* Return fonts path
* @return string
* @public static
*/
public static function _getfontpath() {
if (!defined('K_PATH_FONTS') AND is_dir($fdir = realpath(dirname(__FILE__).'/../fonts'))) {
if (substr($fdir, -1) != '/') {
$fdir .= '/';
}
define('K_PATH_FONTS', $fdir);
}
return defined('K_PATH_FONTS') ? K_PATH_FONTS : '';
}
/**
* Return font full path
* @param $file (string) Font file name.
* @param $fontdir (string) 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
* @public static
*/
public static function getFontFullPath($file, $fontdir=false) {
$fontfile = '';
// search files on various directories
if (($fontdir !== false) AND @file_exists($fontdir.$file)) {
$fontfile = $fontdir.$file;
} elseif (@file_exists(self::_getfontpath().$file)) {
$fontfile = self::_getfontpath().$file;
} elseif (@file_exists($file)) {
$fontfile = $file;
}
return $fontfile;
}
/**
* Get a reference font size.
* @param $size (string) String containing font size value.
* @param $refsize (float) Reference font size in points.
* @return float value in points
* @public static
*/
public static function getFontRefSize($size, $refsize=12) {
switch ($size) {
case 'xx-small': {
$size = ($refsize - 4);
break;
}
case 'x-small': {
$size = ($refsize - 3);
break;
}
case 'small': {
$size = ($refsize - 2);
break;
}
case 'medium': {
$size = $refsize;
break;
}
case 'large': {
$size = ($refsize + 2);
break;
}
case 'x-large': {
$size = ($refsize + 4);
break;
}
case 'xx-large': {
$size = ($refsize + 6);
break;
}
case 'smaller': {
$size = ($refsize - 3);
break;
}
case 'larger': {
$size = ($refsize + 3);
break;
}
}
return $size;
}
// ====================================================================================================================
// REIMPLEMENTED
// ====================================================================================================================
/**
* Returns the unicode caracter specified by the value
* @param $c (int) UTF-8 value
@@ -1663,64 +1828,6 @@ class TCPDF_FONTS {
return $string;
}
/**
* 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.
* @author Nicola Asuni
* @since 5.9.123 (2011-09-29)
* @public static
*/
public static function updateCIDtoGIDmap($map, $cid, $gid) {
if (($cid >= 0) AND ($cid <= 0xFFFF) AND ($gid >= 0)) {
if ($gid > 0xFFFF) {
$gid -= 0x10000;
}
$map[($cid * 2)] = chr($gid >> 8);
$map[(($cid * 2) + 1)] = chr($gid & 0xFF);
}
return $map;
}
/**
* Return fonts path
* @return string
* @public static
*/
public static function _getfontpath() {
if (!defined('K_PATH_FONTS') AND is_dir($fdir = realpath(dirname(__FILE__).'/../fonts'))) {
if (substr($fdir, -1) != '/') {
$fdir .= '/';
}
define('K_PATH_FONTS', $fdir);
}
return defined('K_PATH_FONTS') ? K_PATH_FONTS : '';
}
/**
* Return font full path
* @param $file (string) Font file name.
* @param $fontdir (string) 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
* @public static
*/
public static function getFontFullPath($file, $fontdir=false) {
$fontfile = '';
// search files on various directories
if (($fontdir !== false) AND @file_exists($fontdir.$file)) {
$fontfile = $fontdir.$file;
} elseif (@file_exists(self::_getfontpath().$file)) {
$fontfile = self::_getfontpath().$file;
} elseif (@file_exists($file)) {
$fontfile = $file;
}
return $fontfile;
}
/**
* Converts UTF-8 characters array to array of Latin1 characters array<br>
* @param $unicode (array) array containing UTF-8 unicode values
@@ -2535,55 +2642,6 @@ class TCPDF_FONTS {
return $ordarray;
}
/**
* Get a reference font size.
* @param $size (string) String containing font size value.
* @param $refsize (float) Reference font size in points.
* @return float value in points
* @public static
*/
public static function getFontRefSize($size, $refsize=12) {
switch ($size) {
case 'xx-small': {
$size = ($refsize - 4);
break;
}
case 'x-small': {
$size = ($refsize - 3);
break;
}
case 'small': {
$size = ($refsize - 2);
break;
}
case 'medium': {
$size = $refsize;
break;
}
case 'large': {
$size = ($refsize + 2);
break;
}
case 'x-large': {
$size = ($refsize + 4);
break;
}
case 'xx-large': {
$size = ($refsize + 6);
break;
}
case 'smaller': {
$size = ($refsize - 3);
break;
}
case 'larger': {
$size = ($refsize + 3);
break;
}
}
return $size;
}
} // END OF TCPDF_FONTS CLASS
//============================================================+

View File

@@ -160,6 +160,14 @@ class TCPDF_IMAGES {
* @public static
*/
public static function _parsejpeg($file) {
// check if is a local file
if (!@file_exists($file)) {
// try to encode spaces on filename
$tfile = str_replace(' ', '%20', $file);
if (@file_exists($tfile)) {
$file = $tfile;
}
}
$a = getimagesize($file);
if (empty($a)) {
//Missing or incorrect image file
@@ -289,8 +297,8 @@ class TCPDF_IMAGES {
$trns = '';
$data = '';
$icc = false;
$n = TCPDF_STATIC::_freadint($f);
do {
$n = TCPDF_STATIC::_freadint($f);
$type = fread($f, 4);
if ($type == 'PLTE') {
// read palette
@@ -338,6 +346,7 @@ class TCPDF_IMAGES {
} else {
TCPDF_STATIC::rfread($f, $n + 4);
}
$n = TCPDF_STATIC::_freadint($f);
} while ($n);
if (($colspace == 'Indexed') AND (empty($pal))) {
// Missing palette

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf.php
// Version : 6.2.6
// Version : 6.2.13
// Begin : 2002-08-03
// Last Update : 2015-01-28
// Last Update : 2015-06-18
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
@@ -104,7 +104,7 @@
* Tools to encode your unicode fonts are on fonts/utils directory.</p>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 6.2.6
* @version 6.2.8
*/
// TCPDF configuration
@@ -128,7 +128,7 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.php');
* TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.<br>
* @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions.
* @version 6.2.6
* @version 6.2.8
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF {
@@ -1822,9 +1822,9 @@ class TCPDF {
/**
* This is the class constructor.
* It allows to set up the page format, the orientation and the measure unit used in all the methods (except for the font sizes).
*
*
* IMPORTANT: Please note that this method sets the mb_internal_encoding to ASCII, so if you are using the mbstring module functions with TCPDF you need to correctly set/unset the mb_internal_encoding when needed.
*
*
* @param $orientation (string) page orientation. Possible values are (case insensitive):<ul><li>P or Portrait (default)</li><li>L or Landscape</li><li>'' (empty string) for automatic orientation</li></ul>
* @param $unit (string) User measure unit. Possible values are:<ul><li>pt: point</li><li>mm: millimeter (default)</li><li>cm: centimeter</li><li>in: inch</li></ul><br />A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit.
* @param $format (mixed) The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat().
@@ -4691,7 +4691,7 @@ class TCPDF {
* Defines the page and position a link points to.
* @param $link (int) The link identifier returned by AddLink()
* @param $y (float) Ordinate of target position; -1 indicates the current position. The default value is 0 (top of page)
* @param $page (int) Number of target page; -1 indicates the current page (default value). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages.
* @param $page (int) Number of target page; -1 indicates the current page (default value). If you prefix a page number with the * character, then this page will not be changed when adding/deleting/moving pages.
* @public
* @since 1.5
* @see AddLink()
@@ -5748,7 +5748,7 @@ class TCPDF {
* @param $autopadding (boolean) if true, uses internal padding and automatically adjust it to account for line width.
* @param $maxh (float) maximum height. It should be >= $h and less then remaining space to the bottom of the page, or 0 for disable this feature. This feature works only when $ishtml=false.
* @param $valign (string) Vertical alignment of text (requires $maxh = $h > 0). Possible values are:<ul><li>T: TOP</li><li>M: middle</li><li>B: bottom</li></ul>. This feature works only when $ishtml=false and the cell must fit in a single page.
* @param $fitcell (boolean) if true attempt to fit all the text within the cell by reducing the font size (do not work in HTML mode). $maxh must be greater than 0 and wqual to $h.
* @param $fitcell (boolean) if true attempt to fit all the text within the cell by reducing the font size (do not work in HTML mode). $maxh must be greater than 0 and equal to $h.
* @return int Return the number of cells or 1 for html mode.
* @public
* @since 1.3
@@ -5944,7 +5944,9 @@ class TCPDF {
if ($startpage == $endpage) {
// single page
for ($column = $startcolumn; $column <= $endcolumn; ++$column) { // for each column
$this->selectColumn($column);
if ($column != $this->current_column) {
$this->selectColumn($column);
}
if ($this->rtl) {
$this->x -= $mc_margin['R'];
} else {
@@ -5973,7 +5975,9 @@ class TCPDF {
} // end for each column
} elseif ($page == $startpage) { // first page
for ($column = $startcolumn; $column < $this->num_columns; ++$column) { // for each column
$this->selectColumn($column);
if ($column != $this->current_column) {
$this->selectColumn($column);
}
if ($this->rtl) {
$this->x -= $mc_margin['R'];
} else {
@@ -5992,7 +5996,9 @@ class TCPDF {
} // end for each column
} elseif ($page == $endpage) { // last page
for ($column = 0; $column <= $endcolumn; ++$column) { // for each column
$this->selectColumn($column);
if ($column != $this->current_column) {
$this->selectColumn($column);
}
if ($this->rtl) {
$this->x -= $mc_margin['R'];
} else {
@@ -8151,7 +8157,9 @@ class TCPDF {
$annots .= ' /FT /'.$pl['opt']['ft'];
$formfield = true;
}
$annots .= ' /Contents '.$this->_textstring($pl['txt'], $annot_obj_id);
if ($pl['opt']['subtype'] !== 'Link') {
$annots .= ' /Contents '.$this->_textstring($pl['txt'], $annot_obj_id);
}
$annots .= ' /P '.$this->page_obj_id[$n].' 0 R';
$annots .= ' /NM '.$this->_datastring(sprintf('%04u-%04u', $n, $key), $annot_obj_id);
$annots .= ' /M '.$this->_datestring($annot_obj_id, $this->doc_modification_timestamp);
@@ -8358,7 +8366,7 @@ class TCPDF {
break;
}
case 'link': {
if (is_string($pl['txt'])) {
if (is_string($pl['txt']) && !empty($pl['txt'])) {
if ($pl['txt'][0] == '#') {
// internal destination
$annots .= ' /Dest /'.TCPDF_STATIC::encodeNameObject(substr($pl['txt'], 1));
@@ -9798,7 +9806,7 @@ class TCPDF {
//$out .= ' /XFA ';
$out .= ' >>';
// signatures
if ($this->sign AND isset($this->signature_data['cert_type'])
if ($this->sign AND isset($this->signature_data['cert_type'])
AND (empty($this->signature_data['approval']) OR ($this->signature_data['approval'] != 'A'))) {
if ($this->signature_data['cert_type'] > 0) {
$out .= ' /Perms << /DocMDP '.($this->sig_obj_id + 1).' 0 R >>';
@@ -10362,7 +10370,7 @@ class TCPDF {
* @public
*/
public function addHtmlLink($url, $name, $fill=false, $firstline=false, $color='', $style=-1, $firstblock=false) {
if (isset($url[1]) AND ($url[0] == '#')) {
if (isset($url[1]) AND ($url[0] == '#') AND is_numeric($url[1])) {
// convert url to internal link
$lnkdata = explode(',', $url);
if (isset($lnkdata[0]) ) {
@@ -10632,8 +10640,7 @@ class TCPDF {
*/
protected function _UEvalue() {
$hashkey = hash('sha256', $this->encryptdata['user_password'].$this->encryptdata['UKS'], true);
$iv = str_repeat("\x00", mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC));
return mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $hashkey, $this->encryptdata['key'], MCRYPT_MODE_CBC, $iv);
return TCPDF_STATIC::_AESnopad($hashkey, $this->encryptdata['key']);
}
/**
@@ -10683,8 +10690,7 @@ class TCPDF {
*/
protected function _OEvalue() {
$hashkey = hash('sha256', $this->encryptdata['owner_password'].$this->encryptdata['OKS'].$this->encryptdata['U'], true);
$iv = str_repeat("\x00", mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC));
return mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $hashkey, $this->encryptdata['key'], MCRYPT_MODE_CBC, $iv);
return TCPDF_STATIC::_AESnopad($hashkey, $this->encryptdata['key']);
}
/**
@@ -10739,8 +10745,7 @@ class TCPDF {
}
$perms .= 'adb'; // bytes 9-11
$perms .= 'nick'; // bytes 12-15
$iv = str_repeat("\x00", mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB));
$this->encryptdata['perms'] = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $this->encryptdata['key'], $perms, MCRYPT_MODE_ECB, $iv);
$this->encryptdata['perms'] = TCPDF_STATIC::_AESnopad($this->encryptdata['key'], $perms);
} else { // RC4-40, RC4-128, AES-128
// Pad passwords
$this->encryptdata['user_password'] = substr($this->encryptdata['user_password'].TCPDF_STATIC::$enc_padding, 0, 32);
@@ -10858,10 +10863,13 @@ class TCPDF {
$this->encryptdata['StrF'] = 'StdCF';
}
if ($mode > 1) { // AES
if (!extension_loaded('mcrypt')) {
$this->Error('AES encryption requires mcrypt library (http://www.php.net/manual/en/mcrypt.requirements.php).');
if (!extension_loaded('openssl') && !extension_loaded('mcrypt')) {
$this->Error('AES encryption requires openssl or mcrypt extension (http://www.php.net/manual/en/mcrypt.requirements.php).');
}
if (mcrypt_get_cipher_name(MCRYPT_RIJNDAEL_128) === false) {
if (extension_loaded('openssl') && !in_array('aes-256-cbc', openssl_get_cipher_methods())) {
$this->Error('AES encryption requires openssl/aes-256-cbc cypher.');
}
if (extension_loaded('mcrypt') && mcrypt_get_cipher_name(MCRYPT_RIJNDAEL_128) === false) {
$this->Error('AES encryption requires MCRYPT_RIJNDAEL_128 cypher.');
}
if (($mode == 3) AND !function_exists('hash')) {
@@ -12576,7 +12584,7 @@ class TCPDF {
$k = $this->k;
$this->javascript .= sprintf("f".$name."=this.addField('%s','%s',%u,[%F,%F,%F,%F]);", $name, $type, $this->PageNo()-1, $x*$k, ($this->h-$y)*$k+1, ($x+$w)*$k, ($this->h-$y-$h)*$k+1)."\n";
$this->javascript .= 'f'.$name.'.textSize='.$this->FontSizePt.";\n";
while (list($key, $val) = each($prop)) {
foreach($prop as $key => $val) {
if (strcmp(substr($key, -5), 'Color') == 0) {
$val = TCPDF_COLORS::_JScolor($val);
} else {
@@ -15184,7 +15192,7 @@ class TCPDF {
* @since 3.1.000 (2008-06-09)
* @public
*/
public function write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style='', $align='') {
public function write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style=array(), $align='') {
if (TCPDF_STATIC::empty_string(trim($code))) {
return;
}
@@ -15503,7 +15511,7 @@ class TCPDF {
* @since 4.5.037 (2009-04-07)
* @public
*/
public function write2DBarcode($code, $type, $x='', $y='', $w='', $h='', $style='', $align='', $distort=false) {
public function write2DBarcode($code, $type, $x='', $y='', $w='', $h='', $style=array(), $align='', $distort=false) {
if (TCPDF_STATIC::empty_string(trim($code))) {
return;
}
@@ -16539,9 +16547,9 @@ class TCPDF {
// get attributes
preg_match_all('/([^=\s]*)[\s]*=[\s]*"([^"]*)"/', $element, $attr_array, PREG_PATTERN_ORDER);
$dom[$key]['attribute'] = array(); // reset attribute array
while (list($id, $name) = each($attr_array[1])) {
$dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id];
}
foreach($attr_array[1] as $id => $name) {
$dom[$key]['attribute'][strtolower($name)] = $attr_array[2][$id];
}
if (!empty($css)) {
// merge CSS style to current style
list($dom[$key]['csssel'], $dom[$key]['cssdata']) = TCPDF_STATIC::getCSSdataArray($dom, $key, $css);
@@ -16552,10 +16560,10 @@ class TCPDF {
// get style attributes
preg_match_all('/([^;:\s]*):([^;]*)/', $dom[$key]['attribute']['style'], $style_array, PREG_PATTERN_ORDER);
$dom[$key]['style'] = array(); // reset style attribute array
while (list($id, $name) = each($style_array[1])) {
// in case of duplicate attribute the last replace the previous
$dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]);
}
foreach($style_array[1] as $id => $name) {
// in case of duplicate attribute the last replace the previous
$dom[$key]['style'][strtolower($name)] = trim($style_array[2][$id]);
}
// --- get some style attributes ---
// text direction
if (isset($dom[$key]['style']['direction'])) {
@@ -17170,10 +17178,10 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
if ($cell) {
if ($this->rtl) {
$this->x -= $this->cell_padding['R'];
$this->lMargin += $this->cell_padding['R'];
$this->lMargin += $this->cell_padding['L'];
} else {
$this->x += $this->cell_padding['L'];
$this->rMargin += $this->cell_padding['L'];
$this->rMargin += $this->cell_padding['R'];
}
}
if ($this->customlistindent >= 0) {
@@ -17723,7 +17731,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$spacew = ($spacewidth * $ns);
}
$offset = $strpiece[2][1] + strlen($strpiece[2][0]);
$epsposend = strpos($pmid, $this->epsmarker.'Q', $offset);
$epsposend = strpos($pmid, $this->epsmarker.'Q', $offset);
if ($epsposend !== null) {
$epsposend += strlen($this->epsmarker.'Q');
$epsposbeg = strpos($pmid, 'q'.$this->epsmarker, $offset);
@@ -18649,7 +18657,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$this->lispacer = $prev_lispacer;
if ($ln AND (!($cell AND ($dom[$key-1]['value'] == 'table')))) {
$this->Ln($this->lasth);
if ($this->y < $maxbottomliney) {
if (($this->y < $maxbottomliney) AND ($startlinepage == $this->page)) {
$this->y = $maxbottomliney;
}
}
@@ -19427,8 +19435,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$prev_page = $this->page;
$this->setPage($dom[($dom[$key]['parent'])]['endpage']);
if ($this->num_columns > 1) {
if ((($this->current_column == 0) AND ($dom[($dom[$key]['parent'])]['endcolumn'] == ($this->num_columns - 1)))
OR (($this->current_column == $dom[($dom[$key]['parent'])]['endcolumn']) AND ($prev_page < $this->page))) {
if (($prev_page < $this->page)
AND ((($this->current_column == 0) AND ($dom[($dom[$key]['parent'])]['endcolumn'] == ($this->num_columns - 1)))
OR ($this->current_column == $dom[($dom[$key]['parent'])]['endcolumn']))) {
// page jump
$this->selectColumn(0);
$dom[($dom[$key]['parent'])]['endcolumn'] = 0;
@@ -19748,7 +19757,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
break;
}
case 'a': {
$this->HREF = '';
$this->HREF = array();
break;
}
case 'sup': {
@@ -21504,7 +21513,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
} else {
// placemark to be replaced with the correct number
$pagenum = '{#'.($outline['p']).'}';
if ($templates['F'.$outline['l']]) {
if (isset($templates['F'.$outline['l']]) && $templates['F'.$outline['l']]) {
$pagenum = '{'.$pagenum.'}';
}
$maxpage = max($maxpage, $outline['p']);
@@ -23680,7 +23689,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
}
return $name;
}
/**
* Sets the opening SVG element handler function for the XML parser. (*** TO BE COMPLETED ***)
* @param $parser (resource) The first parameter, parser, is a reference to the XML parser calling the handler.

View File

@@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf_parser.php
// Version : 1.0.15
// Version : 1.0.16
// Begin : 2011-05-23
// Last Update : 2015-01-24
// Last Update : 2015-04-28
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3
// -------------------------------------------------------------------
@@ -297,6 +297,9 @@ class TCPDF_PARSER {
$valid_crs = false;
$columns = 0;
$sarr = $xrefcrs[0][1];
if (!is_array($sarr)) {
$sarr = array();
}
foreach ($sarr as $k => $v) {
if (($v[0] == '/') AND ($v[1] == 'Type') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == '/') AND ($sarr[($k +1)][1] == 'XRef'))) {
$valid_crs = true;

View File

@@ -1,4 +1,4 @@
#!/usr/bin/php -q
#!/usr/bin/env php
<?php
//============================================================+
// File name : tcpdf_addfont.php