This commit is contained in:
nicolaasuni 2012-05-03 22:57:49 +01:00
parent 047c7ee43d
commit 542c27f159
4 changed files with 32 additions and 20 deletions

View File

@ -1,3 +1,6 @@
5.9.160 (2012-05-03)
- A bug on tcpdf_parser.php was fixed.
5.9.159 (2012-04-30)
- Barcode classes were updated to fix PNG export Bug (ID: 3522291).

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------
Name: TCPDF
Version: 5.9.159
Release date: 2012-04-30
Version: 5.9.160
Release date: 2012-05-03
Author: Nicola Asuni
Copyright (c) 2002-2012:

View File

@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf.php
// Version : 5.9.159
// Version : 5.9.160
// Begin : 2002-08-03
// Last Update : 2012-04-30
// Last Update : 2012-05-03
// Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - info@tecnick.com
// License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3
// -------------------------------------------------------------------
@ -137,7 +137,7 @@
* Tools to encode your unicode fonts are on fonts/utils directory.</p>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 5.9.159
* @version 5.9.160
*/
// Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file.
@ -149,7 +149,7 @@ require_once(dirname(__FILE__).'/config/tcpdf_config.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 5.9.159
* @version 5.9.160
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF {
@ -160,7 +160,7 @@ class TCPDF {
* Current TCPDF version.
* @private
*/
private $tcpdf_version = '5.9.159';
private $tcpdf_version = '5.9.160';
// Protected properties

View File

@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf_parser.php
// Version : 1.0.000
// Version : 1.0.001
// Begin : 2011-05-23
// Last Update : 2012-01-28
// Last Update : 2012-05-03
// Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - info@tecnick.com
// License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3
// -------------------------------------------------------------------
@ -37,7 +37,7 @@
* This is a PHP class for parsing PDF documents.<br>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.000
* @version 1.0.001
*/
// include class for decoding filters
@ -48,7 +48,7 @@ require_once(dirname(__FILE__).'/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.000
* @version 1.0.001
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF_PARSER {
@ -127,20 +127,29 @@ class TCPDF_PARSER {
* @since 1.0.000 (2011-05-24)
*/
protected function getXrefData($offset=0, $xref=array()) {
// find last startxref
if (preg_match_all('/[\r\n]startxref[\s]*[\r\n]+([0-9]+)[\s]*[\r\n]+%%EOF/i', $this->pdfdata, $matches, PREG_SET_ORDER, $offset) == 0) {
$this->Error('Unable to find startxref');
if ($offset == 0) {
// find last startxref
if (preg_match_all('/[\r\n]startxref[\s]*[\r\n]+([0-9]+)[\s]*[\r\n]+%%EOF/i', $this->pdfdata, $matches, PREG_SET_ORDER, $offset) == 0) {
$this->Error('Unable to find startxref');
}
$matches = array_pop($matches);
$startxref = $matches[1];
} else {
// get the first xref at the specified offset
if (preg_match('/[\r\n]startxref[\s]*[\r\n]+([0-9]+)[\s]*[\r\n]+%%EOF/i', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) == 0) {
$this->Error('Unable to find startxref');
}
$startxref = $matches[1][0];
}
$matches = array_pop($matches);
$startxref = $matches[1];
// check xref position
if (strpos($this->pdfdata, 'xref', $startxref) != $startxref) {
$this->Error('Unable to find xref');
}
// extract xref data (object indexes and offsets)
$offset = $startxref + 5;
$xoffset = $startxref + 5;
// 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]);
if ($matches[3][0] == 'n') {
@ -162,7 +171,7 @@ class TCPDF_PARSER {
}
}
// get trailer data
if (preg_match('/trailer[\s]*<<(.*)>>[\s]*[\r\n]+startxref[\s]*[\r\n]+/isU', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) {
if (preg_match('/trailer[\s]*<<(.*)>>[\s]*[\r\n]+startxref[\s]*[\r\n]+/isU', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $xoffset) > 0) {
$trailer_data = $matches[1][0];
if (!isset($xref['trailer'])) {
// get only the last updated version
@ -188,7 +197,7 @@ class TCPDF_PARSER {
}
if (preg_match('/Prev[\s]+([0-9]+)/i', $trailer_data, $matches) > 0) {
// get previous xref
$xref = getXrefData(substr($this->pdfdata, 0, $startxref), intval($matches[1]), $xref);
$xref = $this->getXrefData(intval($matches[1]), $xref);
}
} else {
$this->Error('Unable to find trailer');
@ -399,7 +408,7 @@ class TCPDF_PARSER {
$offset = $element[2];
// decode stream using stream's dictionary information
if ($decoding AND ($element[0] == 'stream') AND (isset($objdata[($i - 1)][0])) AND ($objdata[($i - 1)][0] == '<<')) {
$element[3] = $this->decodeStream($objdata[($i - 1)][1], $element[1]);
$element[3] = $this->decodeStream($objdata[($i - 1)][1], substr($element[1], 1));
}
$objdata[$i] = $element;
++$i;