Fix: upgrade tcpdf and fpdi

This commit is contained in:
Regis Houssin 2012-08-29 09:55:32 +02:00
parent 70c467e429
commit 54860ef304
24 changed files with 3121 additions and 2563 deletions

View File

@ -13,12 +13,12 @@ Composant Version License Compatible GPL Usage
PHP libraries: PHP libraries:
AdoDb-Date 0.21 Modified BSD License Yes Date convertion (not into rpm package) AdoDb-Date 0.21 Modified BSD License Yes Date convertion (not into rpm package)
CKEditor 3.6.2 GPL or LGPL 2.1 or MPL 1.1 Yes Editor WYSIWYG CKEditor 3.6.2 GPL or LGPL 2.1 or MPL 1.1 Yes Editor WYSIWYG
FPDI 1.4.1 Apache Software License 2.0 ? PDF templates management FPDI 1.4.2 Apache Software License 2.0 No (GPLv3 only) PDF templates management (with FPDF_TPL 1.2)
GeoIP 2004 LGPL 2.1 Yes Sample code to make geoip convert (not into deb package) GeoIP 2004 LGPL 2.1 Yes Sample code to make geoip convert (not into deb package)
NuSoap 0.9.5 LGPL 2.1 Yes Library to develop SOAP Web services (not into rpm and deb package) NuSoap 0.9.5 LGPL 2.1 Yes Library to develop SOAP Web services (not into rpm and deb package)
OdtPHP 1.0.1 GPL 2.0 Yes Library to build/edit ODT files OdtPHP 1.0.1 GPL 2.0 Yes Library to build/edit ODT files
PHPExcel 1.7.6 LGPL 2.1 Yes Read/Write XLS files, read ODS files PHPExcel 1.7.6 LGPL 2.1 Yes Read/Write XLS files, read ODS files
TCPDF 5.9.156 LGPL 3.0 Yes PDF generation TCPDF 5.9.180 LGPL 3.0 Yes PDF generation
JS libraries: JS libraries:
jQuery 1.7.2 GPL and MIT Licence Yes JS library jQuery 1.7.2 GPL and MIT Licence Yes JS library
@ -29,7 +29,7 @@ jQuery Flot 0.7 MIT Licence Yes JS library to build graph
jQuery FileUpload 5.0.3 GPL and MIT Licence Yes JS library to upload files jQuery FileUpload 5.0.3 GPL and MIT Licence Yes JS library to upload files
jQuery JCrop 0.9.8 GPL and MIT Licence Yes JS library plugin Crop (to crop images) jQuery JCrop 0.9.8 GPL and MIT Licence Yes JS library plugin Crop (to crop images)
jQuery jeditable 1.7.1 GPL and MIT Licence Yes JS library plugin jeditable (to edit in place) jQuery jeditable 1.7.1 GPL and MIT Licence Yes JS library plugin jeditable (to edit in place)
jQuery jNotify 1.1.00 Apache Software License 2.0 ? JS library plugin jNotify (to use ajax popups) jQuery jNotify 1.1.00 Apache Software License 2.0 No (GPLv3 only) JS library plugin jNotify (to use ajax popups)
jQuery jPicker 1.1.00 GPL and MIT Licence Yes JS library for color picker with not defined list of colors jQuery jPicker 1.1.00 GPL and MIT Licence Yes JS library for color picker with not defined list of colors
jQuery Layout 1.3.0 GPL and MIT Licence Yes JS library plugin Layout (RC-29.15) jQuery Layout 1.3.0 GPL and MIT Licence Yes JS library plugin Layout (RC-29.15)
jQuery TableDnD 0.5 GPL and MIT Licence Yes JS library plugin TableDnD (to reorder table rows) jQuery TableDnD 0.5 GPL and MIT Licence Yes JS library plugin TableDnD (to reorder table rows)

View File

