Fix: upgrade tcpdf and fpdi
This commit is contained in:
parent
70c467e429
commit
54860ef304
@ -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)
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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) {
|
||||||
|
|||||||
@ -1,33 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
//
|
//
|
||||||
// FPDI - Version 1.4.1
|
// FPDI - Version 1.4.2
|
||||||
//
|
//
|
||||||
// Copyright 2004-2011 Setasign - Jan Slabon
|
// Copyright 2004-2011 Setasign - Jan Slabon
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
require_once('FilterASCII85.php');
|
require_once('FilterASCII85.php');
|
||||||
|
|
||||||
class FilterASCII85_FPDI extends FilterASCII85 {
|
class FilterASCII85_FPDI extends FilterASCII85 {
|
||||||
|
|
||||||
var $fpdi;
|
var $fpdi;
|
||||||
|
|
||||||
function FilterASCII85_FPDI(&$fpdi) {
|
function FilterASCII85_FPDI(&$fpdi) {
|
||||||
$this->fpdi =& $fpdi;
|
$this->fpdi =& $fpdi;
|
||||||
}
|
}
|
||||||
|
|
||||||
function error($msg) {
|
function error($msg) {
|
||||||
$this->fpdi->error($msg);
|
$this->fpdi->error($msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -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);
|
||||||
|
|||||||
@ -1,33 +1,33 @@
|
|||||||
<?php
|
<?php
|
||||||
//
|
//
|
||||||
// FPDI - Version 1.4.1
|
// FPDI - Version 1.4.2
|
||||||
//
|
//
|
||||||
// Copyright 2004-2011 Setasign - Jan Slabon
|
// Copyright 2004-2011 Setasign - Jan Slabon
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
require_once('FilterLZW.php');
|
require_once('FilterLZW.php');
|
||||||
|
|
||||||
class FilterLZW_FPDI extends FilterLZW {
|
class FilterLZW_FPDI extends FilterLZW {
|
||||||
|
|
||||||
var $fpdi;
|
var $fpdi;
|
||||||
|
|
||||||
function FilterLZW_FPDI(&$fpdi) {
|
function FilterLZW_FPDI(&$fpdi) {
|
||||||
$this->fpdi =& $fpdi;
|
$this->fpdi =& $fpdi;
|
||||||
}
|
}
|
||||||
|
|
||||||
function error($msg) {
|
function error($msg) {
|
||||||
$this->fpdi->error($msg);
|
$this->fpdi->error($msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,449 +1,449 @@
|
|||||||
<?php
|
<?php
|
||||||
//
|
//
|
||||||
// FPDF_TPL - Version 1.2
|
// FPDF_TPL - Version 1.2
|
||||||
//
|
//
|
||||||
// Copyright 2004-2010 Setasign - Jan Slabon
|
// Copyright 2004-2010 Setasign - Jan Slabon
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
class FPDF_TPL extends FPDF {
|
class FPDF_TPL extends FPDF {
|
||||||
/**
|
/**
|
||||||
* Array of Tpl-Data
|
* Array of Tpl-Data
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
var $tpls = array();
|
var $tpls = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Current Template-ID
|
* Current Template-ID
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
var $tpl = 0;
|
var $tpl = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* "In Template"-Flag
|
* "In Template"-Flag
|
||||||
* @var boolean
|
* @var boolean
|
||||||
*/
|
*/
|
||||||
var $_intpl = false;
|
var $_intpl = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Nameprefix of Templates used in Resources-Dictonary
|
* Nameprefix of Templates used in Resources-Dictonary
|
||||||
* @var string A String defining the Prefix used as Template-Object-Names. Have to beginn with an /
|
* @var string A String defining the Prefix used as Template-Object-Names. Have to beginn with an /
|
||||||
*/
|
*/
|
||||||
var $tplprefix = "/TPL";
|
var $tplprefix = "/TPL";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resources used By Templates and Pages
|
* Resources used By Templates and Pages
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
var $_res = array();
|
var $_res = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Last used Template data
|
* Last used Template data
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
var $lastUsedTemplateData = array();
|
var $lastUsedTemplateData = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start a Template
|
* Start a Template
|
||||||
*
|
*
|
||||||
* This method starts a template. You can give own coordinates to build an own sized
|
* This method starts a template. You can give own coordinates to build an own sized
|
||||||
* Template. Pay attention, that the margins are adapted to the new templatesize.
|
* Template. Pay attention, that the margins are adapted to the new templatesize.
|
||||||
* If you want to write outside the template, for example to build a clipped Template,
|
* If you want to write outside the template, for example to build a clipped Template,
|
||||||
* you have to set the Margins and "Cursor"-Position manual after beginTemplate-Call.
|
* you have to set the Margins and "Cursor"-Position manual after beginTemplate-Call.
|
||||||
*
|
*
|
||||||
* If no parameter is given, the template uses the current page-size.
|
* If no parameter is given, the template uses the current page-size.
|
||||||
* The Method returns an ID of the current Template. This ID is used later for using this template.
|
* The Method returns an ID of the current Template. This ID is used later for using this template.
|
||||||
* Warning: A created Template is used in PDF at all events. Still if you don't use it after creation!
|
* Warning: A created Template is used in PDF at all events. Still if you don't use it after creation!
|
||||||
*
|
*
|
||||||
* @param int $x The x-coordinate given in user-unit
|
* @param int $x The x-coordinate given in user-unit
|
||||||
* @param int $y The y-coordinate given in user-unit
|
* @param int $y The y-coordinate given in user-unit
|
||||||
* @param int $w The width given in user-unit
|
* @param int $w The width given in user-unit
|
||||||
* @param int $h The height given in user-unit
|
* @param int $h The height given in user-unit
|
||||||
* @return int The ID of new created Template
|
* @return int The ID of new created Template
|
||||||
*/
|
*/
|
||||||
function beginTemplate($x = null, $y = null, $w = null, $h = null) {
|
function beginTemplate($x = null, $y = null, $w = null, $h = null) {
|
||||||
if (is_subclass_of($this, 'TCPDF')) {
|
if (is_subclass_of($this, 'TCPDF')) {
|
||||||
$this->Error('This method is only usable with FPDF. Use TCPDF methods startTemplate() instead.');
|
$this->Error('This method is only usable with FPDF. Use TCPDF methods startTemplate() instead.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->page <= 0)
|
if ($this->page <= 0)
|
||||||
$this->error("You have to add a page to fpdf first!");
|
$this->error("You have to add a page to fpdf first!");
|
||||||
|
|
||||||
if ($x == null)
|
if ($x == null)
|
||||||
$x = 0;
|
$x = 0;
|
||||||
if ($y == null)
|
if ($y == null)
|
||||||
$y = 0;
|
$y = 0;
|
||||||
if ($w == null)
|
if ($w == null)
|
||||||
$w = $this->w;
|
$w = $this->w;
|
||||||
if ($h == null)
|
if ($h == null)
|
||||||
$h = $this->h;
|
$h = $this->h;
|
||||||
|
|
||||||
// Save settings
|
// Save settings
|
||||||
$this->tpl++;
|
$this->tpl++;
|
||||||
$tpl =& $this->tpls[$this->tpl];
|
$tpl =& $this->tpls[$this->tpl];
|
||||||
$tpl = array(
|
$tpl = array(
|
||||||
'o_x' => $this->x,
|
'o_x' => $this->x,
|
||||||
'o_y' => $this->y,
|
'o_y' => $this->y,
|
||||||
'o_AutoPageBreak' => $this->AutoPageBreak,
|
'o_AutoPageBreak' => $this->AutoPageBreak,
|
||||||
'o_bMargin' => $this->bMargin,
|
'o_bMargin' => $this->bMargin,
|
||||||
'o_tMargin' => $this->tMargin,
|
'o_tMargin' => $this->tMargin,
|
||||||
'o_lMargin' => $this->lMargin,
|
'o_lMargin' => $this->lMargin,
|
||||||
'o_rMargin' => $this->rMargin,
|
'o_rMargin' => $this->rMargin,
|
||||||
'o_h' => $this->h,
|
'o_h' => $this->h,
|
||||||
'o_w' => $this->w,
|
'o_w' => $this->w,
|
||||||
'buffer' => '',
|
'buffer' => '',
|
||||||
'x' => $x,
|
'x' => $x,
|
||||||
'y' => $y,
|
'y' => $y,
|
||||||
'w' => $w,
|
'w' => $w,
|
||||||
'h' => $h
|
'h' => $h
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->SetAutoPageBreak(false);
|
$this->SetAutoPageBreak(false);
|
||||||
|
|
||||||
// Define own high and width to calculate possitions correct
|
// Define own high and width to calculate possitions correct
|
||||||
$this->h = $h;
|
$this->h = $h;
|
||||||
$this->w = $w;
|
$this->w = $w;
|
||||||
|
|
||||||
$this->_intpl = true;
|
$this->_intpl = true;
|
||||||
$this->SetXY($x + $this->lMargin, $y + $this->tMargin);
|
$this->SetXY($x + $this->lMargin, $y + $this->tMargin);
|
||||||
$this->SetRightMargin($this->w - $w + $this->rMargin);
|
$this->SetRightMargin($this->w - $w + $this->rMargin);
|
||||||
|
|
||||||
return $this->tpl;
|
return $this->tpl;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* End Template
|
* End Template
|
||||||
*
|
*
|
||||||
* This method ends a template and reset initiated variables on beginTemplate.
|
* This method ends a template and reset initiated variables on beginTemplate.
|
||||||
*
|
*
|
||||||
* @return mixed If a template is opened, the ID is returned. If not a false is returned.
|
* @return mixed If a template is opened, the ID is returned. If not a false is returned.
|
||||||
*/
|
*/
|
||||||
function endTemplate() {
|
function endTemplate() {
|
||||||
if (is_subclass_of($this, 'TCPDF')) {
|
if (is_subclass_of($this, 'TCPDF')) {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return call_user_func_array(array($this, 'TCPDF::endTemplate'), $args);
|
return call_user_func_array(array($this, 'TCPDF::endTemplate'), $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_intpl) {
|
if ($this->_intpl) {
|
||||||
$this->_intpl = false;
|
$this->_intpl = false;
|
||||||
$tpl =& $this->tpls[$this->tpl];
|
$tpl =& $this->tpls[$this->tpl];
|
||||||
$this->SetXY($tpl['o_x'], $tpl['o_y']);
|
$this->SetXY($tpl['o_x'], $tpl['o_y']);
|
||||||
$this->tMargin = $tpl['o_tMargin'];
|
$this->tMargin = $tpl['o_tMargin'];
|
||||||
$this->lMargin = $tpl['o_lMargin'];
|
$this->lMargin = $tpl['o_lMargin'];
|
||||||
$this->rMargin = $tpl['o_rMargin'];
|
$this->rMargin = $tpl['o_rMargin'];
|
||||||
$this->h = $tpl['o_h'];
|
$this->h = $tpl['o_h'];
|
||||||
$this->w = $tpl['o_w'];
|
$this->w = $tpl['o_w'];
|
||||||
$this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']);
|
$this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']);
|
||||||
|
|
||||||
return $this->tpl;
|
return $this->tpl;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Use a Template in current Page or other Template
|
* Use a Template in current Page or other Template
|
||||||
*
|
*
|
||||||
* You can use a template in a page or in another template.
|
* You can use a template in a page or in another template.
|
||||||
* You can give the used template a new size like you use the Image()-method.
|
* You can give the used template a new size like you use the Image()-method.
|
||||||
* All parameters are optional. The width or height is calculated automaticaly
|
* All parameters are optional. The width or height is calculated automaticaly
|
||||||
* if one is given. If no parameter is given the origin size as defined in
|
* if one is given. If no parameter is given the origin size as defined in
|
||||||
* beginTemplate() is used.
|
* beginTemplate() is used.
|
||||||
* The calculated or used width and height are returned as an array.
|
* The calculated or used width and height are returned as an array.
|
||||||
*
|
*
|
||||||
* @param int $tplidx A valid template-Id
|
* @param int $tplidx A valid template-Id
|
||||||
* @param int $_x The x-position
|
* @param int $_x The x-position
|
||||||
* @param int $_y The y-position
|
* @param int $_y The y-position
|
||||||
* @param int $_w The new width of the template
|
* @param int $_w The new width of the template
|
||||||
* @param int $_h The new height of the template
|
* @param int $_h The new height of the template
|
||||||
* @retrun array The height and width of the template
|
* @retrun array The height and width of the template
|
||||||
*/
|
*/
|
||||||
function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) {
|
function useTemplate($tplidx, $_x = null, $_y = null, $_w = 0, $_h = 0) {
|
||||||
if ($this->page <= 0)
|
if ($this->page <= 0)
|
||||||
$this->error('You have to add a page first!');
|
$this->error('You have to add a page first!');
|
||||||
|
|
||||||
if (!isset($this->tpls[$tplidx]))
|
if (!isset($this->tpls[$tplidx]))
|
||||||
$this->error('Template does not exist!');
|
$this->error('Template does not exist!');
|
||||||
|
|
||||||
if ($this->_intpl) {
|
if ($this->_intpl) {
|
||||||
$this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx];
|
$this->_res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx];
|
||||||
}
|
}
|
||||||
|
|
||||||
$tpl =& $this->tpls[$tplidx];
|
$tpl =& $this->tpls[$tplidx];
|
||||||
$w = $tpl['w'];
|
$w = $tpl['w'];
|
||||||
$h = $tpl['h'];
|
$h = $tpl['h'];
|
||||||
|
|
||||||
if ($_x == null)
|
if ($_x == null)
|
||||||
$_x = 0;
|
$_x = 0;
|
||||||
if ($_y == null)
|
if ($_y == null)
|
||||||
$_y = 0;
|
$_y = 0;
|
||||||
|
|
||||||
$_x += $tpl['x'];
|
$_x += $tpl['x'];
|
||||||
$_y += $tpl['y'];
|
$_y += $tpl['y'];
|
||||||
|
|
||||||
$wh = $this->getTemplateSize($tplidx, $_w, $_h);
|
$wh = $this->getTemplateSize($tplidx, $_w, $_h);
|
||||||
$_w = $wh['w'];
|
$_w = $wh['w'];
|
||||||
$_h = $wh['h'];
|
$_h = $wh['h'];
|
||||||
|
|
||||||
$tData = array(
|
$tData = array(
|
||||||
'x' => $this->x,
|
'x' => $this->x,
|
||||||
'y' => $this->y,
|
'y' => $this->y,
|
||||||
'w' => $_w,
|
'w' => $_w,
|
||||||
'h' => $_h,
|
'h' => $_h,
|
||||||
'scaleX' => ($_w / $w),
|
'scaleX' => ($_w / $w),
|
||||||
'scaleY' => ($_h / $h),
|
'scaleY' => ($_h / $h),
|
||||||
'tx' => $_x,
|
'tx' => $_x,
|
||||||
'ty' => ($this->h - $_y - $_h),
|
'ty' => ($this->h - $_y - $_h),
|
||||||
'lty' => ($this->h - $_y - $_h) - ($this->h - $h) * ($_h / $h)
|
'lty' => ($this->h - $_y - $_h) - ($this->h - $h) * ($_h / $h)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->_out(sprintf('q %.4F 0 0 %.4F %.4F %.4F cm', $tData['scaleX'], $tData['scaleY'], $tData['tx'] * $this->k, $tData['ty'] * $this->k)); // Translate
|
$this->_out(sprintf('q %.4F 0 0 %.4F %.4F %.4F cm', $tData['scaleX'], $tData['scaleY'], $tData['tx'] * $this->k, $tData['ty'] * $this->k)); // Translate
|
||||||
$this->_out(sprintf('%s%d Do Q', $this->tplprefix, $tplidx));
|
$this->_out(sprintf('%s%d Do Q', $this->tplprefix, $tplidx));
|
||||||
|
|
||||||
// reset font in the outer graphic state
|
// reset font in the outer graphic state
|
||||||
if ($this->FontFamily) {
|
if ($this->FontFamily) {
|
||||||
$family = $this->FontFamily;
|
$family = $this->FontFamily;
|
||||||
$this->FontFamily = '';
|
$this->FontFamily = '';
|
||||||
$this->SetFont($family);
|
$this->SetFont($family);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->lastUsedTemplateData = $tData;
|
$this->lastUsedTemplateData = $tData;
|
||||||
|
|
||||||
return array('w' => $_w, 'h' => $_h);
|
return array('w' => $_w, 'h' => $_h);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get The calculated Size of a Template
|
* Get The calculated Size of a Template
|
||||||
*
|
*
|
||||||
* If one size is given, this method calculates the other one.
|
* If one size is given, this method calculates the other one.
|
||||||
*
|
*
|
||||||
* @param int $tplidx A valid template-Id
|
* @param int $tplidx A valid template-Id
|
||||||
* @param int $_w The width of the template
|
* @param int $_w The width of the template
|
||||||
* @param int $_h The height of the template
|
* @param int $_h The height of the template
|
||||||
* @return array The height and width of the template
|
* @return array The height and width of the template
|
||||||
*/
|
*/
|
||||||
function getTemplateSize($tplidx, $_w = 0, $_h = 0) {
|
function getTemplateSize($tplidx, $_w = 0, $_h = 0) {
|
||||||
if (!$this->tpls[$tplidx])
|
if (!$this->tpls[$tplidx])
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$tpl =& $this->tpls[$tplidx];
|
$tpl =& $this->tpls[$tplidx];
|
||||||
$w = $tpl['w'];
|
$w = $tpl['w'];
|
||||||
$h = $tpl['h'];
|
$h = $tpl['h'];
|
||||||
|
|
||||||
if ($_w == 0 and $_h == 0) {
|
if ($_w == 0 and $_h == 0) {
|
||||||
$_w = $w;
|
$_w = $w;
|
||||||
$_h = $h;
|
$_h = $h;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($_w == 0)
|
if($_w == 0)
|
||||||
$_w = $_h * $w / $h;
|
$_w = $_h * $w / $h;
|
||||||
if($_h == 0)
|
if($_h == 0)
|
||||||
$_h = $_w * $h / $w;
|
$_h = $_w * $h / $w;
|
||||||
|
|
||||||
return array("w" => $_w, "h" => $_h);
|
return array("w" => $_w, "h" => $_h);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See FPDF/TCPDF-Documentation ;-)
|
* See FPDF/TCPDF-Documentation ;-)
|
||||||
*/
|
*/
|
||||||
public function SetFont($family, $style = '', $size = 0) {
|
public function SetFont($family, $style = '', $size = 0) {
|
||||||
if (is_subclass_of($this, 'TCPDF')) {
|
if (is_subclass_of($this, 'TCPDF')) {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return call_user_func_array(array($this, 'TCPDF::SetFont'), $args);
|
return call_user_func_array(array($this, 'TCPDF::SetFont'), $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* force the resetting of font changes in a template
|
* force the resetting of font changes in a template
|
||||||
*/
|
*/
|
||||||
if ($this->_intpl)
|
if ($this->_intpl)
|
||||||
$this->FontFamily = '';
|
$this->FontFamily = '';
|
||||||
|
|
||||||
parent::SetFont($family, $style, $size);
|
parent::SetFont($family, $style, $size);
|
||||||
|
|
||||||
$fontkey = $this->FontFamily . $this->FontStyle;
|
$fontkey = $this->FontFamily . $this->FontStyle;
|
||||||
|
|
||||||
if ($this->_intpl) {
|
if ($this->_intpl) {
|
||||||
$this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
|
$this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
|
||||||
} else {
|
} else {
|
||||||
$this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey];
|
$this->_res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See FPDF/TCPDF-Documentation ;-)
|
* See FPDF/TCPDF-Documentation ;-)
|
||||||
*/
|
*/
|
||||||
function Image($file, $x = null, $y = null, $w = 0, $h = 0, $type = '', $link = '') {
|
function Image($file, $x = null, $y = null, $w = 0, $h = 0, $type = '', $link = '') {
|
||||||
if (is_subclass_of($this, 'TCPDF')) {
|
if (is_subclass_of($this, 'TCPDF')) {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return call_user_func_array(array($this, 'TCPDF::Image'), $args);
|
return call_user_func_array(array($this, 'TCPDF::Image'), $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
$ret = parent::Image($file, $x, $y, $w, $h, $type, $link);
|
$ret = parent::Image($file, $x, $y, $w, $h, $type, $link);
|
||||||
if ($this->_intpl) {
|
if ($this->_intpl) {
|
||||||
$this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file];
|
$this->_res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file];
|
||||||
} else {
|
} else {
|
||||||
$this->_res['page'][$this->page]['images'][$file] =& $this->images[$file];
|
$this->_res['page'][$this->page]['images'][$file] =& $this->images[$file];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* See FPDF-Documentation ;-)
|
* See FPDF-Documentation ;-)
|
||||||
*
|
*
|
||||||
* AddPage is not available when you're "in" a template.
|
* AddPage is not available when you're "in" a template.
|
||||||
*/
|
*/
|
||||||
function AddPage($orientation = '', $format = '') {
|
function AddPage($orientation = '', $format = '') {
|
||||||
if (is_subclass_of($this, 'TCPDF')) {
|
if (is_subclass_of($this, 'TCPDF')) {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return call_user_func_array(array($this, 'TCPDF::AddPage'), $args);
|
return call_user_func_array(array($this, 'TCPDF::AddPage'), $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_intpl)
|
if ($this->_intpl)
|
||||||
$this->Error('Adding pages in templates isn\'t possible!');
|
$this->Error('Adding pages in templates isn\'t possible!');
|
||||||
|
|
||||||
parent::AddPage($orientation, $format);
|
parent::AddPage($orientation, $format);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Preserve adding Links in Templates ...won't work
|
* Preserve adding Links in Templates ...won't work
|
||||||
*/
|
*/
|
||||||
function Link($x, $y, $w, $h, $link) {
|
function Link($x, $y, $w, $h, $link) {
|
||||||
if (is_subclass_of($this, 'TCPDF')) {
|
if (is_subclass_of($this, 'TCPDF')) {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return call_user_func_array(array($this, 'TCPDF::Link'), $args);
|
return call_user_func_array(array($this, 'TCPDF::Link'), $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_intpl)
|
if ($this->_intpl)
|
||||||
$this->Error('Using links in templates aren\'t possible!');
|
$this->Error('Using links in templates aren\'t possible!');
|
||||||
|
|
||||||
parent::Link($x, $y, $w, $h, $link);
|
parent::Link($x, $y, $w, $h, $link);
|
||||||
}
|
}
|
||||||
|
|
||||||
function AddLink() {
|
function AddLink() {
|
||||||
if (is_subclass_of($this, 'TCPDF')) {
|
if (is_subclass_of($this, 'TCPDF')) {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return call_user_func_array(array($this, 'TCPDF::AddLink'), $args);
|
return call_user_func_array(array($this, 'TCPDF::AddLink'), $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_intpl)
|
if ($this->_intpl)
|
||||||
$this->Error('Adding links in templates aren\'t possible!');
|
$this->Error('Adding links in templates aren\'t possible!');
|
||||||
return parent::AddLink();
|
return parent::AddLink();
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetLink($link, $y = 0, $page = -1) {
|
function SetLink($link, $y = 0, $page = -1) {
|
||||||
if (is_subclass_of($this, 'TCPDF')) {
|
if (is_subclass_of($this, 'TCPDF')) {
|
||||||
$args = func_get_args();
|
$args = func_get_args();
|
||||||
return call_user_func_array(array($this, 'TCPDF::SetLink'), $args);
|
return call_user_func_array(array($this, 'TCPDF::SetLink'), $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->_intpl)
|
if ($this->_intpl)
|
||||||
$this->Error('Setting links in templates aren\'t possible!');
|
$this->Error('Setting links in templates aren\'t possible!');
|
||||||
parent::SetLink($link, $y, $page);
|
parent::SetLink($link, $y, $page);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private Method that writes the form xobjects
|
* Private Method that writes the form xobjects
|
||||||
*/
|
*/
|
||||||
function _putformxobjects() {
|
function _putformxobjects() {
|
||||||
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
|
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
|
||||||
reset($this->tpls);
|
reset($this->tpls);
|
||||||
foreach($this->tpls AS $tplidx => $tpl) {
|
foreach($this->tpls AS $tplidx => $tpl) {
|
||||||
|
|
||||||
$p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
|
$p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
|
||||||
$this->_newobj();
|
$this->_newobj();
|
||||||
$this->tpls[$tplidx]['n'] = $this->n;
|
$this->tpls[$tplidx]['n'] = $this->n;
|
||||||
$this->_out('<<'.$filter.'/Type /XObject');
|
$this->_out('<<'.$filter.'/Type /XObject');
|
||||||
$this->_out('/Subtype /Form');
|
$this->_out('/Subtype /Form');
|
||||||
$this->_out('/FormType 1');
|
$this->_out('/FormType 1');
|
||||||
$this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]',
|
$this->_out(sprintf('/BBox [%.2F %.2F %.2F %.2F]',
|
||||||
// llx
|
// llx
|
||||||
$tpl['x'] * $this->k,
|
$tpl['x'] * $this->k,
|
||||||
// lly
|
// lly
|
||||||
-$tpl['y'] * $this->k,
|
-$tpl['y'] * $this->k,
|
||||||
// urx
|
// urx
|
||||||
($tpl['w'] + $tpl['x']) * $this->k,
|
($tpl['w'] + $tpl['x']) * $this->k,
|
||||||
// ury
|
// ury
|
||||||
($tpl['h'] - $tpl['y']) * $this->k
|
($tpl['h'] - $tpl['y']) * $this->k
|
||||||
));
|
));
|
||||||
|
|
||||||
if ($tpl['x'] != 0 || $tpl['y'] != 0) {
|
if ($tpl['x'] != 0 || $tpl['y'] != 0) {
|
||||||
$this->_out(sprintf('/Matrix [1 0 0 1 %.5F %.5F]',
|
$this->_out(sprintf('/Matrix [1 0 0 1 %.5F %.5F]',
|
||||||
-$tpl['x'] * $this->k * 2, $tpl['y'] * $this->k * 2
|
-$tpl['x'] * $this->k * 2, $tpl['y'] * $this->k * 2
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->_out('/Resources ');
|
$this->_out('/Resources ');
|
||||||
|
|
||||||
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
|
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
|
||||||
if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) {
|
if (isset($this->_res['tpl'][$tplidx]['fonts']) && count($this->_res['tpl'][$tplidx]['fonts'])) {
|
||||||
$this->_out('/Font <<');
|
$this->_out('/Font <<');
|
||||||
foreach($this->_res['tpl'][$tplidx]['fonts'] as $font)
|
foreach($this->_res['tpl'][$tplidx]['fonts'] as $font)
|
||||||
$this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
|
$this->_out('/F' . $font['i'] . ' ' . $font['n'] . ' 0 R');
|
||||||
$this->_out('>>');
|
$this->_out('>>');
|
||||||
}
|
}
|
||||||
if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) ||
|
if(isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images']) ||
|
||||||
isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']))
|
isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls']))
|
||||||
{
|
{
|
||||||
$this->_out('/XObject <<');
|
$this->_out('/XObject <<');
|
||||||
if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) {
|
if (isset($this->_res['tpl'][$tplidx]['images']) && count($this->_res['tpl'][$tplidx]['images'])) {
|
||||||
foreach($this->_res['tpl'][$tplidx]['images'] as $image)
|
foreach($this->_res['tpl'][$tplidx]['images'] as $image)
|
||||||
$this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
|
$this->_out('/I' . $image['i'] . ' ' . $image['n'] . ' 0 R');
|
||||||
}
|
}
|
||||||
if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) {
|
if (isset($this->_res['tpl'][$tplidx]['tpls']) && count($this->_res['tpl'][$tplidx]['tpls'])) {
|
||||||
foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl)
|
foreach($this->_res['tpl'][$tplidx]['tpls'] as $i => $tpl)
|
||||||
$this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R');
|
$this->_out($this->tplprefix . $i . ' ' . $tpl['n'] . ' 0 R');
|
||||||
}
|
}
|
||||||
$this->_out('>>');
|
$this->_out('>>');
|
||||||
}
|
}
|
||||||
$this->_out('>>');
|
$this->_out('>>');
|
||||||
|
|
||||||
$this->_out('/Length ' . strlen($p) . ' >>');
|
$this->_out('/Length ' . strlen($p) . ' >>');
|
||||||
$this->_putstream($p);
|
$this->_putstream($p);
|
||||||
$this->_out('endobj');
|
$this->_out('endobj');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overwritten to add _putformxobjects() after _putimages()
|
* Overwritten to add _putformxobjects() after _putimages()
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
function _putimages() {
|
function _putimages() {
|
||||||
parent::_putimages();
|
parent::_putimages();
|
||||||
$this->_putformxobjects();
|
$this->_putformxobjects();
|
||||||
}
|
}
|
||||||
|
|
||||||
function _putxobjectdict() {
|
function _putxobjectdict() {
|
||||||
parent::_putxobjectdict();
|
parent::_putxobjectdict();
|
||||||
|
|
||||||
if (count($this->tpls)) {
|
if (count($this->tpls)) {
|
||||||
foreach($this->tpls as $tplidx => $tpl) {
|
foreach($this->tpls as $tplidx => $tpl) {
|
||||||
$this->_out(sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n']));
|
$this->_out(sprintf('%s%d %d 0 R', $this->tplprefix, $tplidx, $tpl['n']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Private Method
|
* Private Method
|
||||||
*/
|
*/
|
||||||
function _out($s) {
|
function _out($s) {
|
||||||
if ($this->state == 2 && $this->_intpl) {
|
if ($this->state == 2 && $this->_intpl) {
|
||||||
$this->tpls[$this->tpl]['buffer'] .= $s . "\n";
|
$this->tpls[$this->tpl]['buffer'] .= $s . "\n";
|
||||||
} else {
|
} else {
|
||||||
parent::_out($s);
|
parent::_out($s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@ -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]);
|
||||||
|
|||||||
@ -1,409 +1,408 @@
|
|||||||
<?php
|
<?php
|
||||||
//
|
//
|
||||||
// FPDI - Version 1.4.1
|
// FPDI - Version 1.4.2
|
||||||
//
|
//
|
||||||
// Copyright 2004-2011 Setasign - Jan Slabon
|
// Copyright 2004-2011 Setasign - Jan Slabon
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
require_once('pdf_parser.php');
|
require_once('pdf_parser.php');
|
||||||
|
|
||||||
class fpdi_pdf_parser extends pdf_parser {
|
class fpdi_pdf_parser extends pdf_parser {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Pages
|
* Pages
|
||||||
* Index beginns at 0
|
* Index beginns at 0
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
var $pages;
|
var $pages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Page count
|
* Page count
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
var $page_count;
|
var $page_count;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* actual page number
|
* actual page number
|
||||||
* @var integer
|
* @var integer
|
||||||
*/
|
*/
|
||||||
var $pageno;
|
var $pageno;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PDF Version of imported Document
|
* PDF Version of imported Document
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $pdfVersion;
|
var $pdfVersion;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* FPDI Reference
|
* FPDI Reference
|
||||||
* @var object
|
* @var object
|
||||||
*/
|
*/
|
||||||
var $fpdi;
|
var $fpdi;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Available BoxTypes
|
* Available BoxTypes
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
var $availableBoxes = array('/MediaBox', '/CropBox', '/BleedBox', '/TrimBox', '/ArtBox');
|
var $availableBoxes = array('/MediaBox', '/CropBox', '/BleedBox', '/TrimBox', '/ArtBox');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param string $filename Source-Filename
|
* @param string $filename Source-Filename
|
||||||
* @param object $fpdi Object of type fpdi
|
* @param object $fpdi Object of type fpdi
|
||||||
*/
|
*/
|
||||||
function fpdi_pdf_parser($filename, &$fpdi) {
|
function fpdi_pdf_parser($filename, &$fpdi) {
|
||||||
$this->fpdi =& $fpdi;
|
$this->fpdi =& $fpdi;
|
||||||
|
|
||||||
parent::pdf_parser($filename);
|
parent::pdf_parser($filename);
|
||||||
|
|
||||||
// resolve Pages-Dictonary
|
// resolve Pages-Dictonary
|
||||||
$pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']);
|
$pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']);
|
||||||
|
|
||||||
// Read pages
|
// Read pages
|
||||||
$this->read_pages($this->c, $pages, $this->pages);
|
$this->read_pages($this->c, $pages, $this->pages);
|
||||||
|
|
||||||
// count pages;
|
// count pages;
|
||||||
$this->page_count = count($this->pages);
|
$this->page_count = count($this->pages);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Overwrite parent::error()
|
* Overwrite parent::error()
|
||||||
*
|
*
|
||||||
* @param string $msg Error-Message
|
* @param string $msg Error-Message
|
||||||
*/
|
*/
|
||||||
function error($msg) {
|
function error($msg) {
|
||||||
$this->fpdi->error($msg);
|
$this->fpdi->error($msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get pagecount from sourcefile
|
* Get pagecount from sourcefile
|
||||||
*
|
*
|
||||||
* @return int
|
* @return int
|
||||||
*/
|
*/
|
||||||
function getPageCount() {
|
function getPageCount() {
|
||||||
return $this->page_count;
|
return $this->page_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set pageno
|
* Set pageno
|
||||||
*
|
*
|
||||||
* @param int $pageno Pagenumber to use
|
* @param int $pageno Pagenumber to use
|
||||||
*/
|
*/
|
||||||
function setPageno($pageno) {
|
function setPageno($pageno) {
|
||||||
$pageno = ((int) $pageno) - 1;
|
$pageno = ((int) $pageno) - 1;
|
||||||
|
|
||||||
if ($pageno < 0 || $pageno >= $this->getPageCount()) {
|
if ($pageno < 0 || $pageno >= $this->getPageCount()) {
|
||||||
$this->fpdi->error('Pagenumber is wrong!');
|
$this->fpdi->error('Pagenumber is wrong!');
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->pageno = $pageno;
|
$this->pageno = $pageno;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get page-resources from current page
|
* Get page-resources from current page
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getPageResources() {
|
function getPageResources() {
|
||||||
return $this->_getPageResources($this->pages[$this->pageno]);
|
return $this->_getPageResources($this->pages[$this->pageno]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get page-resources from /Page
|
* Get page-resources from /Page
|
||||||
*
|
*
|
||||||
* @param array $obj Array of pdf-data
|
* @param array $obj Array of pdf-data
|
||||||
*/
|
*/
|
||||||
function _getPageResources ($obj) { // $obj = /Page
|
function _getPageResources ($obj) { // $obj = /Page
|
||||||
$obj = $this->pdf_resolve_object($this->c, $obj);
|
$obj = $this->pdf_resolve_object($this->c, $obj);
|
||||||
|
|
||||||
// If the current object has a resources
|
// If the current object has a resources
|
||||||
// dictionary associated with it, we use
|
// dictionary associated with it, we use
|
||||||
// it. Otherwise, we move back to its
|
// it. Otherwise, we move back to its
|
||||||
// parent object.
|
// parent object.
|
||||||
if (isset ($obj[1][1]['/Resources'])) {
|
if (isset ($obj[1][1]['/Resources'])) {
|
||||||
$res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Resources']);
|
$res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Resources']);
|
||||||
if ($res[0] == PDF_TYPE_OBJECT)
|
if ($res[0] == PDF_TYPE_OBJECT)
|
||||||
return $res[1];
|
return $res[1];
|
||||||
return $res;
|
return $res;
|
||||||
} else {
|
} else {
|
||||||
if (!isset ($obj[1][1]['/Parent'])) {
|
if (!isset ($obj[1][1]['/Parent'])) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$res = $this->_getPageResources($obj[1][1]['/Parent']);
|
$res = $this->_getPageResources($obj[1][1]['/Parent']);
|
||||||
if ($res[0] == PDF_TYPE_OBJECT)
|
if ($res[0] == PDF_TYPE_OBJECT)
|
||||||
return $res[1];
|
return $res[1];
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get content of current page
|
* Get content of current page
|
||||||
*
|
*
|
||||||
* If more /Contents is an array, the streams are concated
|
* If more /Contents is an array, the streams are concated
|
||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function getContent() {
|
function getContent() {
|
||||||
$buffer = '';
|
$buffer = '';
|
||||||
|
|
||||||
if (isset($this->pages[$this->pageno][1][1]['/Contents'])) {
|
if (isset($this->pages[$this->pageno][1][1]['/Contents'])) {
|
||||||
$contents = $this->_getPageContent($this->pages[$this->pageno][1][1]['/Contents']);
|
$contents = $this->_getPageContent($this->pages[$this->pageno][1][1]['/Contents']);
|
||||||
foreach($contents AS $tmp_content) {
|
foreach($contents AS $tmp_content) {
|
||||||
$buffer .= $this->_rebuildContentStream($tmp_content) . ' ';
|
$buffer .= $this->_rebuildContentStream($tmp_content) . ' ';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $buffer;
|
return $buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolve all content-objects
|
* Resolve all content-objects
|
||||||
*
|
*
|
||||||
* @param array $content_ref
|
* @param array $content_ref
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function _getPageContent($content_ref) {
|
function _getPageContent($content_ref) {
|
||||||
$contents = array();
|
$contents = array();
|
||||||
|
|
||||||
if ($content_ref[0] == PDF_TYPE_OBJREF) {
|
if ($content_ref[0] == PDF_TYPE_OBJREF) {
|
||||||
$content = $this->pdf_resolve_object($this->c, $content_ref);
|
$content = $this->pdf_resolve_object($this->c, $content_ref);
|
||||||
if ($content[1][0] == PDF_TYPE_ARRAY) {
|
if ($content[1][0] == PDF_TYPE_ARRAY) {
|
||||||
$contents = $this->_getPageContent($content[1]);
|
$contents = $this->_getPageContent($content[1]);
|
||||||
} else {
|
} else {
|
||||||
$contents[] = $content;
|
$contents[] = $content;
|
||||||
}
|
}
|
||||||
} else if ($content_ref[0] == PDF_TYPE_ARRAY) {
|
} else if ($content_ref[0] == PDF_TYPE_ARRAY) {
|
||||||
foreach ($content_ref[1] AS $tmp_content_ref) {
|
foreach ($content_ref[1] AS $tmp_content_ref) {
|
||||||
$contents = array_merge($contents,$this->_getPageContent($tmp_content_ref));
|
$contents = array_merge($contents,$this->_getPageContent($tmp_content_ref));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $contents;
|
return $contents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rebuild content-streams
|
* Rebuild content-streams
|
||||||
*
|
*
|
||||||
* @param array $obj
|
* @param array $obj
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function _rebuildContentStream($obj) {
|
function _rebuildContentStream($obj) {
|
||||||
$filters = array();
|
$filters = array();
|
||||||
|
|
||||||
if (isset($obj[1][1]['/Filter'])) {
|
if (isset($obj[1][1]['/Filter'])) {
|
||||||
$_filter = $obj[1][1]['/Filter'];
|
$_filter = $obj[1][1]['/Filter'];
|
||||||
|
|
||||||
if ($_filter[0] == PDF_TYPE_OBJREF) {
|
if ($_filter[0] == PDF_TYPE_OBJREF) {
|
||||||
$tmpFilter = $this->pdf_resolve_object($this->c, $_filter);
|
$tmpFilter = $this->pdf_resolve_object($this->c, $_filter);
|
||||||
$_filter = $tmpFilter[1];
|
$_filter = $tmpFilter[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($_filter[0] == PDF_TYPE_TOKEN) {
|
if ($_filter[0] == PDF_TYPE_TOKEN) {
|
||||||
$filters[] = $_filter;
|
$filters[] = $_filter;
|
||||||
} else if ($_filter[0] == PDF_TYPE_ARRAY) {
|
} else if ($_filter[0] == PDF_TYPE_ARRAY) {
|
||||||
$filters = $_filter[1];
|
$filters = $_filter[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$stream = $obj[2][1];
|
$stream = $obj[2][1];
|
||||||
|
|
||||||
foreach ($filters AS $_filter) {
|
foreach ($filters AS $_filter) {
|
||||||
switch ($_filter[1]) {
|
switch ($_filter[1]) {
|
||||||
case '/FlateDecode':
|
case '/FlateDecode':
|
||||||
case '/Fl':
|
case '/Fl':
|
||||||
// $stream .= "\x0F\x0D"; // in an errorious stream this suffix could work
|
// $stream .= "\x0F\x0D"; // in an errorious stream this suffix could work
|
||||||
// $stream .= "\x0A";
|
// $stream .= "\x0A";
|
||||||
// $stream .= "\x0D";
|
// $stream .= "\x0D";
|
||||||
if (function_exists('gzuncompress')) {
|
if (function_exists('gzuncompress')) {
|
||||||
$stream = (strlen($stream) > 0) ? @gzuncompress($stream) : '';
|
$stream = (strlen($stream) > 0) ? @gzuncompress($stream) : '';
|
||||||
} else {
|
} else {
|
||||||
$this->error(sprintf('To handle %s filter, please compile php with zlib support.',$_filter[1]));
|
$this->error(sprintf('To handle %s filter, please compile php with zlib support.',$_filter[1]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($stream === false) {
|
if ($stream === false) {
|
||||||
$this->error('Error while decompressing stream.');
|
$this->error('Error while decompressing stream.');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case '/LZWDecode':
|
case '/LZWDecode':
|
||||||
include_once('filters/FilterLZW_FPDI.php');
|
include_once('filters/FilterLZW_FPDI.php');
|
||||||
$decoder = new FilterLZW_FPDI($this->fpdi);
|
$decoder = new FilterLZW_FPDI($this->fpdi);
|
||||||
$stream = $decoder->decode($stream);
|
$stream = $decoder->decode($stream);
|
||||||
break;
|
break;
|
||||||
case '/ASCII85Decode':
|
case '/ASCII85Decode':
|
||||||
include_once('filters/FilterASCII85_FPDI.php');
|
include_once('filters/FilterASCII85_FPDI.php');
|
||||||
$decoder = new FilterASCII85_FPDI($this->fpdi);
|
$decoder = new FilterASCII85_FPDI($this->fpdi);
|
||||||
$stream = $decoder->decode($stream);
|
$stream = $decoder->decode($stream);
|
||||||
break;
|
break;
|
||||||
case null:
|
case null:
|
||||||
$stream = $stream;
|
$stream = $stream;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$this->error(sprintf('Unsupported Filter: %s',$_filter[1]));
|
$this->error(sprintf('Unsupported Filter: %s',$_filter[1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $stream;
|
return $stream;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a Box from a page
|
* Get a Box from a page
|
||||||
* Arrayformat is same as used by fpdf_tpl
|
* Arrayformat is same as used by fpdf_tpl
|
||||||
*
|
*
|
||||||
* @param array $page a /Page
|
* @param array $page a /Page
|
||||||
* @param string $box_index Type of Box @see $availableBoxes
|
* @param string $box_index Type of Box @see $availableBoxes
|
||||||
* @param float Scale factor from user space units to points
|
* @param float Scale factor from user space units to points
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function getPageBox($page, $box_index, $k) {
|
function getPageBox($page, $box_index, $k) {
|
||||||
$page = $this->pdf_resolve_object($this->c, $page);
|
$page = $this->pdf_resolve_object($this->c, $page);
|
||||||
$box = null;
|
$box = null;
|
||||||
if (isset($page[1][1][$box_index]))
|
if (isset($page[1][1][$box_index]))
|
||||||
$box =& $page[1][1][$box_index];
|
$box =& $page[1][1][$box_index];
|
||||||
|
|
||||||
if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) {
|
if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) {
|
||||||
$tmp_box = $this->pdf_resolve_object($this->c, $box);
|
$tmp_box = $this->pdf_resolve_object($this->c, $box);
|
||||||
$box = $tmp_box[1];
|
$box = $tmp_box[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
||||||
} else {
|
} else {
|
||||||
return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index, $k);
|
return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index, $k);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all page boxes by page no
|
* Get all page boxes by page no
|
||||||
*
|
*
|
||||||
* @param int The page number
|
* @param int The page number
|
||||||
* @param float Scale factor from user space units to points
|
* @param float Scale factor from user space units to points
|
||||||
* @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);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all boxes from /Page
|
* Get all boxes from /Page
|
||||||
*
|
*
|
||||||
* @param array a /Page
|
* @param array a /Page
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function _getPageBoxes($page, $k) {
|
function _getPageBoxes($page, $k) {
|
||||||
$boxes = array();
|
$boxes = array();
|
||||||
|
|
||||||
foreach($this->availableBoxes AS $box) {
|
foreach($this->availableBoxes AS $box) {
|
||||||
if ($_box = $this->getPageBox($page, $box, $k)) {
|
if ($_box = $this->getPageBox($page, $box, $k)) {
|
||||||
$boxes[$box] = $_box;
|
$boxes[$box] = $_box;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $boxes;
|
return $boxes;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the page rotation by pageno
|
* Get the page rotation by pageno
|
||||||
*
|
*
|
||||||
* @param integer $pageno
|
* @param integer $pageno
|
||||||
* @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
|
||||||
$obj = $this->pdf_resolve_object($this->c, $obj);
|
$obj = $this->pdf_resolve_object($this->c, $obj);
|
||||||
if (isset ($obj[1][1]['/Rotate'])) {
|
if (isset ($obj[1][1]['/Rotate'])) {
|
||||||
$res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Rotate']);
|
$res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Rotate']);
|
||||||
if ($res[0] == PDF_TYPE_OBJECT)
|
if ($res[0] == PDF_TYPE_OBJECT)
|
||||||
return $res[1];
|
return $res[1];
|
||||||
return $res;
|
return $res;
|
||||||
} else {
|
} else {
|
||||||
if (!isset ($obj[1][1]['/Parent'])) {
|
if (!isset ($obj[1][1]['/Parent'])) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
$res = $this->_getPageRotation($obj[1][1]['/Parent']);
|
$res = $this->_getPageRotation($obj[1][1]['/Parent']);
|
||||||
if ($res[0] == PDF_TYPE_OBJECT)
|
if ($res[0] == PDF_TYPE_OBJECT)
|
||||||
return $res[1];
|
return $res[1];
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Read all /Page(es)
|
* Read all /Page(es)
|
||||||
*
|
*
|
||||||
* @param object pdf_context
|
* @param object pdf_context
|
||||||
* @param array /Pages
|
* @param array /Pages
|
||||||
* @param array the result-array
|
* @param array the result-array
|
||||||
*/
|
*/
|
||||||
function read_pages(&$c, &$pages, &$result) {
|
function read_pages(&$c, &$pages, &$result) {
|
||||||
// Get the kids dictionary
|
// Get the kids dictionary
|
||||||
$_kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']);
|
$_kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']);
|
||||||
|
|
||||||
if (!is_array($_kids))
|
if (!is_array($_kids))
|
||||||
$this->error('Cannot find /Kids in current /Page-Dictionary');
|
$this->error('Cannot find /Kids in current /Page-Dictionary');
|
||||||
|
|
||||||
if ($_kids[1][0] == PDF_TYPE_ARRAY) {
|
if ($_kids[1][0] == PDF_TYPE_ARRAY) {
|
||||||
$kids = $_kids[1][1];
|
$kids = $_kids[1][1];
|
||||||
} else {
|
} else {
|
||||||
$kids = $_kids[1];
|
$kids = $_kids[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($kids as $v) {
|
foreach ($kids as $v) {
|
||||||
$pg = $this->pdf_resolve_object ($c, $v);
|
$pg = $this->pdf_resolve_object ($c, $v);
|
||||||
if ($pg[1][1]['/Type'][1] === '/Pages') {
|
if ($pg[1][1]['/Type'][1] === '/Pages') {
|
||||||
// If one of the kids is an embedded
|
// If one of the kids is an embedded
|
||||||
// /Pages array, resolve it as well.
|
// /Pages array, resolve it as well.
|
||||||
$this->read_pages($c, $pg, $result);
|
$this->read_pages($c, $pg, $result);
|
||||||
} else {
|
} else {
|
||||||
$result[] = $pg;
|
$result[] = $pg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get PDF-Version
|
* Get PDF-Version
|
||||||
*
|
*
|
||||||
* And reset the PDF Version used in FPDI if needed
|
* And reset the PDF Version used in FPDI if needed
|
||||||
*/
|
*/
|
||||||
function getPDFVersion() {
|
function getPDFVersion() {
|
||||||
parent::getPDFVersion();
|
parent::getPDFVersion();
|
||||||
$this->fpdi->setPDFVersion(max($this->fpdi->getPDFVersion(), $this->pdfVersion));
|
$this->fpdi->setPDFVersion(max($this->fpdi->getPDFVersion(), $this->pdfVersion));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,104 +1,104 @@
|
|||||||
<?php
|
<?php
|
||||||
//
|
//
|
||||||
// FPDI - Version 1.4.1
|
// FPDI - Version 1.4.2
|
||||||
//
|
//
|
||||||
// Copyright 2004-2011 Setasign - Jan Slabon
|
// Copyright 2004-2011 Setasign - Jan Slabon
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License.
|
// you may not use this file except in compliance with the License.
|
||||||
// You may obtain a copy of the License at
|
// You may obtain a copy of the License at
|
||||||
//
|
//
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
// http://www.apache.org/licenses/LICENSE-2.0
|
||||||
//
|
//
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
// Unless required by applicable law or agreed to in writing, software
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
// See the License for the specific language governing permissions and
|
// See the License for the specific language governing permissions and
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
//
|
//
|
||||||
|
|
||||||
if (!class_exists('pdf_context', false)) {
|
if (!class_exists('pdf_context', false)) {
|
||||||
|
|
||||||
class pdf_context {
|
class pdf_context {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modi
|
* Modi
|
||||||
*
|
*
|
||||||
* @var integer 0 = file | 1 = string
|
* @var integer 0 = file | 1 = string
|
||||||
*/
|
*/
|
||||||
var $_mode = 0;
|
var $_mode = 0;
|
||||||
|
|
||||||
var $file;
|
var $file;
|
||||||
var $buffer;
|
var $buffer;
|
||||||
var $offset;
|
var $offset;
|
||||||
var $length;
|
var $length;
|
||||||
|
|
||||||
var $stack;
|
var $stack;
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
|
|
||||||
function pdf_context(&$f) {
|
function pdf_context(&$f) {
|
||||||
$this->file =& $f;
|
$this->file =& $f;
|
||||||
if (is_string($this->file))
|
if (is_string($this->file))
|
||||||
$this->_mode = 1;
|
$this->_mode = 1;
|
||||||
$this->reset();
|
$this->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optionally move the file
|
// Optionally move the file
|
||||||
// pointer to a new location
|
// pointer to a new location
|
||||||
// and reset the buffered data
|
// and reset the buffered data
|
||||||
|
|
||||||
function reset($pos = null, $l = 100) {
|
function reset($pos = null, $l = 100) {
|
||||||
if ($this->_mode == 0) {
|
if ($this->_mode == 0) {
|
||||||
if (!is_null ($pos)) {
|
if (!is_null ($pos)) {
|
||||||
fseek ($this->file, $pos);
|
fseek ($this->file, $pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->buffer = $l > 0 ? fread($this->file, $l) : '';
|
$this->buffer = $l > 0 ? fread($this->file, $l) : '';
|
||||||
$this->length = strlen($this->buffer);
|
$this->length = strlen($this->buffer);
|
||||||
if ($this->length < $l)
|
if ($this->length < $l)
|
||||||
$this->increase_length($l - $this->length);
|
$this->increase_length($l - $this->length);
|
||||||
} else {
|
} else {
|
||||||
$this->buffer = $this->file;
|
$this->buffer = $this->file;
|
||||||
$this->length = strlen($this->buffer);
|
$this->length = strlen($this->buffer);
|
||||||
}
|
}
|
||||||
$this->offset = 0;
|
$this->offset = 0;
|
||||||
$this->stack = array();
|
$this->stack = array();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure that there is at least one
|
// Make sure that there is at least one
|
||||||
// character beyond the current offset in
|
// character beyond the current offset in
|
||||||
// the buffer to prevent the tokenizer
|
// the buffer to prevent the tokenizer
|
||||||
// from attempting to access data that does
|
// from attempting to access data that does
|
||||||
// not exist
|
// not exist
|
||||||
|
|
||||||
function ensure_content() {
|
function ensure_content() {
|
||||||
if ($this->offset >= $this->length - 1) {
|
if ($this->offset >= $this->length - 1) {
|
||||||
return $this->increase_length();
|
return $this->increase_length();
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forcefully read more data into the buffer
|
// Forcefully read more data into the buffer
|
||||||
|
|
||||||
function increase_length($l = 100) {
|
function increase_length($l = 100) {
|
||||||
if ($this->_mode == 0 && feof($this->file)) {
|
if ($this->_mode == 0 && feof($this->file)) {
|
||||||
return false;
|
return false;
|
||||||
} else if ($this->_mode == 0) {
|
} else if ($this->_mode == 0) {
|
||||||
$totalLength = $this->length + $l;
|
$totalLength = $this->length + $l;
|
||||||
do {
|
do {
|
||||||
$toRead = $totalLength - $this->length;
|
$toRead = $totalLength - $this->length;
|
||||||
if ($toRead < 1)
|
if ($toRead < 1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
$this->buffer .= fread($this->file, $toRead);
|
$this->buffer .= fread($this->file, $toRead);
|
||||||
} while ((($this->length = strlen($this->buffer)) != $totalLength) && !feof($this->file));
|
} while ((($this->length = strlen($this->buffer)) != $totalLength) && !feof($this->file));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@ -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;
|
||||||
|
|||||||
@ -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).
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -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;
|
||||||
|
|||||||
@ -1,47 +1,47 @@
|
|||||||
<?php
|
<?php
|
||||||
//============================================================+
|
//============================================================+
|
||||||
// File name : bul.php
|
// File name : bul.php
|
||||||
// Begin : 2004-03-03
|
// Begin : 2004-03-03
|
||||||
// Last Update : 2010-03-22
|
// Last Update : 2010-03-22
|
||||||
//
|
//
|
||||||
// Description : Language module for TCPDF
|
// Description : Language module for TCPDF
|
||||||
// (contains translated texts)
|
// (contains translated texts)
|
||||||
// Arabic
|
// Arabic
|
||||||
//
|
//
|
||||||
// Author: Nicola Asuni
|
// Author: Nicola Asuni
|
||||||
//
|
//
|
||||||
// (c) Copyright:
|
// (c) Copyright:
|
||||||
// Nicola Asuni
|
// Nicola Asuni
|
||||||
// Tecnick.com LTD
|
// Tecnick.com LTD
|
||||||
// Manor Coach House, Church Hill
|
// Manor Coach House, Church Hill
|
||||||
// Aldershot, Hants, GU12 4RQ
|
// Aldershot, Hants, GU12 4RQ
|
||||||
// UK
|
// UK
|
||||||
// www.tecnick.com
|
// www.tecnick.com
|
||||||
// info@tecnick.com
|
// info@tecnick.com
|
||||||
//============================================================+
|
//============================================================+
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TCPDF language file (contains translated texts).
|
* TCPDF language file (contains translated texts).
|
||||||
* @package com.tecnick.tcpdf
|
* @package com.tecnick.tcpdf
|
||||||
* @brief TCPDF language file: Bulgarian
|
* @brief TCPDF language file: Bulgarian
|
||||||
* @author Nicola Asuni
|
* @author Nicola Asuni
|
||||||
* @since 2012-03-22
|
* @since 2012-03-22
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Bulgarian
|
// Bulgarian
|
||||||
|
|
||||||
global $l;
|
global $l;
|
||||||
$l = Array();
|
$l = Array();
|
||||||
|
|
||||||
// PAGE META DESCRIPTORS --------------------------------------
|
// PAGE META DESCRIPTORS --------------------------------------
|
||||||
|
|
||||||
$l['a_meta_charset'] = 'UTF-8';
|
$l['a_meta_charset'] = 'UTF-8';
|
||||||
$l['a_meta_dir'] = 'ltr';
|
$l['a_meta_dir'] = 'ltr';
|
||||||
$l['a_meta_language'] = 'bg';
|
$l['a_meta_language'] = 'bg';
|
||||||
|
|
||||||
// TRANSLATIONS --------------------------------------
|
// TRANSLATIONS --------------------------------------
|
||||||
$l['w_page'] = 'страница';
|
$l['w_page'] = 'страница';
|
||||||
|
|
||||||
//============================================================+
|
//============================================================+
|
||||||
// END OF FILE
|
// END OF 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
|
||||||
|
|||||||
47
htdocs/includes/tcpdf/config/lang/ukr.php
Normal file
47
htdocs/includes/tcpdf/config/lang/ukr.php
Normal 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
|
||||||
|
//============================================================+
|
||||||
@ -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
|
||||||
|
|||||||
@ -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
@ -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;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user