Merge pull request #1418 from madhuracj/update

Update TCPDF to version 6.1.0
This commit is contained in:
Marc Delisle 2014-12-10 07:39:16 -05:00
commit 7ca5600732
15 changed files with 648 additions and 454 deletions

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------
Name: TCPDF
Version: 6.0.077
Release date: 2014-05-06
Version: 6.1.0
Release date: 2014-12-07
Author: Nicola Asuni
Copyright (c) 2002-2014:
@ -107,5 +107,9 @@ Third party fonts:
The binary files (.z) that begins with the prefix "ae" have been extracted from the Arabeyes.org collection (GNU-GPLv2).
Link : http://projects.arabeyes.org/
ICC profile:
TCPDF includes the sRGB.icc profile from the icc-profiles-free Debian package:
https://packages.debian.org/source/stable/icc-profiles-free
============================================================

View File

@ -2,7 +2,7 @@
//============================================================+
// File name : tcpdf_config.php
// Begin : 2004-06-11
// Last Update : 2014-01-25
// Last Update : 2014-09-02
//
// Description : Configuration file for TCPDF.
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
@ -217,6 +217,11 @@ define('K_TCPDF_CALLS_IN_HTML', true);
*/
define('K_TCPDF_THROW_EXCEPTION_ERROR', false);
/**
* Default timezone for datetime functions
*/
define('K_TIMEZONE', 'UTC');
//============================================================+
// END OF FILE
//============================================================+

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

View File

