mirror of
https://github.com/vdm-io/tcpdf.git
synced 2024-11-22 12:55:10 +00:00
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.
This commit is contained in:
parent
88efb72a26
commit
0dd315280d
@ -1,3 +1,8 @@
|
||||
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.
|
||||
|
||||
6.0.027 (2013-09-14)
|
||||
- A bug in tcpdf_parser wen parsing hexadecimal strings was fixed.
|
||||
- A bug in tcpdf_parser wen looking for statxref was fixed.
|
||||
|
@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
|
||||
------------------------------------------------------------
|
||||
|
||||
Name: TCPDF
|
||||
Version: 6.0.027
|
||||
Release date: 2013-09-14
|
||||
Version: 6.0.028
|
||||
Release date: 2013-09-15
|
||||
Author: Nicola Asuni
|
||||
|
||||
Copyright (c) 2002-2013:
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "tecnick.com/tcpdf",
|
||||
"version": "6.0.027",
|
||||
"version": "6.0.028",
|
||||
"homepage": "http://www.tcpdf.org/",
|
||||
"type": "library",
|
||||
"description": "TCPDF is a PHP class for generating PDF documents.",
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf_filters.php
|
||||
// Version : 1.0.000
|
||||
// Version : 1.0.001
|
||||
// Begin : 2011-05-23
|
||||
// Last Update : 2013-03-17
|
||||
// Last Update : 2013-09-15
|
||||
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
|
||||
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
@ -37,7 +37,7 @@
|
||||
* This is a PHP class for decoding common PDF filters (PDF 32000-2008 - 7.4 Filters).<br>
|
||||
* @package com.tecnick.tcpdf
|
||||
* @author Nicola Asuni
|
||||
* @version 1.0.000
|
||||
* @version 1.0.001
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -45,7 +45,7 @@
|
||||
* This is a PHP class for decoding common PDF filters (PDF 32000-2008 - 7.4 Filters).<br>
|
||||
* @package com.tecnick.tcpdf
|
||||
* @brief This is a PHP class for decoding common PDF filters.
|
||||
* @version 1.0.000
|
||||
* @version 1.0.001
|
||||
* @author Nicola Asuni - info@tecnick.com
|
||||
*/
|
||||
class TCPDF_FILTERS {
|
||||
@ -167,12 +167,12 @@ class TCPDF_FILTERS {
|
||||
// EOD shall behave as if a 0 (zero) followed the last digit
|
||||
$data = substr($data, 0, -1).'0'.substr($data, -1);
|
||||
} else {
|
||||
self::Error('decodeASCIIHex: invalid code');
|
||||
self::Error('decodeFilterASCIIHexDecode: invalid code');
|
||||
}
|
||||
}
|
||||
// check for invalid characters
|
||||
if (preg_match('/[^a-fA-F\d]/', $data) > 0) {
|
||||
self::Error('decodeASCIIHex: invalid code');
|
||||
self::Error('decodeFilterASCIIHexDecode: invalid code');
|
||||
}
|
||||
// get one byte of binary data for each pair of ASCII hexadecimal digits
|
||||
$decoded = pack('H*', $data);
|
||||
@ -207,7 +207,7 @@ class TCPDF_FILTERS {
|
||||
$data_length = strlen($data);
|
||||
// check for invalid characters
|
||||
if (preg_match('/[^\x21-\x75,\x74]/', $data) > 0) {
|
||||
self::Error('decodeASCII85: invalid code');
|
||||
self::Error('decodeFilterASCII85Decode: invalid code');
|
||||
}
|
||||
// z sequence
|
||||
$zseq = chr(0).chr(0).chr(0).chr(0);
|
||||
@ -224,7 +224,7 @@ class TCPDF_FILTERS {
|
||||
if ($group_pos == 0) {
|
||||
$decoded .= $zseq;
|
||||
} else {
|
||||
self::Error('decodeASCII85: invalid code');
|
||||
self::Error('decodeFilterASCII85Decode: invalid code');
|
||||
}
|
||||
} else {
|
||||
// the value represented by a group of 5 characters should never be greater than 2^32 - 1
|
||||
@ -256,7 +256,7 @@ class TCPDF_FILTERS {
|
||||
break;
|
||||
}
|
||||
case 1: {
|
||||
self::Error('decodeASCII85: invalid code');
|
||||
self::Error('decodeFilterASCII85Decode: invalid code');
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -354,9 +354,9 @@ class TCPDF_FILTERS {
|
||||
*/
|
||||
public static function decodeFilterFlateDecode($data) {
|
||||
// intialize string to return
|
||||
$decoded = gzuncompress($data);
|
||||
$decoded = @gzuncompress($data);
|
||||
if ($decoded === false) {
|
||||
self::Error('decodeFlate: invalid code');
|
||||
self::Error('decodeFilterFlateDecode: invalid code');
|
||||
}
|
||||
return $decoded;
|
||||
}
|
||||
@ -398,7 +398,7 @@ class TCPDF_FILTERS {
|
||||
}
|
||||
|
||||
/**
|
||||
* CCITTFaxDecode (NOT IMPLEMETED)
|
||||
* CCITTFaxDecode (NOT IMPLEMETED - RETURN AN EXCEPTION)
|
||||
* Decompresses data encoded using the CCITT facsimile standard, reproducing the original data (typically monochrome image data at 1 bit per pixel).
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
@ -406,11 +406,12 @@ class TCPDF_FILTERS {
|
||||
* @public static
|
||||
*/
|
||||
public static function decodeFilterCCITTFaxDecode($data) {
|
||||
return $data;
|
||||
self::Error('decodeFilterCCITTFaxDecode: this method has not been yet implemented');
|
||||
//return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* JBIG2Decode (NOT IMPLEMETED)
|
||||
* JBIG2Decode (NOT IMPLEMETED - RETURN AN EXCEPTION)
|
||||
* Decompresses data encoded using the JBIG2 standard, reproducing the original monochrome (1 bit per pixel) image data (or an approximation of that data).
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
@ -418,11 +419,12 @@ class TCPDF_FILTERS {
|
||||
* @public static
|
||||
*/
|
||||
public static function decodeFilterJBIG2Decode($data) {
|
||||
return $data;
|
||||
self::Error('decodeFilterJBIG2Decode: this method has not been yet implemented');
|
||||
//return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* DCTDecode (NOT IMPLEMETED)
|
||||
* DCTDecode (NOT IMPLEMETED - RETURN AN EXCEPTION)
|
||||
* Decompresses data encoded using a DCT (discrete cosine transform) technique based on the JPEG standard, reproducing image sample data that approximates the original data.
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
@ -430,11 +432,12 @@ class TCPDF_FILTERS {
|
||||
* @public static
|
||||
*/
|
||||
public static function decodeFilterDCTDecode($data) {
|
||||
return $data;
|
||||
self::Error('decodeFilterDCTDecode: this method has not been yet implemented');
|
||||
//return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* JPXDecode (NOT IMPLEMETED)
|
||||
* JPXDecode (NOT IMPLEMETED - RETURN AN EXCEPTION)
|
||||
* Decompresses data encoded using the wavelet-based JPEG2000 standard, reproducing the original image data.
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
@ -442,11 +445,12 @@ class TCPDF_FILTERS {
|
||||
* @public static
|
||||
*/
|
||||
public static function decodeFilterJPXDecode($data) {
|
||||
return $data;
|
||||
self::Error('decodeFilterJPXDecode: this method has not been yet implemented');
|
||||
//return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Crypt (NOT IMPLEMETED)
|
||||
* Crypt (NOT IMPLEMETED - RETURN AN EXCEPTION)
|
||||
* Decrypts data encrypted by a security handler, reproducing the data as it was before encryption.
|
||||
* @param $data (string) Data to decode.
|
||||
* @return Decoded data string.
|
||||
@ -454,20 +458,20 @@ class TCPDF_FILTERS {
|
||||
* @public static
|
||||
*/
|
||||
public static function decodeFilterCrypt($data) {
|
||||
return $data;
|
||||
self::Error('decodeFilterCrypt: this method has not been yet implemented');
|
||||
//return $data;
|
||||
}
|
||||
|
||||
// --- END FILTERS SECTION -------------------------------------------------
|
||||
|
||||
/**
|
||||
* This method is automatically called in case of fatal error; it simply outputs the message and halts the execution.
|
||||
* Throw an exception.
|
||||
* @param $msg (string) The error message
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
* @public static
|
||||
*/
|
||||
public static function Error($msg) {
|
||||
// exit program and print error
|
||||
die('<strong>TCPDF_FILTERS ERROR: </strong>'.$msg);
|
||||
throw new Exception('TCPDF_PARSER ERROR: '.$msg);
|
||||
}
|
||||
|
||||
} // END OF TCPDF_FILTERS CLASS
|
||||
|
@ -55,7 +55,7 @@ class TCPDF_STATIC {
|
||||
* Current TCPDF version.
|
||||
* @private static
|
||||
*/
|
||||
private static $tcpdf_version = '6.0.027';
|
||||
private static $tcpdf_version = '6.0.028';
|
||||
|
||||
/**
|
||||
* String alias for total number of pages.
|
||||
|
14
tcpdf.php
14
tcpdf.php
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf.php
|
||||
// Version : 6.0.027
|
||||
// Version : 6.0.028
|
||||
// Begin : 2002-08-03
|
||||
// Last Update : 2013-09-14
|
||||
// Last Update : 2013-09-15
|
||||
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
|
||||
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
|
||||
// -------------------------------------------------------------------
|
||||
@ -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.027
|
||||
* @version 6.0.028
|
||||
*/
|
||||
|
||||
// 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.027
|
||||
* @version 6.0.028
|
||||
* @author Nicola Asuni - info@tecnick.com
|
||||
*/
|
||||
class TCPDF {
|
||||
@ -2919,8 +2919,7 @@ class TCPDF {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is automatically called in case of fatal error; it simply outputs the message and halts the execution. An inherited class may override it to customize the error handling but should always halt the script, or the resulting document would probably be invalid.
|
||||
* 2004-06-11 :: Nicola Asuni : changed bold tag with strong
|
||||
* Throw an exception or print an error message and die if the K_TCPDF_PARSER_THROW_EXCEPTION_ERROR constant is set to true.
|
||||
* @param $msg (string) The error message
|
||||
* @public
|
||||
* @since 1.0
|
||||
@ -2928,8 +2927,7 @@ class TCPDF {
|
||||
public function Error($msg) {
|
||||
// unset all class variables
|
||||
$this->_destroy(true);
|
||||
// exit program and print error
|
||||
if (!K_TCPDF_THROW_EXCEPTION_ERROR) {
|
||||
if (defined('K_TCPDF_THROW_EXCEPTION_ERROR') AND !K_TCPDF_THROW_EXCEPTION_ERROR) {
|
||||
die('<strong>TCPDF ERROR: </strong>'.$msg);
|
||||
} else {
|
||||
throw new Exception('TCPDF ERROR: '.$msg);
|
||||
|
@ -1,9 +1,9 @@
|
||||
<?php
|
||||
//============================================================+
|
||||
// File name : tcpdf_parser.php
|
||||
// Version : 1.0.005
|
||||
// Version : 1.0.006
|
||||
// Begin : 2011-05-23
|
||||
// Last Update : 2013-09-14
|
||||
// Last Update : 2013-09-15
|
||||
// Author : Nicola Asuni - Tecnick.com LTD - 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.005
|
||||
* @version 1.0.006
|
||||
*/
|
||||
|
||||
// include class for decoding filters
|
||||
@ -639,7 +639,7 @@ class TCPDF_PARSER {
|
||||
$i = 0; // object main index
|
||||
do {
|
||||
// get element
|
||||
$element = $this->getRawObject($offset); print_r($element);//DEBUG
|
||||
$element = $this->getRawObject($offset);
|
||||
$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] == '<<')) {
|
||||
@ -721,7 +721,11 @@ class TCPDF_PARSER {
|
||||
$remaining_filters = array();
|
||||
foreach ($filters as $filter) {
|
||||
if (in_array($filter, $this->FilterDecoders->getAvailableFilters())) {
|
||||
try {
|
||||
$stream = $this->FilterDecoders->decodeFilter($filter, $stream);
|
||||
} catch (Exception $e) {
|
||||
$this->Error($e->getMessage());
|
||||
}
|
||||
} else {
|
||||
// add missing filter to array
|
||||
$remaining_filters[] = $filter;
|
||||
@ -731,14 +735,17 @@ class TCPDF_PARSER {
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is automatically called in case of fatal error; it simply outputs the message and halts the execution.
|
||||
* Throw an exception or print an error message and die if the K_TCPDF_PARSER_THROW_EXCEPTION_ERROR constant is set to true.
|
||||
* @param $msg (string) The error message
|
||||
* @public
|
||||
* @since 1.0.000 (2011-05-23)
|
||||
*/
|
||||
public function Error($msg) {
|
||||
// exit program and print error
|
||||
if (defined('K_TCPDF_PARSER_THROW_EXCEPTION_ERROR') AND !K_TCPDF_PARSER_THROW_EXCEPTION_ERROR) {
|
||||
die('<strong>TCPDF_PARSER ERROR: </strong>'.$msg);
|
||||
} else {
|
||||
throw new Exception('TCPDF_PARSER ERROR: '.$msg);
|
||||
}
|
||||
}
|
||||
|
||||
} // END OF TCPDF_PARSER CLASS
|
||||
|
Loading…
Reference in New Issue
Block a user