@ -1046,9 +1046,9 @@ function pdf_getlineupexcltax($object,$i,$outputlangs,$hidedetails=0,$hookmanage
global $conf; global $conf;
$sign=1; $sign=1;
if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
if (is_object($hookmanager) && ( ($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && !empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
{ {
$special_code = $object->lines[$i]->special_code; $special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);
@ -1250,7 +1250,7 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0,$hookman
global $conf; global $conf;
$sign=1; $sign=1;
if ($object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1; if (isset($object->type) && $object->type == 2 && ! empty($conf->global->INVOICE_POSITIVE_CREDIT_NOTE)) $sign=-1;
if ($object->lines[$i]->special_code == 3) if ($object->lines[$i]->special_code == 3)
{ {
@ -1258,7 +1258,7 @@ function pdf_getlinetotalexcltax($object,$i,$outputlangs,$hidedetails=0,$hookman
} }
else else
{ {
if (is_object($hookmanager) && ( ($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code) ) || ! empty($object->lines[$i]->fk_parent_line) ) ) if (is_object($hookmanager) && (($object->lines[$i]->product_type == 9 && ! empty($object->lines[$i]->special_code)) || ! empty($object->lines[$i]->fk_parent_line)))
{ {
$special_code = $object->lines[$i]->special_code; $special_code = $object->lines[$i]->special_code;
if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line); if (! empty($object->lines[$i]->fk_parent_line)) $special_code = $object->getSpecialCode($object->lines[$i]->fk_parent_line);

View File

@ -311,6 +311,10 @@ class pdf_azur extends ModelePDFPropales
if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*'; if (($object->lines[$i]->info_bits & 0x01) == 0x01) $vatrate.='*';
if (! isset($this->tva[$vatrate])) $this->tva[$vatrate]=0;
if (! isset($this->localtax1[$localtax1rate])) $this->localtax1[$localtax1rate]=0;
if (! isset($this->localtax2[$localtax2rate])) $this->localtax2[$localtax2rate]=0;
$this->tva[$vatrate] += $tvaligne; $this->tva[$vatrate] += $tvaligne;
$this->localtax1[$localtax1rate]+=$localtax1ligne; $this->localtax1[$localtax1rate]+=$localtax1ligne;
$this->localtax2[$localtax2rate]+=$localtax2ligne; $this->localtax2[$localtax2rate]+=$localtax2ligne;
@ -455,7 +459,7 @@ class pdf_azur extends ModelePDFPropales
} }
// Show shipping date // Show shipping date
if ($object->type != 2 && $object->date_livraison) if (isset($object->type) && $object->type != 2 && $object->date_livraison)
{ {
$outputlangs->load("sendings"); $outputlangs->load("sendings");
$pdf->SetFont('','B', $default_font_size - 2); $pdf->SetFont('','B', $default_font_size - 2);
@ -469,7 +473,7 @@ class pdf_azur extends ModelePDFPropales
$posy=$pdf->GetY()+1; $posy=$pdf->GetY()+1;
} }
elseif ($object->type != 2 && ($object->availability_code || $object->availability)) // Show availability conditions elseif (isset($object->type) && $object->type != 2 && ($object->availability_code || $object->availability)) // Show availability conditions
{ {
$pdf->SetFont('','B', $default_font_size - 2); $pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy); $pdf->SetXY($this->marge_gauche, $posy);
@ -486,7 +490,7 @@ class pdf_azur extends ModelePDFPropales
} }
// Show payments conditions // Show payments conditions
if ($object->type != 2 && ($object->cond_reglement_code || $object->cond_reglement)) if (isset($object->type) && $object->type != 2 && ($object->cond_reglement_code || $object->cond_reglement))
{ {
$pdf->SetFont('','B', $default_font_size - 2); $pdf->SetFont('','B', $default_font_size - 2);
$pdf->SetXY($this->marge_gauche, $posy); $pdf->SetXY($this->marge_gauche, $posy);
@ -503,7 +507,7 @@ class pdf_azur extends ModelePDFPropales
} }
if ($object->type != 2) if (isset($object->type) && $object->type != 2)
{ {
// Check a payment mode is defined // Check a payment mode is defined
if (empty($object->mode_reglement_code) if (empty($object->mode_reglement_code)
@ -632,7 +636,7 @@ class pdf_azur extends ModelePDFPropales
$this->atleastoneratenotnull=0; $this->atleastoneratenotnull=0;
if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT)) if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT))
{ {
$tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && is_float($this->tva['0.000'])) ? true : false); $tvaisnull=((! empty($this->tva) && count($this->tva) == 1 && isset($this->tva['0.000']) && is_float($this->tva['0.000'])) ? true : false);
if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull) if (! empty($conf->global->MAIN_GENERATE_DOCUMENTS_WITHOUT_VAT_ISNULL) && $tvaisnull)
{ {
// Nothing to do // Nothing to do
@ -1049,7 +1053,7 @@ class pdf_azur extends ModelePDFPropales
$carac_client_name=$outputlangs->convToOutputCharset($object->client->nom); $carac_client_name=$outputlangs->convToOutputCharset($object->client->nom);
} }
$carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,$object->contact,$usecontact,'target'); $carac_client=pdf_build_address($outputlangs,$this->emetteur,$object->client,(! empty($object->contact)?$object->contact:''),$usecontact,'target');
// Show recipient // Show recipient
$posy=42; $posy=42;

View File

@ -1,6 +1,6 @@
<?php <?php
// //
// FPDI - Version 1.4.1 // FPDI - Version 1.4.2
// //
// Copyright 2004-2011 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //
@ -51,7 +51,7 @@ if (!class_exists('FilterASCII85', false)) {
continue; continue;
} }
if ($ch == ORD_z && $state == 0) { if ($ch == ORD_z && $state == 0) {
$out .= chr(0).chr(0).chr(0).chr(0); $out .= chr(0) . chr(0) . chr(0) . chr(0);
continue; continue;
} }
if ($ch < ORD_exclmark || $ch > ORD_u) { if ($ch < ORD_exclmark || $ch > ORD_u) {

View File

@ -1,6 +1,6 @@
<?php <?php
// //
// FPDI - Version 1.4.1 // FPDI - Version 1.4.2
// //
// Copyright 2004-2011 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //

View File

@ -1,6 +1,6 @@
<?php <?php
// //
// FPDI - Version 1.4.1 // FPDI - Version 1.4.2
// //
// Copyright 2004-2011 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //
@ -86,7 +86,7 @@ if (!class_exists('FilterLZW', false)) {
$oldCode = $code; $oldCode = $code;
} else { } else {
$string = $this->sTable[$oldCode]; $string = $this->sTable[$oldCode];
$string = $string.$string[0]; $string = $string . $string[0];
$uncompData .= $string; $uncompData .= $string;
$this->addStringToTable($string); $this->addStringToTable($string);

View File

@ -1,6 +1,6 @@
<?php <?php
// //
// FPDI - Version 1.4.1 // FPDI - Version 1.4.2
// //
// Copyright 2004-2011 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //

View File

@ -1,6 +1,6 @@
<?php <?php
// //
// FPDI - Version 1.4.1 // FPDI - Version 1.4.2
// //
// Copyright 2004-2011 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //
@ -17,7 +17,7 @@
// limitations under the License. // limitations under the License.
// //
define('FPDI_VERSION', '1.4.1'); define('FPDI_VERSION', '1.4.2');
// Check for TCPDF and remap TCPDF to FPDF // Check for TCPDF and remap TCPDF to FPDF
if (class_exists('TCPDF', false)) { if (class_exists('TCPDF', false)) {
@ -144,6 +144,7 @@ class FPDI extends FPDF_TPL {
if (!in_array($boxName, $parser->availableBoxes)) if (!in_array($boxName, $parser->availableBoxes))
return $this->Error(sprintf('Unknown box: %s', $boxName)); return $this->Error(sprintf('Unknown box: %s', $boxName));
$pageboxes = $parser->getPageBoxes($pageno, $this->k); $pageboxes = $parser->getPageBoxes($pageno, $this->k);
/** /**
@ -160,6 +161,7 @@ class FPDI extends FPDF_TPL {
if (!isset($pageboxes[$boxName])) if (!isset($pageboxes[$boxName]))
return false; return false;
$this->lastUsedPageBox = $boxName; $this->lastUsedPageBox = $boxName;
$box = $pageboxes[$boxName]; $box = $pageboxes[$boxName];
@ -201,26 +203,47 @@ class FPDI extends FPDF_TPL {
return $this->tpl; return $this->tpl;
} }
/**
* Returns the last used page box
*
* @return string
*/
function getLastUsedPageBox() { function getLastUsedPageBox() {
return $this->lastUsedPageBox; return $this->lastUsedPageBox;
} }
function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0, $adjustPageSize = false) { function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0, $adjustPageSize = false) {
if ($adjustPageSize == true && is_null($_x) && is_null($_y)) { if ($adjustPageSize == true && is_null($_x) && is_null($_y)) {
$size = $this->getTemplateSize($tplidx, $_w, $_h); $size = $this->getTemplateSize($tplidx, $_w, $_h);
$format = array($size['w'], $size['h']); $orientation = $size['w'] > $size['h'] ? 'L' : 'P';
$size = array($size['w'], $size['h']);
if (is_subclass_of($this, 'TCPDF')) { if (is_subclass_of($this, 'TCPDF')) {
$this->setPageFormat($format, $format[0] > $format[1] ? 'L' : 'P'); $this->setPageFormat($size, $orientation);
} else { } else {
if ($format[0] != $this->CurPageFormat[0] || $format[1] != $this->CurPageFormat[1]) { $size = $this->_getpagesize($size);
$this->w = $format[0];
$this->h = $format[1]; if($orientation!=$this->CurOrientation || $size[0]!=$this->CurPageSize[0] || $size[1]!=$this->CurPageSize[1])
$this->wPt = $this->w * $this->k; {
$this->hPt = $this->h * $this->k; // New size or orientation
$this->PageBreakTrigger = $this->h - $this->bMargin; if($orientation=='P')
$this->CurPageFormat = $format; {
$this->PageSizes[$this->page] = array($this->wPt, $this->hPt); $this->w = $size[0];
} $this->h = $size[1];
}
else
{
$this->w = $size[1];
$this->h = $size[0];
}
$this->wPt = $this->w*$this->k;
$this->hPt = $this->h*$this->k;
$this->PageBreakTrigger = $this->h-$this->bMargin;
$this->CurOrientation = $orientation;
$this->CurPageSize = $size;
$this->PageSizes[$this->page] = array($this->wPt, $this->hPt);
}
} }
} }
@ -314,8 +337,8 @@ class FPDI extends FPDF_TPL {
} }
} }
} else if ($tpl['x'] != 0 || $tpl['y'] != 0) { } else if ($tpl['x'] != 0 || $tpl['y'] != 0) {
$tx = -$tpl['x']*2; $tx = -$tpl['x'] * 2;
$ty = $tpl['y']*2; $ty = $tpl['y'] * 2;
} }
$tx *= $this->k; $tx *= $this->k;
@ -359,8 +382,14 @@ class FPDI extends FPDF_TPL {
$nN = $this->n; // TCPDF: rem new "n" $nN = $this->n; // TCPDF: rem new "n"
$this->n = $cN; // TCPDF: reset to current "n" $this->n = $cN; // TCPDF: reset to current "n"
$this->_out('/Length ' . strlen($p) . ' >>'); if (is_subclass_of($this, 'TCPDF')) {
$this->_putstream($p); $p = $this->_getrawstream($p);
$this->_out('/Length ' . strlen($p) . ' >>');
$this->_out("stream\n" . $p . "\nendstream");
} else {
$this->_out('/Length ' . strlen($p) . ' >>');
$this->_putstream($p);
}
$this->_out('endobj'); $this->_out('endobj');
$this->n = $nN; // TCPDF: reset to new "n" $this->n = $nN; // TCPDF: reset to new "n"
} }

View File

@ -1,6 +1,6 @@
<?php <?php
// //
// FPDI - Version 1.4.1 // FPDI - Version 1.4.2
// //
// Copyright 2004-2011 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //
@ -53,21 +53,25 @@ class FPDF extends TCPDF {
case PDF_TYPE_STRING: case PDF_TYPE_STRING:
if ($this->encrypted) { if ($this->encrypted) {
$value[1] = $this->_unescape($value[1]); $value[1] = $this->_unescape($value[1]);
$value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]); $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]);
$value[1] = $this->_escape($value[1]); $value[1] = $this->_escape($value[1]);
} }
break; break;
case PDF_TYPE_STREAM: case PDF_TYPE_STREAM:
if ($this->encrypted) { if ($this->encrypted) {
$value[2][1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[2][1]); $value[2][1] = $this->_encrypt_data($this->_current_obj_id, $value[2][1]);
$value[1][1]['/Length'] = array(
PDF_TYPE_NUMERIC,
strlen($value[2][1])
);
} }
break; break;
case PDF_TYPE_HEX: case PDF_TYPE_HEX:
if ($this->encrypted) { if ($this->encrypted) {
$value[1] = $this->hex2str($value[1]); $value[1] = $this->hex2str($value[1]);
$value[1] = $this->_RC4($this->_objectkey($this->_current_obj_id), $value[1]); $value[1] = $this->_encrypt_data($this->_current_obj_id, $value[1]);
// remake hexstring of encrypted string // remake hexstring of encrypted string
$value[1] = $this->str2hex($value[1]); $value[1] = $this->str2hex($value[1]);

View File

@ -1,6 +1,6 @@
<?php <?php
// //
// FPDI - Version 1.4.1 // FPDI - Version 1.4.2
// //
// Copyright 2004-2011 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //
@ -288,14 +288,14 @@ class fpdi_pdf_parser extends pdf_parser {
if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) { if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) {
$b =& $box[1]; $b =& $box[1];
return array('x' => $b[0][1]/$k, return array('x' => $b[0][1] / $k,
'y' => $b[1][1]/$k, 'y' => $b[1][1] / $k,
'w' => abs($b[0][1]-$b[2][1])/$k, 'w' => abs($b[0][1] - $b[2][1]) / $k,
'h' => abs($b[1][1]-$b[3][1])/$k, 'h' => abs($b[1][1] - $b[3][1]) / $k,
'llx' => min($b[0][1], $b[2][1])/$k, 'llx' => min($b[0][1], $b[2][1]) / $k,
'lly' => min($b[1][1], $b[3][1])/$k, 'lly' => min($b[1][1], $b[3][1]) / $k,
'urx' => max($b[0][1], $b[2][1])/$k, 'urx' => max($b[0][1], $b[2][1]) / $k,
'ury' => max($b[1][1], $b[3][1])/$k, 'ury' => max($b[1][1], $b[3][1]) / $k,
); );
} else if (!isset ($page[1][1]['/Parent'])) { } else if (!isset ($page[1][1]['/Parent'])) {
return false; return false;
@ -312,7 +312,7 @@ class fpdi_pdf_parser extends pdf_parser {
* @return array * @return array
*/ */
function getPageBoxes($pageno, $k) { function getPageBoxes($pageno, $k) {
return $this->_getPageBoxes($this->pages[$pageno-1], $k); return $this->_getPageBoxes($this->pages[$pageno - 1], $k);
} }
/** /**
@ -340,7 +340,7 @@ class fpdi_pdf_parser extends pdf_parser {
* @return array * @return array
*/ */
function getPageRotation($pageno) { function getPageRotation($pageno) {
return $this->_getPageRotation($this->pages[$pageno-1]); return $this->_getPageRotation($this->pages[$pageno - 1]);
} }
function _getPageRotation($obj) { // $obj = /Page function _getPageRotation($obj) { // $obj = /Page
@ -405,5 +405,4 @@ class fpdi_pdf_parser extends pdf_parser {
parent::getPDFVersion(); parent::getPDFVersion();
$this->fpdi->setPDFVersion(max($this->fpdi->getPDFVersion(), $this->pdfVersion)); $this->fpdi->setPDFVersion(max($this->fpdi->getPDFVersion(), $this->pdfVersion));
} }
} }

View File

@ -1,6 +1,6 @@
<?php <?php
// //
// FPDI - Version 1.4.1 // FPDI - Version 1.4.2
// //
// Copyright 2004-2011 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //

View File

@ -1,6 +1,6 @@
<?php <?php
// //
// FPDI - Version 1.4.1 // FPDI - Version 1.4.2
// //
// Copyright 2004-2011 Setasign - Jan Slabon // Copyright 2004-2011 Setasign - Jan Slabon
// //
@ -137,7 +137,7 @@ if (!class_exists('pdf_parser', false)) {
* @param string $msg Error-Message * @param string $msg Error-Message
*/ */
function error($msg) { function error($msg) {
die('<b>PDF-Parser Error:</b> '.$msg); die('<b>PDF-Parser Error:</b> ' . $msg);
} }
/** /**
@ -177,7 +177,7 @@ if (!class_exists('pdf_parser', false)) {
*/ */
function getPDFVersion() { function getPDFVersion() {
fseek($this->f, 0); fseek($this->f, 0);
preg_match('/\d\.\d/',fread($this->f,16),$m); preg_match('/\d\.\d/',fread($this->f, 16), $m);
if (isset($m[0])) if (isset($m[0]))
$this->pdfVersion = $m[0]; $this->pdfVersion = $m[0];
return $this->pdfVersion; return $this->pdfVersion;
@ -232,17 +232,17 @@ if (!class_exists('pdf_parser', false)) {
} }
if (!isset($result['xref_location'])) { if (!isset($result['xref_location'])) {
$result['xref_location'] = $o_pos+$xrefPos; $result['xref_location'] = $o_pos + $xrefPos;
$result['max_object'] = 0; $result['max_object'] = 0;
} }
$cylces = -1; $cylces = -1;
$bytesPerCycle = 100; $bytesPerCycle = 100;
fseek($this->f, $o_pos = $o_pos+$xrefPos+4); // set the handle directly after the "xref"-keyword fseek($this->f, $o_pos = $o_pos + $xrefPos + 4); // set the handle directly after the "xref"-keyword
$data = fread($this->f, $bytesPerCycle); $data = fread($this->f, $bytesPerCycle);
while (($trailerPos = strpos($data, 'trailer', max($bytesPerCycle*$cylces++, 0))) === false && !feof($this->f)) { while (($trailerPos = strpos($data, 'trailer', max($bytesPerCycle * $cylces++, 0))) === false && !feof($this->f)) {
$data .= fread($this->f, $bytesPerCycle); $data .= fread($this->f, $bytesPerCycle);
} }
@ -277,7 +277,7 @@ if (!class_exists('pdf_parser', false)) {
switch($c) { switch($c) {
case 2: case 2:
$start = (int)$pieces[0]; $start = (int)$pieces[0];
$end = $start+(int)$pieces[1]; $end = $start + (int)$pieces[1];
if ($end > $result['max_object']) if ($end > $result['max_object'])
$result['max_object'] = $end; $result['max_object'] = $end;
break; break;
@ -299,7 +299,7 @@ if (!class_exists('pdf_parser', false)) {
$lines = $pieces = $line = $start = $end = $gen = null; $lines = $pieces = $line = $start = $end = $gen = null;
unset($lines, $pieces, $line, $start, $end, $gen); unset($lines, $pieces, $line, $start, $end, $gen);
fseek($this->f, $o_pos+$trailerPos+7); fseek($this->f, $o_pos + $trailerPos + 7);
$c = new pdf_context($this->f); $c = new pdf_context($this->f);
$trailer = $this->pdf_read_value($c); $trailer = $this->pdf_read_value($c);
@ -460,12 +460,12 @@ if (!class_exists('pdf_parser', false)) {
} }
if ($length > 0) { if ($length > 0) {
$c->reset($startpos+$e,$length); $c->reset($startpos + $e,$length);
$v = $c->buffer; $v = $c->buffer;
} else { } else {
$v = ''; $v = '';
} }
$c->reset($startpos+$e+$length+9); // 9 = strlen("endstream") $c->reset($startpos + $e + $length + 9); // 9 = strlen("endstream")
return array(PDF_TYPE_STREAM, $v); return array(PDF_TYPE_STREAM, $v);
@ -483,9 +483,9 @@ if (!class_exists('pdf_parser', false)) {
// Determine the case and return the data // Determine the case and return the data
if (($tok3 = $this->pdf_read_token ($c)) !== false) { if (($tok3 = $this->pdf_read_token ($c)) !== false) {
switch ($tok3) { switch ($tok3) {
case 'obj' : case 'obj':
return array (PDF_TYPE_OBJDEC, (int) $token, (int) $tok2); return array (PDF_TYPE_OBJDEC, (int) $token, (int) $tok2);
case 'R' : case 'R':
return array (PDF_TYPE_OBJREF, (int) $token, (int) $tok2); return array (PDF_TYPE_OBJREF, (int) $token, (int) $tok2);
} }
// If we get to this point, that numeric value up // If we get to this point, that numeric value up
@ -548,8 +548,8 @@ if (!class_exists('pdf_parser', false)) {
$header = $this->pdf_read_value($c); $header = $this->pdf_read_value($c);
if ($header[0] != PDF_TYPE_OBJDEC || $header[1] != $obj_spec[1] || $header[2] != $obj_spec[2]) { if ($header[0] != PDF_TYPE_OBJDEC || $header[1] != $obj_spec[1] || $header[2] != $obj_spec[2]) {
$toSearchFor = $obj_spec[1].' '.$obj_spec[2].' obj'; $toSearchFor = $obj_spec[1] . ' ' . $obj_spec[2] . ' obj';
if (preg_match('/'.$toSearchFor.'/', $c->buffer)) { if (preg_match('/' . $toSearchFor . '/', $c->buffer)) {
$c->offset = strpos($c->buffer, $toSearchFor) + strlen($toSearchFor); $c->offset = strpos($c->buffer, $toSearchFor) + strlen($toSearchFor);
// reset stack // reset stack
$c->stack = array(); $c->stack = array();

View File

@ -1,9 +1,9 @@
<?php <?php
//============================================================+ //============================================================+
// File name : 2dbarcodes.php // File name : 2dbarcodes.php
// Version : 1.0.013 // Version : 1.0.014
// Begin : 2009-04-07 // Begin : 2009-04-07
// Last Update : 2012-01-12 // Last Update : 2012-04-30
// Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - info@tecnick.com // Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - 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)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -37,14 +37,14 @@
* PHP class to creates array representations for 2D barcodes to be used with TCPDF. * PHP class to creates array representations for 2D barcodes to be used with TCPDF.
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @author Nicola Asuni * @author Nicola Asuni
* @version 1.0.013 * @version 1.0.014
*/ */
/** /**
* @class TCPDF2DBarcode * @class TCPDF2DBarcode
* PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www.tcpdf.org). * PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www.tcpdf.org).
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @version 1.0.013 * @version 1.0.014
* @author Nicola Asuni * @author Nicola Asuni
*/ */
class TCPDF2DBarcode { class TCPDF2DBarcode {
@ -202,9 +202,9 @@ class TCPDF2DBarcode {
if ($this->barcode_array['bcode'][$r][$c] == 1) { if ($this->barcode_array['bcode'][$r][$c] == 1) {
// draw a single barcode cell // draw a single barcode cell
if ($imagick) { if ($imagick) {
$bar->rectangle($x, $y, ($x + $w), ($y + $h)); $bar->rectangle($x, $y, ($x + $w - 1), ($y + $h - 1));
} else { } else {
imagefilledrectangle($png, $x, $y, ($x + $w), ($y + $h), $fgcol); imagefilledrectangle($png, $x, $y, ($x + $w - 1), ($y + $h - 1), $fgcol);
} }
} }
$x += $w; $x += $w;

View File

@ -1,3 +1,94 @@
5.9.180 (2012-08-22)
- Bug item #3560493 "Problems with nested cells in HTML" was fixed.
5.9.179 (2012-08-04)
- SVG 'use' tag was fixed for 'circle' and 'ellipse' shift problem.
- Alpha status is now correctly stored and restored by getGraphicVars() and SetGraphicVars() methods.
5.9.178 (2012-08-02)
- SVG 'use' tag was fixed for 'circle' and 'ellipse'.
5.9.177 (2012-08-02)
- An additional control on annotations was fixed.
5.9.176 (2012-07-25)
- A bug related to stroke width was fixed.
- A problem related to font spacing in HTML was fixed.
5.9.175 (2012-07-25)
- The problem of missing letter on hyphen break was fixed.
5.9.174 (2012-07-25)
- The problem of wrong filename when downloading PDF from an Android device was fixed.
- The method setHeaderData() was extended to set text and line color for header (see example n. 1).
- The method setFooterData() was added to set text and line color for footer (see example n. 1).
- The methods setTextShadow() and getTextShadow() were added to set text shadows (see example n. 1).
- The GetCharWidth() method was fixed for negative character spacing.
- A 'none' border mode is now correctly recognized.
- Break on hyphen problem was fixed.
5.9.173 (2012-07-23)
- Some additional control wher added on barcode methods.
- The option CURLOPT_FOLLOWLOCATION on Image method is now disabled if PHP safe_mode is on or open_basedir is set.
- Method Bookmark() was extended to include X parameter.
- Method setDestination() was extended to include X parameter.
- A problem with Thai language was fixed.
5.9.172 (2012-07-02)
- A PNG color profile issue was fixed.
5.9.171 (2012-07-01)
- Some SVG rendering problems were fixed.
5.9.170 (2012-06-27)
- Bug #3538227 "Numerous errors inserting shared images" was fixed.
5.9.169 (2012-06-25)
- Some SVG rendering problems were fixed.
5.9.168 (2012-06-22)
- Thai language rendering was fixed.
5.9.167 (2012-06-22)
- Thai language rendering was fixed and improved.
- Method isCharDefined() was improved.
- Protected method replaceChar() was added.
- Font "kerning" word was corrected to "tracking".
5.9.166 (2012-06-21)
- Array to string conversion on file_id creation was fixed.
- Thai language rendering was fixed (thanks to Atsawin Chaowanakritsanakul).
5.9.165 (2012-06-07)
- Some HTML form related bugs were fixed.
5.9.164 (2012-06-06)
- A bug introduced on the latest release was fixed.
5.9.163 (2012-06-05)
- Method getGDgamma() was changed.
- Rendering performances of PNG images with alpha channel were improved.
5.9.162 (2012-05-11)
- A bug related to long text on TD cells was fixed.
5.9.161 (2012-05-09)
- A bug on XREF table was fixed (Bug ID: 3525051).
- Deprecated Imagick:clone was replaced.
- Method objclone() was fixed for PHP4.
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).
5.9.158 (2012-04-22)
- Some SVG-related bugs were fixed.
5.9.157 (2012-04-16)
- Some SVG-related bugs were fixed.
5.9.156 (2012-04-10) 5.9.156 (2012-04-10)
- Bug item #3515885 "TOC and booklet: left and right page exchanged". - Bug item #3515885 "TOC and booklet: left and right page exchanged".
- SetAutoPageBreak(false) now works also in multicolumn mode. - SetAutoPageBreak(false) now works also in multicolumn mode.
@ -567,7 +658,7 @@
- The problem of blank page for nobr table higher than a single page was fixed. - The problem of blank page for nobr table higher than a single page was fixed.
5.9.000 (2010-10-06) 5.9.000 (2010-10-06)
- Support for text stretching and spacing (kerning) was added, see example n. 63 and methods setFontStretching(), getFontStretching(), setFontSpacing(), getFontSpacing(). - Support for text stretching and spacing (tracking) was added, see example n. 63 and methods setFontStretching(), getFontStretching(), setFontSpacing(), getFontSpacing().
- Support for CSS properties 'font-stretch' and 'letter-spacing' was added (see example n. 63). - Support for CSS properties 'font-stretch' and 'letter-spacing' was added (see example n. 63).
- The cMargin state was replaced by cell_padding array that can be set/get using setCellPadding() and getCellPadding() methods. - The cMargin state was replaced by cell_padding array that can be set/get using setCellPadding() and getCellPadding() methods.
- Methods getCellPaddings() and setCellPaddings() were added to fine tune cell paddings (see example n. 5). - Methods getCellPaddings() and setCellPaddings() were added to fine tune cell paddings (see example n. 5).

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------ ------------------------------------------------------------
Name: TCPDF Name: TCPDF
Version: 5.9.156 Version: 5.9.180
Release date: 2012-04-10 Release date: 2012-08-22
Author: Nicola Asuni Author: Nicola Asuni
Copyright (c) 2002-2012: Copyright (c) 2002-2012:
@ -47,7 +47,7 @@ Main Features:
* no-write page regions; * no-write page regions;
* bookmarks, named destinations and table of content; * bookmarks, named destinations and table of content;
* text hyphenation; * text hyphenation;
* text stretching and spacing (tracking/kerning); * text stretching and spacing (tracking);
* automatic page break, line break and text alignments including justification; * automatic page break, line break and text alignments including justification;
* automatic page numbering and page groups; * automatic page numbering and page groups;
* move and delete pages; * move and delete pages;

View File

@ -1,9 +1,9 @@
<?php <?php
//============================================================+ //============================================================+
// File name : barcodes.php // File name : barcodes.php
// Version : 1.0.023 // Version : 1.0.024
// Begin : 2008-06-09 // Begin : 2008-06-09
// Last Update : 2012-01-14 // Last Update : 2012-04-30
// Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - info@tecnick.com // Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - 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)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -37,14 +37,14 @@
* PHP class to creates array representations for common 1D barcodes to be used with TCPDF. * PHP class to creates array representations for common 1D barcodes to be used with TCPDF.
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @author Nicola Asuni * @author Nicola Asuni
* @version 1.0.023 * @version 1.0.024
*/ */
/** /**
* @class TCPDFBarcode * @class TCPDFBarcode
* PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www.tcpdf.org).<br> * PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www.tcpdf.org).<br>
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @version 1.0.023 * @version 1.0.024
* @author Nicola Asuni * @author Nicola Asuni
*/ */
class TCPDFBarcode { class TCPDFBarcode {
@ -201,9 +201,9 @@ class TCPDFBarcode {
$y = round(($v['p'] * $h / $this->barcode_array['maxh']), 3); $y = round(($v['p'] * $h / $this->barcode_array['maxh']), 3);
// draw a vertical bar // draw a vertical bar
if ($imagick) { if ($imagick) {
$bar->rectangle($x, $y, ($x + $bw), ($y + $bh)); $bar->rectangle($x, $y, ($x + $bw - 1), ($y + $bh - 1));
} else { } else {
imagefilledrectangle($png, $x, $y, ($x + $bw), ($y + $bh), $fgcol); imagefilledrectangle($png, $x, $y, ($x + $bw - 1), ($y + $bh - 1), $fgcol);
} }
} }
$x += $bw; $x += $bw;

View File

@ -2,7 +2,7 @@
//============================================================+ //============================================================+
// File name : rus.php // File name : rus.php
// Begin : 2004-03-03 // Begin : 2004-03-03
// Last Update : 2010-10-26 // Last Update : 2012-07-25
// //
// Description : Language module for TCPDF // Description : Language module for TCPDF
// (contains translated texts) // (contains translated texts)
@ -40,7 +40,7 @@ $l['a_meta_dir'] = 'ltr';
$l['a_meta_language'] = 'ru'; $l['a_meta_language'] = 'ru';
// TRANSLATIONS -------------------------------------- // TRANSLATIONS --------------------------------------
$l['w_page'] = 'страницы'; $l['w_page'] = 'страница';
//============================================================+ //============================================================+
// END OF FILE // END OF FILE

View File

@ -0,0 +1,47 @@
<?php
//============================================================+
// File name : ukr.php
// Begin : 2004-03-03
// Last Update : 2012-07-25
//
// Description : Language module for TCPDF
// (contains translated texts)
// Ukrainian
//
// Author: Nicola Asuni
//
// (c) Copyright:
// Nicola Asuni
// Tecnick.com LTD
// Manor Coach House, Church Hill
// Aldershot, Hants, GU12 4RQ
// UK
// www.tecnick.com
// info@tecnick.com
//============================================================+
/**
* TCPDF language file (contains translated texts).
* @package com.tecnick.tcpdf
* @brief TCPDF language file: Ukrainian
* @author Nicola Asuni
* @since 2004-03-03
*/
// Russian
global $l;
$l = Array();
// PAGE META DESCRIPTORS --------------------------------------
$l['a_meta_charset'] = 'UTF-8';
$l['a_meta_dir'] = 'ltr';
$l['a_meta_language'] = 'ua';
// TRANSLATIONS --------------------------------------
$l['w_page'] = 'сторінка';
//============================================================+
// END OF FILE
//============================================================+

View File

@ -91,16 +91,12 @@ if (!defined('K_TCPDF_EXTERNAL_CONFIG')) {
/** /**
* cache directory for temporary files (full path) * cache directory for temporary files (full path)
*/ */
// define ('K_PATH_CACHE', K_PATH_MAIN.'cache/'); define ('K_PATH_CACHE', K_PATH_MAIN.'cache/');
define ('K_PATH_CACHE', DOL_DATA_ROOT.'/admin/temp/');
dol_mkdir(K_PATH_CACHE);
/** /**
* cache directory for temporary files (url path) * cache directory for temporary files (url path)
*/ */
// define ('K_PATH_URL_CACHE', K_PATH_URL.'cache/'); define ('K_PATH_URL_CACHE', K_PATH_URL.'cache/');
define ('K_PATH_URL_CACHE', DOL_DATA_ROOT.'/admin/temp/');
dol_mkdir(K_PATH_URL_CACHE);
/** /**
*images directory *images directory

View File

@ -1,9 +1,9 @@
<?php <?php
//============================================================+ //============================================================+
// File name : qrcode.php // File name : qrcode.php
// Version : 1.0.009 // Version : 1.0.010
// Begin : 2010-03-22 // Begin : 2010-03-22
// Last Update : 2010-12-16 // Last Update : 2012-07-25
// Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - www.tecnick.com - info@tecnick.com // Author : Nicola Asuni - Tecnick.com LTD - Manor Coach House, Church Hill, Aldershot, Hants, GU12 4RQ, UK - 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)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -76,7 +76,7 @@
* *
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @author Nicola Asuni * @author Nicola Asuni
* @version 1.0.009 * @version 1.0.010
*/ */
// definitions // definitions
@ -286,7 +286,7 @@ if (!function_exists('str_split')) {
* *
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @author Nicola Asuni * @author Nicola Asuni
* @version 1.0.009 * @version 1.0.010
*/ */
class QRcode { class QRcode {
@ -1439,12 +1439,10 @@ class QRcode {
/** /**
* splitString * splitString
* @return (int)
*/ */
protected function splitString() { protected function splitString() {
while (strlen($this->dataStr) > 0) { while (strlen($this->dataStr) > 0) {
if ($this->dataStr == '') {
return 0;
}
$mode = $this->identifyMode(0); $mode = $this->identifyMode(0);
switch ($mode) { switch ($mode) {
case QR_MODE_NM: { case QR_MODE_NM: {
@ -1476,6 +1474,7 @@ class QRcode {
} }
$this->dataStr = substr($this->dataStr, $length); $this->dataStr = substr($this->dataStr, $length);
} }
return 0;
} }
/** /**
@ -2028,7 +2027,7 @@ class QRcode {
if ($ver > $this->version) { if ($ver > $this->version) {
$this->version = $ver; $this->version = $ver;
} }
for (;;) { while (true) {
$cbs = $this->createBitStream($items); $cbs = $this->createBitStream($items);
$items = $cbs[0]; $items = $cbs[0];
$bits = $cbs[1]; $bits = $cbs[1];
@ -2315,17 +2314,18 @@ class QRcode {
/** /**
* Return a version number that satisfies the input code length. * Return a version number that satisfies the input code length.
* @param $size (int) input code length (byte) * @param $size (int) input code length (bytes)
* @param $level (int) error correction level * @param $level (int) error correction level
* @return int version number * @return int version number
*/ */
protected function getMinimumVersion($size, $level) { protected function getMinimumVersion($size, $level) {
for ($i=1; $i <= QRSPEC_VERSION_MAX; ++$i) { for ($i = 1; $i <= QRSPEC_VERSION_MAX; ++$i) {
$words = $this->capacity[$i][QRCAP_WORDS] - $this->capacity[$i][QRCAP_EC][$level]; $words = ($this->capacity[$i][QRCAP_WORDS] - $this->capacity[$i][QRCAP_EC][$level]);
if ($words >= $size) { if ($words >= $size) {
return $i; return $i;
} }
} }
// the size of input data is greater than QR capacity, try to lover the error correction mode
return -1; return -1;
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,9 @@
<?php <?php
//============================================================+ //============================================================+
// File name : tcpdf_parser.php // File name : tcpdf_parser.php
// Version : 1.0.000 // Version : 1.0.001
// Begin : 2011-05-23 // 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 // 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 // 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.000 * @version 1.0.001
*/ */
// include class for decoding filters // 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> * 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.000 * @version 1.0.001
* @author Nicola Asuni - info@tecnick.com * @author Nicola Asuni - info@tecnick.com
*/ */
class TCPDF_PARSER { class TCPDF_PARSER {
@ -127,20 +127,29 @@ class TCPDF_PARSER {
* @since 1.0.000 (2011-05-24) * @since 1.0.000 (2011-05-24)
*/ */
protected function getXrefData($offset=0, $xref=array()) { protected function getXrefData($offset=0, $xref=array()) {
// find last startxref if ($offset == 0) {
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) { // find last startxref
$this->Error('Unable to find 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 // check xref position
if (strpos($this->pdfdata, 'xref', $startxref) != $startxref) { if (strpos($this->pdfdata, 'xref', $startxref) != $startxref) {
$this->Error('Unable to find xref'); $this->Error('Unable to find xref');
} }
// extract xref data (object indexes and offsets) // extract xref data (object indexes and offsets)
$offset = $startxref + 5; $xoffset = $startxref + 5;
// initialize object number // initialize object number
$obj_num = 0; $obj_num = 0;
$offset = $xoffset;
while (preg_match('/^([0-9]+)[\s]([0-9]+)[\s]?([nf]?)/im', $this->pdfdata, $matches, PREG_OFFSET_CAPTURE, $offset) > 0) { 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]); $offset = (strlen($matches[0][0]) + $matches[0][1]);
if ($matches[3][0] == 'n') { if ($matches[3][0] == 'n') {
@ -162,7 +171,7 @@ class TCPDF_PARSER {
} }
} }
// get trailer data // 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]; $trailer_data = $matches[1][0];
if (!isset($xref['trailer'])) { if (!isset($xref['trailer'])) {
// get only the last updated version // 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) { if (preg_match('/Prev[\s]+([0-9]+)/i', $trailer_data, $matches) > 0) {
// get previous xref // get previous xref
$xref = getXrefData(substr($this->pdfdata, 0, $startxref), intval($matches[1]), $xref); $xref = $this->getXrefData(intval($matches[1]), $xref);
} }
} else { } else {
$this->Error('Unable to find trailer'); $this->Error('Unable to find trailer');
@ -399,7 +408,7 @@ class TCPDF_PARSER {
$offset = $element[2]; $offset = $element[2];
// decode stream using stream's dictionary information // decode stream using stream's dictionary information
if ($decoding AND ($element[0] == 'stream') AND (isset($objdata[($i - 1)][0])) AND ($objdata[($i - 1)][0] == '<<')) { 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; $objdata[$i] = $element;
++$i; ++$i;