@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf_fonts.php
// Version : 1.0.011
// Version : 1.0.014
// Begin : 2008-01-01
// Last Update : 2014-01-03
// Last Update : 2014-11-08
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
@ -42,7 +42,7 @@
* @class TCPDF_FONTS
* Font methods for TCPDF library.
* @package com.tecnick.tcpdf
* @version 1.0.011
* @version 1.0.014
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF_FONTS {
@ -435,6 +435,10 @@ class TCPDF_FONTS {
$tot_num_glyphs = floor($table['loca']['length'] / 2); // numGlyphs + 1
for ($i = 0; $i < $tot_num_glyphs; ++$i) {
$indexToLoc[$i] = TCPDF_STATIC::_getUSHORT($font, $offset) * 2;
if (isset($indexToLoc[($i - 1)]) && ($indexToLoc[$i] == $indexToLoc[($i - 1)])) {
// the last glyph didn't have an outline
unset($indexToLoc[($i - 1)]);
}
$offset += 2;
}
} else {
@ -442,6 +446,10 @@ class TCPDF_FONTS {
$tot_num_glyphs = floor($table['loca']['length'] / 4); // numGlyphs + 1
for ($i = 0; $i < $tot_num_glyphs; ++$i) {
$indexToLoc[$i] = TCPDF_STATIC::_getULONG($font, $offset);
if (isset($indexToLoc[($i - 1)]) && ($indexToLoc[$i] == $indexToLoc[($i - 1)])) {
// the last glyph didn't have an outline
unset($indexToLoc[($i - 1)]);
}
$offset += 4;
}
}
@ -792,6 +800,7 @@ class TCPDF_FONTS {
}
$fmetric['MissingWidth'] = $cw[0];
$fmetric['cw'] = '';
$fmetric['cbbox'] = '';
for ($cid = 0; $cid <= 65535; ++$cid) {
if (isset($ctg[$cid])) {
if (isset($cw[$ctg[$cid]])) {
@ -809,7 +818,7 @@ class TCPDF_FONTS {
}
} // end of true type
if (($fmetric['type'] == 'TrueTypeUnicode') AND (count($ctg) == 256)) {
$fmetric['type'] == 'TrueType';
$fmetric['type'] = 'TrueType';
}
// ---------- create php font file ----------
$pfile = '<'.'?'.'php'."\n";
@ -896,7 +905,7 @@ class TCPDF_FONTS {
$pfile .= '\'MaxWidth\'=>'.$fmetric['MaxWidth'].',';
$pfile .= '\'MissingWidth\'=>'.$fmetric['MissingWidth'].'';
$pfile .= ');'."\n";
if (isset($fmetric['cbbox'])) {
if (!empty($fmetric['cbbox'])) {
$pfile .= '$cbbox=array('.substr($fmetric['cbbox'], 1).');'."\n";
}
$pfile .= '$cw=array('.substr($fmetric['cw'], 1).');'."\n";

View File

@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf_images.php
// Version : 1.0.003
// Version : 1.0.005
// Begin : 2002-08-03
// Last Update : 2014-04-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)
// -------------------------------------------------------------------
@ -38,7 +38,7 @@
* This is a PHP class that contains static image methods for the TCPDF class.<br>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.003
* @version 1.0.005
*/
/**
@ -46,7 +46,7 @@
* Static image methods used by the TCPDF class.
* @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions.
* @version 1.0.003
* @version 1.0.005
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF_IMAGES {
@ -56,7 +56,7 @@ class TCPDF_IMAGES {
* @since 5.0.000 (2010-05-02)
* @public static
*/
public static $svginheritprop = array('clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cursor', 'direction', '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');
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');
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -97,11 +97,12 @@ class TCPDF_IMAGES {
* @public static
*/
public static function setGDImageTransparency($new_image, $image) {
// default transparency color (white)
$tcol = array('red' => 255, 'green' => 255, 'blue' => 255);
// transparency index
$tid = imagecolortransparent($image);
// default transparency color
$tcol = array('red' => 255, 'green' => 255, 'blue' => 255);
if ($tid >= 0) {
$palletsize = imagecolorstotal($image);
if (($tid >= 0) AND ($tid < $palletsize)) {
// get the colors for the transparency index
$tcol = imagecolorsforindex($image, $tid);
}
@ -115,23 +116,22 @@ 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.
* return image PNG image object.
* @since 4.9.016 (2010-04-20)
* @public static
*/
public static function _toPNG($image) {
// set temporary image file name
$tempname = TCPDF_STATIC::getObjFilename('img');
public static function _toPNG($image, $tempfile) {
// turn off interlaced mode
imageinterlace($image, 0);
// create temporary PNG image
imagepng($image, $tempname);
imagepng($image, $tempfile);
// remove image from memory
imagedestroy($image);
// get PNG image data
$retvars = self::_parsepng($tempname);
$retvars = self::_parsepng($tempfile);
// tidy up by removing temporary image
unlink($tempname);
unlink($tempfile);
return $retvars;
}
@ -140,16 +140,16 @@ class TCPDF_IMAGES {
* 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.
* @public static
*/
public static function _toJPEG($image, $quality) {
$tempname = TCPDF_STATIC::getObjFilename('img');
imagejpeg($image, $tempname, $quality);
public static function _toJPEG($image, $quality, $tempfile) {
imagejpeg($image, $tempfile, $quality);
imagedestroy($image);
$retvars = self::_parsejpeg($tempname);
$retvars = self::_parsejpeg($tempfile);
// tidy up by removing temporary image
unlink($tempname);
unlink($tempfile);
return $retvars;
}
@ -319,11 +319,9 @@ class TCPDF_IMAGES {
} elseif ($type == 'iCCP') {
// skip profile name
$len = 0;
while ((ord(fread($f, 1)) > 0) AND ($len < 80)) {
while ((ord(fread($f, 1)) != 0) AND ($len < 80)) {
++$len;
}
// skip null separator
fread($f, 1);
// get compression method
if (ord(fread($f, 1)) != 0) {
// Unknown filter method

View File

@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf_static.php
// Version : 1.0.002
// Version : 1.0.005
// Begin : 2002-08-03
// Last Update : 2014-04-25
// Last Update : 2014-12-07
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
@ -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.0.002
* @version 1.0.005
*/
/**
@ -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.0.002
* @version 1.0.005
* @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.0.077';
private static $tcpdf_version = '6.1.0';
/**
* String alias for total number of pages.
@ -1093,12 +1093,13 @@ 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.
* @return string filename.
* @since 4.5.000 (2008-12-31)
* @public static
*/
public static function getObjFilename($type='tmp') {
return tempnam(K_PATH_CACHE, '__tcpdf_'.$type.'_'.md5(getmypid().uniqid('', true).rand().microtime(true)).'_');
public static function getObjFilename($type='tmp', $file_id='') {
return tempnam(K_PATH_CACHE, '__tcpdf_'.$file_id.'_'.$type.'_'.md5(TCPDF_STATIC::getRandomSeed()).'_');
}
/**
@ -1347,41 +1348,19 @@ class TCPDF_STATIC {
* @public static
*/
public static function getRandomSeed($seed='') {
$seed .= microtime();
$rnd = uniqid(rand().microtime(true), true);
if (function_exists('posix_getpid')) {
$rnd .= posix_getpid();
}
if (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
$seed .= openssl_random_pseudo_bytes(512);
$rnd .= openssl_random_pseudo_bytes(512);
} else {
for ($i = 0; $i < 23; ++$i) {
$seed .= uniqid('', true);
$rnd .= uniqid('', true);
}
}
$seed .= uniqid('', true);
$seed .= rand();
$seed .= getmypid();
$seed .= __FILE__;
if (isset($_SERVER['REMOTE_ADDR'])) {
$seed .= $_SERVER['REMOTE_ADDR'];
}
if (isset($_SERVER['HTTP_USER_AGENT'])) {
$seed .= $_SERVER['HTTP_USER_AGENT'];
}
if (isset($_SERVER['HTTP_ACCEPT'])) {
$seed .= $_SERVER['HTTP_ACCEPT'];
}
if (isset($_SERVER['HTTP_ACCEPT_ENCODING'])) {
$seed .= $_SERVER['HTTP_ACCEPT_ENCODING'];
}
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$seed .= $_SERVER['HTTP_ACCEPT_LANGUAGE'];
}
if (isset($_SERVER['HTTP_ACCEPT_CHARSET'])) {
$seed .= $_SERVER['HTTP_ACCEPT_CHARSET'];
}
$seed .= rand();
$seed .= uniqid('', true);
$seed .= microtime();
return $seed;
return $rnd.$seed.__FILE__.serialize($_SERVER).microtime(true);
}
/**
@ -1569,7 +1548,7 @@ class TCPDF_STATIC {
$length = strlen($name);
for ($i = 0; $i < $length; ++$i) {
$chr = $name[$i];
if (preg_match('/[0-9a-zA-Z]/', $chr) == 1) {
if (preg_match('/[0-9a-zA-Z#_=-]/', $chr) == 1) {
$escname .= $chr;
} else {
$escname .= sprintf('#%02X', ord($chr));
@ -2451,13 +2430,23 @@ class TCPDF_STATIC {
/**
* Serialize an array of parameters to be used with TCPDF tag in HTML code.
* @param $pararray (array) parameters array
* @return sting containing serialized data
* @param $data (array) parameters array
* @return string containing serialized data
* @since 4.9.006 (2010-04-02)
* @public static
*/
public static function serializeTCPDFtagParameters($pararray) {
return urlencode(serialize($pararray));
public static function serializeTCPDFtagParameters($data) {
return urlencode(json_encode($data));
}
/**
* Unserialize parameters to be used with TCPDF tag in HTML code.
* @param $data (string) serialized data
* @return array containing unserialized data
* @public static
*/
public static function unserializeTCPDFtagParameters($data) {
return json_decode(urldecode($data), true);
}
/**

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
// File name : tcpdf_autoconfig.php
// Version : 1.0.000
// Begin : 2013-05-16
// Last Update : 2014-01-25
// Last Update : 2014-09-02
// Authors : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
@ -232,6 +232,10 @@ if (!defined('K_TCPDF_THROW_EXCEPTION_ERROR')) {
define('K_TCPDF_THROW_EXCEPTION_ERROR', false);
}
if (!defined('K_TIMEZONE')) {
define('K_TIMEZONE', @date_default_timezone_get());
}
//============================================================+
// END OF FILE
//============================================================+