mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-44521 import TCPDF 6.0.062
This commit is contained in:
parent
c0e88129d1
commit
fc9cedb321
@ -73,7 +73,7 @@ define('K_PATH_CACHE', $CFG->cachedir . '/tcpdf/');
|
||||
define('K_PATH_IMAGES', $CFG->dirroot . '/');
|
||||
|
||||
/** blank image */
|
||||
define('K_BLANK_IMAGE', K_PATH_IMAGES . '/pix/spacer.gif');
|
||||
define('K_BLANK_IMAGE', K_PATH_IMAGES . 'pix/spacer.gif');
|
||||
|
||||
/** height of cell repect font height */
|
||||
define('K_CELL_HEIGHT_RATIO', 1.25);
|
||||
|
@ -1,3 +1,112 @@
|
||||
6.0.062 (2014-03-02)
|
||||
- The method startLayer() now accepts the NULL value for the $print parameter to not set the print layer option.
|
||||
|
||||
6.0.061 (2014-02-18)
|
||||
- Bug #893 "Parsing error on streamed xref for secured pdf" was fixed.
|
||||
|
||||
6.0.060 (2014-02-16)
|
||||
- Bug #891 "Error on parsing hexa fields" was fixed.
|
||||
- Bug #892 "Parsing pdf with trailing space at start" was fixed.
|
||||
|
||||
6.0.059 (2014-02-03)
|
||||
- SVG 'use' support was imporved.
|
||||
|
||||
6.0.058 (2014-01-31)
|
||||
- Bug #886 "Bugs with SVG using <defs> and <use>" was fixed.
|
||||
|
||||
6.0.057 (2014-01-26)
|
||||
- Bug #883 "Parsing error" was fixed.
|
||||
|
||||
6.0.056 (2014-01-25)
|
||||
- The automatic cache folder selection now works also with some restricted hosting environments.
|
||||
- CSS text-transform property is now supported (requires the multibyte string library for php) - see examle n. 061 (Thanks to Walter Ferraz).
|
||||
- Bug #884 "Parsing error prev tag looking for" was fixed.
|
||||
|
||||
6.0.055 (2014-01-15)
|
||||
- Bug #880 "Error detecting hX tags (h1,h2..)" was fixed
|
||||
- Bug #879 "Thead on the second page inherits style of previous tr" was fixed
|
||||
|
||||
6.0.054 (2014-01-13)
|
||||
- Bug #877 "Parenteses causing corrupt text" was fixed.
|
||||
|
||||
6.0.053 (2014-01-03)
|
||||
- Bug #876 "Cell padding should not be multiplied with number of lines in getStringHeight" was fixed.
|
||||
- Patch #68 "Empty img src attribute leads to access of uninitialized string offset" was applied.
|
||||
|
||||
6.0.052 (2013-12-12)
|
||||
- Bug #871 "Datamatrix coding" was fixed.
|
||||
|
||||
6.0.051 (2013-12-02)
|
||||
- cbbox array values in addTTFfont() were converted to integers.
|
||||
|
||||
6.0.050 (2013-12-01)
|
||||
- The method getNumLines() was extended to support hyphenation.
|
||||
- The CSS property line-height now supports non percentage values.
|
||||
|
||||
6.0.050 (2013-11-27)
|
||||
- A bug related to PNG images was fixed.
|
||||
|
||||
6.0.048 (2013-11-24)
|
||||
- SVG vars are now reset in ImageSVG() method.
|
||||
|
||||
6.0.047 (2013-11-19)
|
||||
- SVG support was extended to support some nested defs.
|
||||
|
||||
6.0.046 (2013-11-17)
|
||||
- preg_replace_callback functions were replaced to improve memory performances.
|
||||
|
||||
6.0.045 (2013-11-17)
|
||||
- Bug #862 "Parsing error on flate filter" was fixed.
|
||||
|
||||
6.0.044 (2013-11-10)
|
||||
- Bug #857 "Undefined offset error" was fixed.
|
||||
- The uniord method now uses a static cache to improve performances (thanks to Mathieu Masseboeuf for the sugegstion).
|
||||
- Two bugs in the TCPDF_FONTS class were fixed.
|
||||
|
||||
6.0.043 (2013-10-29)
|
||||
- Bug #854 "CSS instruction display" was fixed.
|
||||
|
||||
6.0.042 (2013-10-25)
|
||||
- Bug #852 "CMYK Colors Bug" was fixed.
|
||||
|
||||
6.0.041 (2013-10-21)
|
||||
- Bug #851 "Problem with images in PDF. PHP timing out" was fixed.
|
||||
|
||||
6.0.040 (2013-10-20)
|
||||
- Bug #849 "SVG import bug" was fixed.
|
||||
|
||||
6.0.039 (2013-10-13)
|
||||
- Bug #843 "Wrong call in parser" was fixed.
|
||||
- Bug #844 "Wrong object type named" was fixed.
|
||||
- Bug #845 "Parsing error on obj ref prefixed by '000000'" was fixed.
|
||||
|
||||
6.0.038 (2013-10-06)
|
||||
- Bug #841 "Division by zero warning at writeHTML a <li> tag" was fixed.
|
||||
|
||||
6.0.037 (2013-09-30)
|
||||
- Method getAllSpotColors() was added to return all spot colors.
|
||||
- Method colorRegistrationBar() was extended to automatically print all spot colors and support individual spot colors.
|
||||
- The method registrationMarkCMYK() was added to print a registration mark for CMYK colors.
|
||||
- A bug related to page groups was fixed.
|
||||
- Gradient() method now supports CMYK equivalents of spot colors.
|
||||
- Example n. 56 was updated.
|
||||
|
||||
6.0.036 (2013-09-29)
|
||||
- Methods for registration bars and crop marks were extended to support registration color (see example n. 56).
|
||||
- New default spot colors were added to tcpdf_colors.php, including the 'All' and 'None' special registration colors.
|
||||
|
||||
6.0.035 (2013-09-25)
|
||||
- TCPDF_PARSER class was improved.
|
||||
|
||||
6.0.034 (2013-09-24)
|
||||
- Bug #839 "Error in xref parsing in mixed newline chars" was fixed.
|
||||
|
||||
6.0.033 (2013-09-23)
|
||||
- Bug fix related to PNG image transparency using GD library.
|
||||
|
||||
6.0.032 (2013-09-23)
|
||||
- Bug #838 "Fatal error when imagick cannot handle the image, even though GD is available and can" was fixed.
|
||||
|
||||
6.0.031 (2013-09-18)
|
||||
- Bug #836 "Optional EOL marker before endstream" was fixed.
|
||||
- Some additional controls were added to avoid "division by zero" error with badly formatted input.
|
||||
|
@ -8,11 +8,11 @@ http://sourceforge.net/donate/index.php?group_id=128076
|
||||
------------------------------------------------------------
|
||||
|
||||
Name: TCPDF
|
||||
Version: 6.0.031
|
||||
Release date: 2013-09-18
|
||||
Version: 6.0.062
|
||||
Release date: 2014-03-02
|
||||
Author: Nicola Asuni
|
||||
|
||||
Copyright (c) 2002-2013:
|
||||
Copyright (c) 2002-2014:
|
||||
Nicola Asuni
|
||||
Tecnick.com LTD
|
||||
www.tecnick.com
|
||||
@ -67,7 +67,7 @@ Additional Documentation:
|
||||
http://www.tcpdf.org
|
||||
|
||||
License:
|
||||
Copyright (C) 2002-2013 Nicola Asuni - Tecnick.com LTD
|
||||
Copyright (C) 2002-2014 Nicola Asuni - Tecnick.com LTD
|
||||
|
||||
TCPDF is free software: you can redistribute it and/or modify it
|
||||
under the terms of the GNU Lesser General Public License as
|
||||
@ -107,4 +107,5 @@ 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/
|
||||
|
||||
|
||||
============================================================
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tecnick.com/tcpdf",
|
||||
"version": "6.0.031",
|
||||
"version": "6.0.062",
|
||||
"homepage": "http://www.tcpdf.org/",
|
||||
"type": "library",
|
||||
"description": "TCPDF is a PHP class for generating PDF documents.",
|
||||
@ -23,7 +23,6 @@
|
||||
"include",
|
||||
"tcpdf.php",
|
||||
"tcpdf_parser.php",
|
||||
"tcpdf_import.php",
|
||||
"tcpdf_barcodes_1d.php",
|
||||
"tcpdf_barcodes_2d.php",
|
||||
"include/tcpdf_colors.php",
|
||||
|
@ -2,13 +2,13 @@
|
||||
//============================================================+
|
||||
// File name : tcpdf_config.php
|
||||
// Begin : 2004-06-11
|
||||
// Last Update : 2013-05-16
|
||||
// Last Update : 2014-01-25
|
||||
//
|
||||
// Description : Configuration file for TCPDF.
|
||||
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
|
||||
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
// Copyright (C) 2004-2013 Nicola Asuni - Tecnick.com LTD
|
||||
// Copyright (C) 2004-2014 Nicola Asuni - Tecnick.com LTD
|
||||
//
|
||||
// This file is part of TCPDF software library.
|
||||
//
|
||||
@ -36,7 +36,10 @@
|
||||
* @since 2004-10-27
|
||||
*/
|
||||
|
||||
// If you define the constant K_TCPDF_EXTERNAL_CONFIG, the following settings will be ignored.
|
||||
// IMPORTANT:
|
||||
// If you define the constant K_TCPDF_EXTERNAL_CONFIG, all the following settings will be ignored.
|
||||
// If you use the tcpdf_autoconfig.php, then you can overwrite some values here.
|
||||
|
||||
|
||||
/**
|
||||
* Installation path (/var/www/tcpdf/).
|
||||
@ -76,7 +79,7 @@
|
||||
/**
|
||||
* Cache directory for temporary files (full path).
|
||||
*/
|
||||
define ('K_PATH_CACHE', sys_get_temp_dir().'/');
|
||||
//define ('K_PATH_CACHE', '/tmp/');
|
||||
|
||||
/**
|
||||
* Generic name for a blank image.
|
||||
@ -210,7 +213,7 @@ define('K_THAI_TOPCHARS', true);
|
||||
define('K_TCPDF_CALLS_IN_HTML', true);
|
||||
|
||||
/**
|
||||
* If true adn PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution.
|
||||
* If true and PHP version is greater than 5, then the Error() method throw new exception instead of terminating the execution.
|
||||
*/
|
||||
define('K_TCPDF_THROW_EXCEPTION_ERROR', false);
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
// File name : datamatrix.php
|
||||
// Version : 1.0.004
|
||||
// Begin : 2010-06-07
|
||||
// Last Update : 2013-02-04
|
||||
// Last Update : 2013-12-12
|
||||
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
|
||||
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
@ -860,6 +860,10 @@ class Datamatrix {
|
||||
++$field_lenght;
|
||||
}
|
||||
if (($field_lenght == 4) OR ($epos == $data_lenght) OR !$this->isCharMode($chr, ENC_EDF)) {
|
||||
if (($epos == $data_lenght) AND ($field_lenght < 3)) {
|
||||
$enc = ENC_ASCII;
|
||||
break;
|
||||
}
|
||||
if ($field_lenght < 4) {
|
||||
// set unlatch character
|
||||
$temp_cw[] = 0x1f;
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf_colors.php
|
||||
// Version : 1.0.000
|
||||
// Version : 1.0.003
|
||||
// Begin : 2002-04-09
|
||||
// Last Update : 2013-03-25
|
||||
// Last Update : 2013-10-25
|
||||
// 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_COLORS
|
||||
* PHP color class for TCPDF
|
||||
* @package com.tecnick.tcpdf
|
||||
* @version 1.0.000
|
||||
* @version 1.0.003
|
||||
* @author Nicola Asuni - info@tecnick.com
|
||||
*/
|
||||
class TCPDF_COLORS {
|
||||
@ -217,12 +217,22 @@ class TCPDF_COLORS {
|
||||
* @public static
|
||||
*/
|
||||
public static $spotcolor = array (
|
||||
// the following are just examples, fill the array with your own values
|
||||
'mytcpdfblack' => array(0, 0, 0, 100, 'My TCPDF Black'),
|
||||
'mytcpdfred' => array(30, 100, 90, 10, 'My TCPDF Red'),
|
||||
'mytcpdfgreen' => array(100, 30, 100, 0, 'My TCPDF Green'),
|
||||
'mytcpdfblue' => array(100, 60, 10, 5, 'My TCPDF Blue'),
|
||||
'mytcpdfyellow' => array(0, 20, 100, 0, 'My TCPDF Yellow'),
|
||||
// special registration colors
|
||||
'none' => array( 0, 0, 0, 0, 'None'),
|
||||
'all' => array(100, 100, 100, 100, 'All'),
|
||||
// standard CMYK colors
|
||||
'cyan' => array(100, 0, 0, 0, 'Cyan'),
|
||||
'magenta' => array( 0, 100, 0, 0, 'Magenta'),
|
||||
'yellow' => array( 0, 0, 100, 0, 'Yellow'),
|
||||
'key' => array( 0, 0, 0, 100, 'Key'),
|
||||
// alias
|
||||
'white' => array( 0, 0, 0, 0, 'White'),
|
||||
'black' => array( 0, 0, 0, 100, 'Black'),
|
||||
// standard RGB colors
|
||||
'red' => array( 0, 100, 100, 0, 'Red'),
|
||||
'green' => array(100, 0, 100, 0, 'Green'),
|
||||
'blue' => array(100, 100, 0, 0, 'Blue'),
|
||||
// Add here standard spot colors or dynamically define them with AddSpotColor()
|
||||
// ...
|
||||
); // end of spot colors
|
||||
|
||||
@ -296,7 +306,7 @@ class TCPDF_COLORS {
|
||||
}
|
||||
return $returncolor;
|
||||
}
|
||||
} elseif (($dotpos = strpos($color, '.')) !== false) {
|
||||
} elseif ((substr($color, 0, 4) != 'cmyk') AND ($dotpos = strpos($color, '.')) !== false) {
|
||||
// remove class parent (i.e.: color.red)
|
||||
$color = substr($color, ($dotpos + 1));
|
||||
if ($color == 'transparent') {
|
||||
|
@ -1,13 +1,13 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf_fonts.php
|
||||
// Version : 1.0.009
|
||||
// Version : 1.0.011
|
||||
// Begin : 2008-01-01
|
||||
// Last Update : 2013-09-04
|
||||
// Last Update : 2014-01-03
|
||||
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
|
||||
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
// Copyright (C) 2008-2013 Nicola Asuni - Tecnick.com LTD
|
||||
// Copyright (C) 2008-2014 Nicola Asuni - Tecnick.com LTD
|
||||
//
|
||||
// This file is part of TCPDF software library.
|
||||
//
|
||||
@ -42,11 +42,17 @@
|
||||
* @class TCPDF_FONTS
|
||||
* Font methods for TCPDF library.
|
||||
* @package com.tecnick.tcpdf
|
||||
* @version 1.0.009
|
||||
* @version 1.0.011
|
||||
* @author Nicola Asuni - info@tecnick.com
|
||||
*/
|
||||
class TCPDF_FONTS {
|
||||
|
||||
/**
|
||||
* Static cache used for speed up uniord performances
|
||||
* @protected
|
||||
*/
|
||||
protected static $cache_uniord = array();
|
||||
|
||||
/**
|
||||
* Convert and add the selected TrueType or Type1 font to the fonts folder (that must be writeable).
|
||||
* @param $fontfile (string) Font file (full path).
|
||||
@ -607,7 +613,7 @@ class TCPDF_FONTS {
|
||||
// combine high and low bytes
|
||||
$c = (($i << 8) + $j);
|
||||
$idRangeOffset = ($subHeaders[$k]['idRangeOffset'] + $j - $subHeaders[$k]['firstCode']);
|
||||
$g = ($glyphIndexArray[$idRangeOffset] + $idDelta[$k]) % 65536;
|
||||
$g = ($glyphIndexArray[$idRangeOffset] + $subHeaders[$k]['idDelta']) % 65536;
|
||||
if ($g < 0) {
|
||||
$g = 0;
|
||||
}
|
||||
@ -793,10 +799,10 @@ class TCPDF_FONTS {
|
||||
}
|
||||
if ($addcbbox AND isset($indexToLoc[$ctg[$cid]])) {
|
||||
$offset = ($table['glyf']['offset'] + $indexToLoc[$ctg[$cid]]);
|
||||
$xMin = round(TCPDF_STATIC::_getFWORD($font, $offset + 2)) * $urk;
|
||||
$yMin = round(TCPDF_STATIC::_getFWORD($font, $offset + 4)) * $urk;
|
||||
$xMax = round(TCPDF_STATIC::_getFWORD($font, $offset + 6)) * $urk;
|
||||
$yMax = round(TCPDF_STATIC::_getFWORD($font, $offset + 8)) * $urk;
|
||||
$xMin = round(TCPDF_STATIC::_getFWORD($font, $offset + 2) * $urk);
|
||||
$yMin = round(TCPDF_STATIC::_getFWORD($font, $offset + 4) * $urk);
|
||||
$xMax = round(TCPDF_STATIC::_getFWORD($font, $offset + 6) * $urk);
|
||||
$yMax = round(TCPDF_STATIC::_getFWORD($font, $offset + 8) * $urk);
|
||||
$fmetric['cbbox'] .= ','.$cid.'=>array('.$xMin.','.$yMin.','.$xMax.','.$yMax.')';
|
||||
}
|
||||
}
|
||||
@ -1074,7 +1080,7 @@ class TCPDF_FONTS {
|
||||
$c = (($i << 8) + $j);
|
||||
if (isset($subsetchars[$c])) {
|
||||
$idRangeOffset = ($subHeaders[$k]['idRangeOffset'] + $j - $subHeaders[$k]['firstCode']);
|
||||
$g = ($glyphIndexArray[$idRangeOffset] + $idDelta[$k]) % 65536;
|
||||
$g = ($glyphIndexArray[$idRangeOffset] + $subHeaders[$k]['idDelta']) % 65536;
|
||||
if ($g < 0) {
|
||||
$g = 0;
|
||||
}
|
||||
@ -1134,7 +1140,7 @@ class TCPDF_FONTS {
|
||||
$subsetglyphs[$g] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 6: { // Format 6: Trimmed table mapping
|
||||
@ -1597,9 +1603,9 @@ class TCPDF_FONTS {
|
||||
*/
|
||||
public static function UTF8ArrayToUniArray($ta, $isunicode=true) {
|
||||
if ($isunicode) {
|
||||
return array_map(array('self', 'unichrUnicode'), $ta);
|
||||
return array_map(array('TCPDF_FONTS', 'unichrUnicode'), $ta);
|
||||
}
|
||||
return array_map(array('self', 'unichrASCII'), $ta);
|
||||
return array_map(array('TCPDF_FONTS', 'unichrASCII'), $ta);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1756,6 +1762,20 @@ class TCPDF_FONTS {
|
||||
return $outstr;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @public static
|
||||
*/
|
||||
public static function uniord($uch) {
|
||||
if (!isset(self::$cache_uniord[$uch])) {
|
||||
self::$cache_uniord[$uch] = self::getUniord($uch);
|
||||
}
|
||||
return self::$cache_uniord[$uch];
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts UTF-8 character to integer value.<br>
|
||||
* Invalid byte sequences will be replaced with 0xFFFD (replacement character)<br>
|
||||
@ -1789,7 +1809,7 @@ class TCPDF_FONTS {
|
||||
* @author Nicola Asuni
|
||||
* @public static
|
||||
*/
|
||||
public static function uniord($uch) {
|
||||
public static function getUniord($uch) {
|
||||
if (function_exists('mb_convert_encoding')) {
|
||||
list(, $char) = @unpack('N', mb_convert_encoding($uch, 'UCS-4BE', 'UTF-8'));
|
||||
if ($char >= 0) {
|
||||
@ -1862,7 +1882,7 @@ class TCPDF_FONTS {
|
||||
if ($isunicode) {
|
||||
// requires PCRE unicode support turned on
|
||||
$chars = TCPDF_STATIC::pregSplit('//','u', $str, -1, PREG_SPLIT_NO_EMPTY);
|
||||
$carr = array_map(array('self', 'uniord'), $chars);
|
||||
$carr = array_map(array('TCPDF_FONTS', 'uniord'), $chars);
|
||||
} else {
|
||||
$chars = str_split($str);
|
||||
$carr = array_map('ord', $chars);
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf_images.php
|
||||
// Version : 1.0.001
|
||||
// Version : 1.0.002
|
||||
// Begin : 2002-08-03
|
||||
// Last Update : 2013-08-05
|
||||
// Last Update : 2013-11-24
|
||||
// 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.001
|
||||
* @version 1.0.002
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -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.000
|
||||
* @version 1.0.002
|
||||
* @author Nicola Asuni - info@tecnick.com
|
||||
*/
|
||||
class TCPDF_IMAGES {
|
||||
@ -121,7 +121,7 @@ class TCPDF_IMAGES {
|
||||
*/
|
||||
public static function _toPNG($image) {
|
||||
// set temporary image file name
|
||||
$tempname = TCPDF_STATIC::getObjFilename('png');
|
||||
$tempname = TCPDF_STATIC::getObjFilename('img');
|
||||
// turn off interlaced mode
|
||||
imageinterlace($image, 0);
|
||||
// create temporary PNG image
|
||||
@ -144,7 +144,7 @@ class TCPDF_IMAGES {
|
||||
* @public static
|
||||
*/
|
||||
public static function _toJPEG($image, $quality) {
|
||||
$tempname = TCPDF_STATIC::getObjFilename('jpg');
|
||||
$tempname = TCPDF_STATIC::getObjFilename('img');
|
||||
imagejpeg($image, $tempname, $quality);
|
||||
imagedestroy($image);
|
||||
$retvars = self::_parsejpeg($tempname);
|
||||
@ -235,7 +235,7 @@ class TCPDF_IMAGES {
|
||||
* @public static
|
||||
*/
|
||||
public static function _parsepng($file) {
|
||||
$f = fopen($file, 'rb');
|
||||
$f = @fopen($file, 'rb');
|
||||
if ($f === false) {
|
||||
// Can't open image file
|
||||
return false;
|
||||
|
@ -55,7 +55,7 @@ class TCPDF_STATIC {
|
||||
* Current TCPDF version.
|
||||
* @private static
|
||||
*/
|
||||
private static $tcpdf_version = '6.0.031';
|
||||
private static $tcpdf_version = '6.0.062';
|
||||
|
||||
/**
|
||||
* String alias for total number of pages.
|
||||
@ -1092,13 +1092,13 @@ class TCPDF_STATIC {
|
||||
|
||||
/**
|
||||
* Returns a temporary filename for caching object on filesystem.
|
||||
* @param $name (string) Prefix to add to the file name.
|
||||
* @param $type (string) Type of file (name of the subdir on the tcpdf cache folder).
|
||||
* @return string filename.
|
||||
* @since 4.5.000 (2008-12-31)
|
||||
* @public static
|
||||
*/
|
||||
public static function getObjFilename($name) {
|
||||
return tempnam(K_PATH_CACHE, $name.'_');
|
||||
public static function getObjFilename($type='tmp') {
|
||||
return tempnam(K_PATH_CACHE, '__tcpdf_'.$type.'_'.md5(getmypid().uniqid('', true).rand().microtime(true)).'_');
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,10 +1,8 @@
|
||||
Description of TCPDF library import 6.0.031
|
||||
Description of TCPDF library import 6.0.062
|
||||
===========================================
|
||||
* delete cache/ doc/ examples/ config/tcpdf_config_alt.php config/lang/ images/
|
||||
* delete examples/, tools/ and tcpdf_import.php
|
||||
* remove all fonts that were not already present
|
||||
* remove font/utils/
|
||||
|
||||
TODO: create some automated script for deleting of extra fonts
|
||||
* visit http://127.0.0.1/lib/tests/other/pdflibtestpage.php and view the pdf
|
||||
|
||||
2011/10/29
|
||||
----------
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -3,11 +3,11 @@
|
||||
// File name : tcpdf_autoconfig.php
|
||||
// Version : 1.0.000
|
||||
// Begin : 2013-05-16
|
||||
// Last Update : 2013-05-16
|
||||
// Last Update : 2014-01-25
|
||||
// Authors : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
|
||||
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
// Copyright (C) 2011-2013 Nicola Asuni - Tecnick.com LTD
|
||||
// Copyright (C) 2011-2014 Nicola Asuni - Tecnick.com LTD
|
||||
//
|
||||
// This file is part of TCPDF software library.
|
||||
//
|
||||
@ -117,7 +117,11 @@ if (!defined('PDF_HEADER_LOGO_WIDTH')) {
|
||||
}
|
||||
|
||||
if (!defined('K_PATH_CACHE')) {
|
||||
define ('K_PATH_CACHE', sys_get_temp_dir().'/');
|
||||
$K_PATH_CACHE = ini_get('upload_tmp_dir') ? ini_get('upload_tmp_dir') : sys_get_temp_dir();
|
||||
if (substr($K_PATH_CACHE, -1) != '/') {
|
||||
$K_PATH_CACHE .= '/';
|
||||
}
|
||||
define ('K_PATH_CACHE', $K_PATH_CACHE);
|
||||
}
|
||||
|
||||
if (!defined('K_BLANK_IMAGE')) {
|
||||
|
@ -1,13 +1,13 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf_parser.php
|
||||
// Version : 1.0.008
|
||||
// Version : 1.0.014
|
||||
// Begin : 2011-05-23
|
||||
// Last Update : 2013-09-18
|
||||
// Last Update : 2014-02-18
|
||||
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
|
||||
// License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3
|
||||
// -------------------------------------------------------------------
|
||||
// Copyright (C) 2011-2013 Nicola Asuni - Tecnick.com LTD
|
||||
// Copyright (C) 2011-2014 Nicola Asuni - Tecnick.com LTD
|
||||
//
|
||||
// This file is part of TCPDF software library.
|
||||
//
|
||||
@ -37,7 +37,7 @@
|
||||
* This is a PHP class for parsing PDF documents.<br>
|
||||
* @package com.tecnick.tcpdf
|
||||
* @author Nicola Asuni
|
||||
* @version 1.0.008
|
||||
* @version 1.0.014
|
||||
*/
|
||||
|
||||
// include class for decoding filters
|
||||
@ -48,7 +48,7 @@ require_once(dirname(__FILE__).'/include/tcpdf_filters.php');
|
||||
* This is a PHP class for parsing PDF documents.<br>
|
||||
* @package com.tecnick.tcpdf
|
||||
* @brief This is a PHP class for parsing PDF documents..
|
||||
* @version 1.0.005
|
||||
* @version 1.0.010
|
||||
* @author Nicola Asuni - info@tecnick.com
|
||||
*/
|
||||
class TCPDF_PARSER {
|
||||
@ -103,7 +103,40 @@ class TCPDF_PARSER {
|
||||
if (empty($data)) {
|
||||
$this->Error('Empty PDF data.');
|
||||
}
|
||||
// find the pdf header starting position
|
||||
if (($trimpos = strpos($data, '%PDF-')) === FALSE) {
|
||||
$this->Error('Invalid PDF data: missing %PDF header.');
|
||||
}
|
||||
// get PDF content string
|
||||
$this->pdfdata = substr($data, $trimpos);
|
||||
// get length
|
||||
$pdflen = strlen($this->pdfdata);
|
||||
// set configuration parameters
|
||||
$this->setConfig($cfg);
|
||||
// get xref and trailer data
|
||||
$this->xref = $this->getXrefData();
|
||||
// parse all document objects
|
||||
$this->objects = array();
|
||||
foreach ($this->xref['xref'] as $obj => $offset) {
|
||||
if (!isset($this->objects[$obj]) AND ($offset > 0)) {
|
||||
// decode objects with positive offset
|
||||
$this->objects[$obj] = $this->getIndirectObject($obj, $offset, true);
|
||||
}
|
||||
}
|
||||
// release some memory
|
||||
unset($this->pdfdata);
|
||||
$this->pdfdata = '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the configuration parameters.
|
||||
* @param $cfg (array) Array of configuration parameters:
|
||||
* 'die_for_errors' : if true termitate the program execution in case of error, otherwise thows an exception;
|
||||
* 'ignore_filter_decoding_errors' : if true ignore filter decoding errors;
|
||||
* 'ignore_missing_filter_decoders' : if true ignore missing filter decoding errors.
|
||||
* @public
|
||||
*/
|
||||
protected function setConfig($cfg) {
|
||||
if (isset($cfg['die_for_errors'])) {
|
||||
$this->cfg['die_for_errors'] = !!$cfg['die_for_errors'];
|
||||
}
|
||||
@ -113,25 +146,6 @@ class TCPDF_PARSER {
|
||||
if (isset($cfg['ignore_missing_filter_decoders'])) {
|
||||
$this->cfg['ignore_missing_filter_decoders'] = !!$cfg['ignore_missing_filter_decoders'];
|
||||
}
|
||||
// get PDF content string
|
||||
$this->pdfdata = $data;
|
||||
// get length
|
||||
$pdflen = strlen($this->pdfdata);
|
||||
// initialize class for decoding filters
|
||||
$this->FilterDecoders = new TCPDF_FILTERS();
|
||||
// get xref and trailer data
|
||||
$this->xref = $this->getXrefData();
|
||||
// parse all document objects
|
||||
$this->objects = array();
|
||||
foreach ($this->xref['xref'] as $obj => $offset) {
|
||||
if (!isset($this->objects[$obj]) AND ($offset > 0)) {
|
||||
// decode only objects with positive offset
|
||||
$this->objects[$obj] = $this->getIndirectObject($obj, $offset, true);
|
||||
}
|
||||
}
|
||||
// release some memory
|
||||
unset($this->pdfdata);
|
||||
$this->pdfdata = '';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -188,20 +202,25 @@ class TCPDF_PARSER {
|
||||
|
||||
/**
|
||||
* Decode the Cross-Reference section
|
||||
* @param $startxref (int) Offset at which the xref section starts.
|
||||
* @param $startxref (int) Offset at which the xref section starts (position of the 'xref' keyword).
|
||||
* @param $xref (array) Previous xref array (if any).
|
||||
* @return Array containing xref and trailer data.
|
||||
* @protected
|
||||
* @since 1.0.000 (2011-06-20)
|
||||
*/
|
||||
protected function decodeXref($startxref, $xref=array()) {
|
||||
// extract xref data (object indexes and offsets)
|
||||
$xoffset = $startxref + 5;
|
||||
$startxref += 4; // 4 is the lenght of the word 'xref'
|
||||
// skip initial white space chars: \x00 null (NUL), \x09 horizontal tab (HT), \x0A line feed (LF), \x0C form feed (FF), \x0D carriage return (CR), \x20 space (SP)
|
||||
$offset = $startxref + strspn($this->pdfdata, "\x00\x09\x0a\x0c\x0d\x20", $startxref);
|
||||
// initialize object number
|
||||
$obj_num = 0;
|
||||
$offset = $xoffset;
|
||||
while (preg_match('/^([0-9]+)[\s]([0-9]+)[\s]?([nf]?)/im', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) {
|
||||
$offset = (strlen($matches[0][0]) + $matches[0][1]);
|
||||
// search for cross-reference entries or subsection
|
||||
while (preg_match('/([0-9]+)[\x20]([0-9]+)[\x20]?([nf]?)(\r\n|[\x20]?[\r\n])/', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) {
|
||||
if ($matches[0][1] != $offset) {
|
||||
// we are on another section
|
||||
break;
|
||||
}
|
||||
$offset += strlen($matches[0][0]);
|
||||
if ($matches[3][0] == 'n') {
|
||||
// create unique object index: [object number]_[generation number]
|
||||
$index = $obj_num.'_'.intval($matches[2][0]);
|
||||
@ -211,17 +230,15 @@ class TCPDF_PARSER {
|
||||
$xref['xref'][$index] = intval($matches[1][0]);
|
||||
}
|
||||
++$obj_num;
|
||||
$offset += 2;
|
||||
} elseif ($matches[3][0] == 'f') {
|
||||
++$obj_num;
|
||||
$offset += 2;
|
||||
} else {
|
||||
// object number (index)
|
||||
$obj_num = intval($matches[1][0]);
|
||||
}
|
||||
}
|
||||
// get trailer data
|
||||
if (preg_match('/trailer[\s]*<<(.*)>>[\s]*[\r\n]+startxref[\s]*[\r\n]+/isU', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $xoffset) > 0) {
|
||||
if (preg_match('/trailer[\s]*<<(.*)>>/isU', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) {
|
||||
$trailer_data = $matches[1][0];
|
||||
if (!isset($xref['trailer']) OR empty($xref['trailer'])) {
|
||||
// get only the last updated version
|
||||
@ -274,7 +291,11 @@ class TCPDF_PARSER {
|
||||
} else {
|
||||
$filltrailer = false;
|
||||
}
|
||||
if (!isset($xref['xref'])) {
|
||||
$xref['xref'] = array();
|
||||
}
|
||||
$valid_crs = false;
|
||||
$columns = 0;
|
||||
$sarr = $xrefcrs[0][1];
|
||||
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'))) {
|
||||
@ -305,10 +326,12 @@ class TCPDF_PARSER {
|
||||
} elseif ($filltrailer) {
|
||||
if (($v[0] == '/') AND ($v[1] == 'Size') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'numeric'))) {
|
||||
$xref['trailer']['size'] = $sarr[($k +1)][1];
|
||||
} elseif (($v[0] == '/') AND ($v[1] == 'Root') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'ojbref'))) {
|
||||
} elseif (($v[0] == '/') AND ($v[1] == 'Root') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'objref'))) {
|
||||
$xref['trailer']['root'] = $sarr[($k +1)][1];
|
||||
} elseif (($v[0] == '/') AND ($v[1] == 'Info') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'ojbref'))) {
|
||||
} elseif (($v[0] == '/') AND ($v[1] == 'Info') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'objref'))) {
|
||||
$xref['trailer']['info'] = $sarr[($k +1)][1];
|
||||
} elseif (($v[0] == '/') AND ($v[1] == 'Encrypt') AND (isset($sarr[($k +1)]) AND ($sarr[($k +1)][0] == 'objref'))) {
|
||||
$xref['trailer']['encrypt'] = $sarr[($k +1)][1];
|
||||
} elseif (($v[0] == '/') AND ($v[1] == 'ID') AND (isset($sarr[($k +1)]))) {
|
||||
$xref['trailer']['id'] = array();
|
||||
$xref['trailer']['id'][0] = $sarr[($k +1)][1][0][1];
|
||||
@ -406,12 +429,14 @@ class TCPDF_PARSER {
|
||||
// default type field
|
||||
$sdata[$k][0] = 1;
|
||||
}
|
||||
$i = 0; // count bytes on the row
|
||||
$i = 0; // count bytes in the row
|
||||
// for every column
|
||||
for ($c = 0; $c < 3; ++$c) {
|
||||
// for every byte on the column
|
||||
for ($b = 0; $b < $wb[$c]; ++$b) {
|
||||
$sdata[$k][$c] += ($row[$i] << (($wb[$c] - 1 - $b) * 8));
|
||||
if (isset($row[$i])) {
|
||||
$sdata[$k][$c] += ($row[$i] << (($wb[$c] - 1 - $b) * 8));
|
||||
}
|
||||
++$i;
|
||||
}
|
||||
}
|
||||
@ -426,7 +451,6 @@ class TCPDF_PARSER {
|
||||
foreach ($sdata as $k => $row) {
|
||||
switch ($row[0]) {
|
||||
case 0: { // (f) linked list of free objects
|
||||
++$obj_num;
|
||||
break;
|
||||
}
|
||||
case 1: { // (n) objects that are in use but are not compressed
|
||||
@ -437,7 +461,6 @@ class TCPDF_PARSER {
|
||||
// store object offset position
|
||||
$xref['xref'][$index] = $row[1];
|
||||
}
|
||||
++$obj_num;
|
||||
break;
|
||||
}
|
||||
case 2: { // compressed objects
|
||||
@ -451,6 +474,7 @@ class TCPDF_PARSER {
|
||||
break;
|
||||
}
|
||||
}
|
||||
++$obj_num;
|
||||
}
|
||||
} // end decoding data
|
||||
if (isset($prevxref)) {
|
||||
@ -481,7 +505,7 @@ class TCPDF_PARSER {
|
||||
$next = strcspn($this->pdfdata, "\r\n", $offset);
|
||||
if ($next > 0) {
|
||||
$offset += $next;
|
||||
return $this->getRawObject($this->pdfdata, $offset);
|
||||
return $this->getRawObject($offset);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -575,7 +599,9 @@ class TCPDF_PARSER {
|
||||
// remove white space characters
|
||||
$objval = strtr($matches[1], "\x09\x0a\x0c\x0d\x20", '');
|
||||
$offset += strlen($matches[0]);
|
||||
}
|
||||
} elseif (($endpos = strpos($this->pdfdata, '>', $offset)) !== FALSE) {
|
||||
$offset = $endpos + 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -605,9 +631,9 @@ class TCPDF_PARSER {
|
||||
$offset += 6;
|
||||
if (preg_match('/^([\r]?[\n])/isU', substr($this->pdfdata, $offset), $matches) == 1) {
|
||||
$offset += strlen($matches[0]);
|
||||
if (preg_match('/([\r]?[\n])?(endstream)[\x09\x0a\x0c\x0d\x20]/isU', substr($this->pdfdata, $offset), $matches, PREG_OFFSET_CAPTURE) == 1) {
|
||||
if (preg_match('/(endstream)[\x09\x0a\x0c\x0d\x20]/isU', substr($this->pdfdata, $offset), $matches, PREG_OFFSET_CAPTURE) == 1) {
|
||||
$objval = substr($this->pdfdata, $offset, $matches[0][1]);
|
||||
$offset += $matches[2][1];
|
||||
$offset += $matches[1][1];
|
||||
}
|
||||
}
|
||||
} elseif (substr($this->pdfdata, $offset, 9) == 'endstream') {
|
||||
@ -616,12 +642,12 @@ class TCPDF_PARSER {
|
||||
$offset += 9;
|
||||
} elseif (preg_match('/^([0-9]+)[\s]+([0-9]+)[\s]+R/iU', substr($this->pdfdata, $offset, 33), $matches) == 1) {
|
||||
// indirect object reference
|
||||
$objtype = 'ojbref';
|
||||
$objtype = 'objref';
|
||||
$offset += strlen($matches[0]);
|
||||
$objval = intval($matches[1]).'_'.intval($matches[2]);
|
||||
} elseif (preg_match('/^([0-9]+)[\s]+([0-9]+)[\s]+obj/iU', substr($this->pdfdata, $offset, 33), $matches) == 1) {
|
||||
// object start
|
||||
$objtype = 'ojb';
|
||||
$objtype = 'obj';
|
||||
$objval = intval($matches[1]).'_'.intval($matches[2]);
|
||||
$offset += strlen ($matches[0]);
|
||||
} elseif (($numlen = strspn($this->pdfdata, '+-.0123456789', $offset)) > 0) {
|
||||
@ -652,6 +678,8 @@ class TCPDF_PARSER {
|
||||
return;
|
||||
}
|
||||
$objref = $obj[0].' '.$obj[1].' obj';
|
||||
// ignore leading zeros
|
||||
$offset += strspn($this->pdfdata, '0', $offset);
|
||||
if (strpos($this->pdfdata, $objref, $offset) != $offset) {
|
||||
// an indirect reference to an undefined object shall be considered a reference to the null object
|
||||
return array('null', 'null', $offset);
|
||||
@ -744,13 +772,13 @@ class TCPDF_PARSER {
|
||||
// decode the stream
|
||||
$remaining_filters = array();
|
||||
foreach ($filters as $filter) {
|
||||
if (in_array($filter, $this->FilterDecoders->getAvailableFilters())) {
|
||||
if (in_array($filter, TCPDF_FILTERS::getAvailableFilters())) {
|
||||
try {
|
||||
$stream = $this->FilterDecoders->decodeFilter($filter, $stream);
|
||||
$stream = TCPDF_FILTERS::decodeFilter($filter, $stream);
|
||||
} catch (Exception $e) {
|
||||
$emsg = $e->getMessage();
|
||||
if ((($emsg[0] == '~') AND !$this->cfg['ignore_missing_filter_decoders'])
|
||||
OR (($emsg[0] != '~') AND !$this->cfg['ignore_filter_decoding_errors'])) {
|
||||
OR (($emsg[0] != '~') AND !$this->cfg['ignore_filter_decoding_errors'])) {
|
||||
$this->Error($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@
|
||||
<location>tcpdf</location>
|
||||
<name>TCPDF</name>
|
||||
<license>LGPL</license>
|
||||
<version>6.0.031</version>
|
||||
<version>6.0.062</version>
|
||||
<licenseversion>3</licenseversion>
|
||||
</library>
|
||||
<library>
|
||||
|
Loading…
x
Reference in New Issue
Block a user