32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-11-22 04:45:17 +00:00

6.0.029 (2013-09-15)

- Constants K_TCPDF_PARSER_THROW_EXCEPTION_ERROR and K_TCPDF_PARSER_IGNORE_DECODING_ERRORS where removed in favor of a new configuration array in the TCPDF_PARSER class.
- The TCPDF_PARSER class can now be configured using the new  parameter.
This commit is contained in:
nicolaasuni 2013-09-15 11:12:43 +01:00
parent 0dd315280d
commit 987c4af522
7 changed files with 52 additions and 19 deletions

View File

@ -1,7 +1,12 @@
6.0.029 (2013-09-15)
- Constants K_TCPDF_PARSER_THROW_EXCEPTION_ERROR and K_TCPDF_PARSER_IGNORE_DECODING_ERRORS where removed in favor of a new configuration array in the TCPDF_PARSER class.
- The TCPDF_PARSER class can now be configured using the new $cfg parameter.
6.0.028 (2013-09-15)
- A debug print_r was removed form tcpdf_parser.php.
- TCPDF_FILTERS now throws an exception in case of error.
- TCPDF_PARSER now throws an exception in case of error unless you define the constant K_TCPDF_PARSER_THROW_EXCEPTION_ERROR to false.
- TCPDF_FILTERS class now throws an exception in case of error.
- TCPDF_PARSER class now throws an exception in case of error unless you define the constant K_TCPDF_PARSER_THROW_EXCEPTION_ERROR to false.
- The constant K_TCPDF_PARSER_IGNORE_DECODING_ERRORS can be set to tru eto ignore decoding errors on TCPDF_PARSER.
6.0.027 (2013-09-14)
- A bug in tcpdf_parser wen parsing hexadecimal strings was fixed.

View File

@ -8,7 +8,7 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------
Name: TCPDF
Version: 6.0.028
Version: 6.0.029
Release date: 2013-09-15
Author: Nicola Asuni

View File

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

View File

@ -406,7 +406,7 @@ class TCPDF_FILTERS {
* @public static
*/
public static function decodeFilterCCITTFaxDecode($data) {
self::Error('decodeFilterCCITTFaxDecode: this method has not been yet implemented');
self::Error('~decodeFilterCCITTFaxDecode: this method has not been yet implemented');
//return $data;
}
@ -419,7 +419,7 @@ class TCPDF_FILTERS {
* @public static
*/
public static function decodeFilterJBIG2Decode($data) {
self::Error('decodeFilterJBIG2Decode: this method has not been yet implemented');
self::Error('~decodeFilterJBIG2Decode: this method has not been yet implemented');
//return $data;
}
@ -432,7 +432,7 @@ class TCPDF_FILTERS {
* @public static
*/
public static function decodeFilterDCTDecode($data) {
self::Error('decodeFilterDCTDecode: this method has not been yet implemented');
self::Error('~decodeFilterDCTDecode: this method has not been yet implemented');
//return $data;
}
@ -445,7 +445,7 @@ class TCPDF_FILTERS {
* @public static
*/
public static function decodeFilterJPXDecode($data) {
self::Error('decodeFilterJPXDecode: this method has not been yet implemented');
self::Error('~decodeFilterJPXDecode: this method has not been yet implemented');
//return $data;
}
@ -458,7 +458,7 @@ class TCPDF_FILTERS {
* @public static
*/
public static function decodeFilterCrypt($data) {
self::Error('decodeFilterCrypt: this method has not been yet implemented');
self::Error('~decodeFilterCrypt: this method has not been yet implemented');
//return $data;
}

View File

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

View File

@ -1,7 +1,7 @@
<?php
//============================================================+
// File name : tcpdf.php
// Version : 6.0.028
// Version : 6.0.029
// Begin : 2002-08-03
// Last Update : 2013-09-15
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
@ -139,7 +139,7 @@
* Tools to encode your unicode fonts are on fonts/utils directory.</p>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 6.0.028
* @version 6.0.029
*/
// TCPDF configuration
@ -163,7 +163,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.0.028
* @version 6.0.029
* @author Nicola Asuni - info@tecnick.com
*/
class TCPDF {

View File

@ -1,7 +1,7 @@
<?php
//============================================================+
// File name : tcpdf_parser.php
// Version : 1.0.006
// Version : 1.0.007
// Begin : 2011-05-23
// Last Update : 2013-09-15
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
@ -37,7 +37,7 @@
* This is a PHP class for parsing PDF documents.<br>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 1.0.006
* @version 1.0.007
*/
// include class for decoding filters
@ -77,18 +77,43 @@ class TCPDF_PARSER {
*/
private $FilterDecoders;
/**
* Array of configuration parameters.
* @private
*/
private $cfg = array(
'die_for_errors' => false,
'ignore_filter_decoding_errors' => true,
'ignore_missing_filter_decoders' => true,
);
// -----------------------------------------------------------------------------
/**
* Parse a PDF document an return an array of objects.
* @param $data (string) PDF data to parse.
* @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
* @since 1.0.000 (2011-05-24)
*/
public function __construct($data) {
public function __construct($data, $cfg=array()) {
if (empty($data)) {
$this->Error('Empty PDF data.');
}
// set configuration parameters
if (isset($cfg['die_for_errors'])) {
$this->cfg['die_for_errors'] = !!$cfg['die_for_errors'];
}
if (isset($cfg['ignore_filter_decoding_errors'])) {
$this->cfg['ignore_filter_decoding_errors'] = !!$cfg['ignore_filter_decoding_errors'];
}
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);
@ -210,7 +235,6 @@ class TCPDF_PARSER {
}
if (preg_match('/Encrypt[\s]+([0-9]+)[\s]+([0-9]+)[\s]+R/i', $trailer_data, $matches) > 0) {
$xref['trailer']['encrypt'] = intval($matches[1]).'_'.intval($matches[2]);
$this->Error('Encrypted documents are not supported!');
}
if (preg_match('/Info[\s]+([0-9]+)[\s]+([0-9]+)[\s]+R/i', $trailer_data, $matches) > 0) {
$xref['trailer']['info'] = intval($matches[1]).'_'.intval($matches[2]);
@ -724,7 +748,11 @@ class TCPDF_PARSER {
try {
$stream = $this->FilterDecoders->decodeFilter($filter, $stream);
} catch (Exception $e) {
$this->Error($e->getMessage());
$emsg = $e->getMessage();
if ((($emsg[0] == '~') AND !$this->cfg['ignore_missing_filter_decoders'])
OR (($emsg[0] != '~') AND !$this->cfg['ignore_filter_decoding_errors'])) {
$this->Error($e->getMessage());
}
}
} else {
// add missing filter to array
@ -741,7 +769,7 @@ class TCPDF_PARSER {
* @since 1.0.000 (2011-05-23)
*/
public function Error($msg) {
if (defined('K_TCPDF_PARSER_THROW_EXCEPTION_ERROR') AND !K_TCPDF_PARSER_THROW_EXCEPTION_ERROR) {
if ($this->cfg['die_for_errors']) {
die('<strong>TCPDF_PARSER ERROR: </strong>'.$msg);
} else {
throw new Exception('TCPDF_PARSER ERROR: '.$msg);