32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-11-25 22:07:33 +00:00

6.0.035 (2013-09-25)

- TCPDF_PARSER class was improved.
This commit is contained in:
nicolaasuni 2013-09-25 15:24:06 +01:00
parent f66b3e1ce7
commit 6640bd863d
6 changed files with 47 additions and 34 deletions

View File

@ -1,3 +1,6 @@
6.0.035 (2013-09-25)
- TCPDF_PARSER class was improved.
6.0.034 (2013-09-24) 6.0.034 (2013-09-24)
- Bug #839 "Error in xref parsing in mixed newline chars" was fixed. - Bug #839 "Error in xref parsing in mixed newline chars" was fixed.

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------ ------------------------------------------------------------
Name: TCPDF Name: TCPDF
Version: 6.0.034 Version: 6.0.035
Release date: 2013-09-24 Release date: 2013-09-25
Author: Nicola Asuni Author: Nicola Asuni
Copyright (c) 2002-2013: Copyright (c) 2002-2013:

View File

@ -1,6 +1,6 @@
{ {
"name": "tecnick.com/tcpdf", "name": "tecnick.com/tcpdf",
"version": "6.0.034", "version": "6.0.035",
"homepage": "http://www.tcpdf.org/", "homepage": "http://www.tcpdf.org/",
"type": "library", "type": "library",
"description": "TCPDF is a PHP class for generating PDF documents.", "description": "TCPDF is a PHP class for generating PDF documents.",

View File

@ -55,7 +55,7 @@ class TCPDF_STATIC {
* Current TCPDF version. * Current TCPDF version.
* @private static * @private static
*/ */
private static $tcpdf_version = '6.0.034'; private static $tcpdf_version = '6.0.035';
/** /**
* String alias for total number of pages. * String alias for total number of pages.

View File

@ -1,9 +1,9 @@
<?php <?php
//============================================================+ //============================================================+
// File name : tcpdf.php // File name : tcpdf.php
// Version : 6.0.034 // Version : 6.0.035
// Begin : 2002-08-03 // Begin : 2002-08-03
// Last Update : 2013-09-24 // Last Update : 2013-09-25
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // 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 (http://www.gnu.org/copyleft/lesser.html)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -104,7 +104,7 @@
* Tools to encode your unicode fonts are on fonts/utils directory.</p> * Tools to encode your unicode fonts are on fonts/utils directory.</p>
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @author Nicola Asuni * @author Nicola Asuni
* @version 6.0.034 * @version 6.0.035
*/ */
// TCPDF configuration // 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> * 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 * @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions. * @brief PHP class for generating PDF documents without requiring external extensions.
* @version 6.0.034 * @version 6.0.035
* @author Nicola Asuni - info@tecnick.com * @author Nicola Asuni - info@tecnick.com
*/ */
class TCPDF { class TCPDF {

View File

@ -1,9 +1,9 @@
<?php <?php
//============================================================+ //============================================================+
// File name : tcpdf_parser.php // File name : tcpdf_parser.php
// Version : 1.0.009 // Version : 1.0.010
// Begin : 2011-05-23 // Begin : 2011-05-23
// Last Update : 2013-09-24 // Last Update : 2013-09-25
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3 // 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> * This is a PHP class for parsing PDF documents.<br>
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @author Nicola Asuni * @author Nicola Asuni
* @version 1.0.009 * @version 1.0.010
*/ */
// include class for decoding filters // 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> * This is a PHP class for parsing PDF documents.<br>
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @brief This is a PHP class for parsing PDF documents.. * @brief This is a PHP class for parsing PDF documents..
* @version 1.0.009 * @version 1.0.010
* @author Nicola Asuni - info@tecnick.com * @author Nicola Asuni - info@tecnick.com
*/ */
class TCPDF_PARSER { class TCPDF_PARSER {
@ -104,6 +104,35 @@ class TCPDF_PARSER {
$this->Error('Empty PDF data.'); $this->Error('Empty PDF data.');
} }
// set configuration parameters // set configuration parameters
$this->setConfig($cfg);
// get PDF content string
$this->pdfdata = $data;
// get length
$pdflen = strlen($this->pdfdata);
// 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'])) { if (isset($cfg['die_for_errors'])) {
$this->cfg['die_for_errors'] = !!$cfg['die_for_errors']; $this->cfg['die_for_errors'] = !!$cfg['die_for_errors'];
} }
@ -113,25 +142,6 @@ class TCPDF_PARSER {
if (isset($cfg['ignore_missing_filter_decoders'])) { if (isset($cfg['ignore_missing_filter_decoders'])) {
$this->cfg['ignore_missing_filter_decoders'] = !!$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 = '';
} }
/** /**
@ -747,13 +757,13 @@ class TCPDF_PARSER {
// decode the stream // decode the stream
$remaining_filters = array(); $remaining_filters = array();
foreach ($filters as $filter) { foreach ($filters as $filter) {
if (in_array($filter, $this->FilterDecoders->getAvailableFilters())) { if (in_array($filter, TCPDF_FILTERS::getAvailableFilters())) {
try { try {
$stream = $this->FilterDecoders->decodeFilter($filter, $stream); $stream = TCPDF_FILTERS::decodeFilter($filter, $stream);
} catch (Exception $e) { } catch (Exception $e) {
$emsg = $e->getMessage(); $emsg = $e->getMessage();
if ((($emsg[0] == '~') AND !$this->cfg['ignore_missing_filter_decoders']) 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()); $this->Error($e->getMessage());
} }
} }