Fix: modification du chemin

This commit is contained in:
Regis Houssin 2007-04-05 17:30:29 +00:00
parent 41fb66b438
commit 3444ec3239
5 changed files with 1972 additions and 1972 deletions

View File

@ -1,446 +1,446 @@
<?php
//
// fpdf_tpl - Version 1.0.2
//
// Copyright 2004,2005 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
require_once("fpdf.php");
class fpdf_tpl extends fpdf {
/**
* Array of Tpl-Data
* @var array
*/
var $tpls = array();
/**
* Current Template-ID
* @var int
*/
var $tpl = 0;
/**
* "In Template"-Flag
* @var boolean
*/
var $intpl = false;
/**
* 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 $tplprefix = "/TPL";
/**
* Nameprefix of Fonts used in Resources-Dictonary
* (not realy needed, but for future versions with import-function needed)
* @var string
*/
var $fontprefix = "/F";
/**
* Resources used By Templates and Pages
* @var array
*/
var $res = array();
/**
* Constructor
* See FPDF-Documentation
* @param string $orientation
* @param string $unit
* @param mixed $format
*/
function fpdf_tpl($orientation='P',$unit='mm',$format='A4') {
parent::fpdf($orientation,$unit,$format);
}
/**
* Start a Template
*
* 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.
* 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.
*
* 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.
* 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 $y The y-coordinate given in user-unit
* @param int $w The width given in user-unit
* @param int $h The height given in user-unit
* @return int The ID of new created Template
*/
function beginTemplate($x=null,$y=null,$w=null,$h=null) {
if ($this->page <= 0)
$this->error("You have to add a page to fpdf first!");
// Save settings
$this->tpl++;
$this->tpls[$this->tpl]['o_x'] = $this->x;
$this->tpls[$this->tpl]['o_y'] = $this->y;
$this->tpls[$this->tpl]['o_AutoPageBreak'] = $this->AutoPageBreak;
$this->tpls[$this->tpl]['o_bMargin'] = $this->bMargin;
$this->tpls[$this->tpl]['o_tMargin'] = $this->tMargin;
$this->tpls[$this->tpl]['o_lMargin'] = $this->lMargin;
$this->tpls[$this->tpl]['o_rMargin'] = $this->rMargin;
$this->tpls[$this->tpl]['o_h'] = $this->h;
$this->tpls[$this->tpl]['o_w'] = $this->w;
$this->SetAutoPageBreak(false);
if ($x == null)
$x = 0;
if ($y == null)
$y = 0;
if ($w == null)
$w = $this->w;
if ($h == null)
$h = $this->h;
// Define own high and width to calculate possitions correct
$this->h = $h;
$this->w = $w;
$this->tpls[$this->tpl]['buffer'] = "";
$this->tpls[$this->tpl]['x'] = $x;
$this->tpls[$this->tpl]['y'] = $y;
$this->tpls[$this->tpl]['w'] = $w;
$this->tpls[$this->tpl]['h'] = $h;
$this->intpl = true;
$this->SetXY($x+$this->lMargin,$y+$this->tMargin);
$this->SetRightMargin($this->w-$w+$this->rMargin);
return $this->tpl;
}
/**
* End Template
*
* 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.
*/
function endTemplate() {
if ($this->intpl) {
$this->intpl = false;
$this->SetAutoPageBreak($this->tpls[$this->tpl]['o_AutoPageBreak'],$this->tpls[$this->tpl]['o_bMargin']);
$this->SetXY($this->tpls[$this->tpl]['o_x'],$this->tpls[$this->tpl]['o_y']);
$this->tMargin = $this->tpls[$this->tpl]['o_tMargin'];
$this->lMargin = $this->tpls[$this->tpl]['o_lMargin'];
$this->rMargin = $this->tpls[$this->tpl]['o_rMargin'];
$this->h = $this->tpls[$this->tpl]['o_h'];
$this->w = $this->tpls[$this->tpl]['o_w'];
return $this->tpl;
} else {
return false;
}
}
/**
* Use a Template in current Page or other 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.
* 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
* beginTemplate() is used.
* The calculated or used width and height are returned as an array.
*
* @param int $tplidx A valid template-Id
* @param int $_x The x-position
* @param int $_y The y-position
* @param int $_w The new width of the template
* @param int $_h The new height of the template
* @retrun array The height and width of the template
*/
function useTemplate($tplidx, $_x=null, $_y=null, $_w=0, $_h=0) {
if ($this->page <= 0)
$this->error("You have to add a page to fpdf first!");
if (!$this->tpls[$tplidx])
$this->error("Template does not exist!");
if ($this->intpl) {
$this->res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx];
}
extract($this->tpls[$tplidx]);
if ($_x == null)
$_x = $x;
if ($_y == null)
$_y = $y;
$wh = $this->getTemplateSize($tplidx,$_w,$_h);
$_w = $wh['w'];
$_h = $wh['h'];
$this->_out(sprintf("q %.4f 0 0 %.4f %.2f %.2f cm", ($_w/$w), ($_h/$h), $_x*$this->k, ($this->h-($_y+$_h))*$this->k)); // Translate
$this->_out($this->tplprefix.$tplidx." Do Q");
return array("w" => $_w, "h" => $_h);
}
/**
* Get The calculated Size of a Template
*
* If one size is given, this method calculates the other one.
*
* @param int $tplidx A valid template-Id
* @param int $_w The width of the template
* @param int $_h The height of the template
* @return array The height and width of the template
*/
function getTemplateSize($tplidx, $_w=0, $_h=0) {
if (!$this->tpls[$tplidx])
return false;
extract($this->tpls[$tplidx]);
if ($_w == 0 and $_h == 0) {
$_w = $w;
$_h = $h;
}
if($_w==0)
$_w=$_h*$w/$h;
if($_h==0)
$_h=$_w*$h/$w;
return array("w" => $_w, "h" => $_h);
}
/**
* See FPDF-Documentation ;-)
*/
function SetFont($family,$style='',$size=0) {
//Select a font; size given in points
global $fpdf_charwidths;
$family=strtolower($family);
if($family=='')
$family=$this->FontFamily;
if($family=='arial')
$family='helvetica';
elseif($family=='symbol' or $family=='zapfdingbats')
$style='';
$style=strtoupper($style);
if(is_int(strpos($style,'U')))
{
$this->underline=true;
$style=str_replace('U','',$style);
}
else
$this->underline=false;
if($style=='IB')
$style='BI';
if($size==0)
$size=$this->FontSizePt;
//Test if font is already selected
if($this->FontFamily==$family and $this->FontStyle==$style and $this->FontSizePt==$size and !$this->intpl)
return;
//Test if used for the first time
$fontkey=$family.$style;
if(!isset($this->fonts[$fontkey]))
{
//Check if one of the standard fonts
if(isset($this->CoreFonts[$fontkey]))
{
if(!isset($fpdf_charwidths[$fontkey]))
{
//Load metric file
$file=$family;
if($family=='times' or $family=='helvetica')
$file.=strtolower($style);
$file.='.php';
if(defined('FPDF_FONTPATH'))
$file=FPDF_FONTPATH.$file;
include($file);
if(!isset($fpdf_charwidths[$fontkey]))
$this->Error('Could not include font metric file');
}
$i = $this->findNextAvailFont();
$this->fonts[$fontkey]=array('i'=>$i,'type'=>'core','name'=>$this->CoreFonts[$fontkey],'up'=>-100,'ut'=>50,'cw'=>$fpdf_charwidths[$fontkey]);
}
else
$this->Error('Undefined font: '.$family.' '.$style);
}
//Select it
$this->FontFamily=$family;
$this->FontStyle=$style;
$this->FontSizePt=$size;
$this->FontSize=$size/$this->k;
$this->CurrentFont=&$this->fonts[$fontkey];
if($this->page>0)
$this->_out(sprintf('BT '.$this->fontprefix.'%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
if ($this->intpl) {
$this->res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
} else {
$this->res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey];
}
}
/**
* Find the next available Font-No.
*
* @return int
*/
function findNextAvailFont() {
return count($this->fonts)+1;
}
/**
* See FPDF-Documentation ;-)
*/
function Image($file,$x,$y,$w=0,$h=0,$type='',$link='') {
parent::Image($file,$x,$y,$w,$h,$type,$link);
if ($this->intpl) {
$this->res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file];
} else {
$this->res['page'][$this->page]['images'][$file] =& $this->images[$file];
}
}
/**
* See FPDF-Documentation ;-)
*
* AddPage is not available when you're "in" a template.
*/
function AddPage($orientation='') {
if ($this->intpl)
$this->Error('Adding pages in templates isn\'t possible!');
parent::AddPage($orientation);
}
/**
* Preserve adding Links in Templates ...won't work
*/
function Link($x,$y,$w,$h,$link) {
if ($this->intpl)
$this->Error('Using links in templates aren\'t possible!');
parent::Link($x,$y,$w,$h,$link);
}
function AddLink() {
if ($this->intpl)
$this->Error('Adding links in templates aren\'t possible!');
return parent::AddLink();
}
function SetLink($link,$y=0,$page=-1) {
if ($this->intpl)
$this->Error('Setting links in templates aren\'t possible!');
parent::SetLink($link,$y,$page);
}
/**
* Private Method that writes the Resources-Objects
*/
function _puttemplates() {
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
reset($this->tpls);
foreach($this->tpls AS $tplidx => $tpl) {
$p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
$this->_newobj();
$this->tpls[$tplidx]['n'] = $this->n;
$this->_out('<<'.$filter.'/Type /XObject');
$this->_out('/Subtype /Form');
$this->_out('/FormType 1');
$this->_out(sprintf('/BBox [%.2f %.2f %.2f %.2f]',$tpl['x']*$this->k, ($tpl['h']-$tpl['y'])*$this->k, $tpl['w']*$this->k, ($tpl['h']-$tpl['y']-$tpl['h'])*$this->k)); // ($this->h-$tpl['y'])*$this->k
$this->_out('/Resources ');
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
if (count($this->res['tpl'][$tplidx]['fonts'])) {
$this->_out('/Font <<');
foreach($this->res['tpl'][$tplidx]['fonts'] as $font)
$this->_out($this->fontprefix.$font['i'].' '.$font['n'].' 0 R');
$this->_out('>>');
}
if(count($this->res['tpl'][$tplidx]['images']) || count($this->res['tpl'][$tplidx]['tpls']))
{
$this->_out('/XObject <<');
if (count($this->res['tpl'][$tplidx]['images'])) {
foreach($this->res['tpl'][$tplidx]['images'] as $image)
$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
}
if (count($this->res['tpl'][$tplidx]['tpls'])) {
foreach($this->res['tpl'][$tplidx]['tpls'] as $i => $tpl)
$this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R');
}
$this->_out('>>');
}
$this->_out('>>');
$this->_out('/Length '.strlen($p).' >>');
$this->_putstream($p);
$this->_out('endobj');
}
}
/**
* Private Method
*/
function _putresources() {
$this->_putfonts();
$this->_putimages();
$this->_puttemplates();
//Resource dictionary
$this->offsets[2]=strlen($this->buffer);
$this->_out('2 0 obj');
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
$this->_out('/Font <<');
foreach($this->fonts as $font)
$this->_out($this->fontprefix.$font['i'].' '.$font['n'].' 0 R');
$this->_out('>>');
if(count($this->images) || count($this->tpls))
{
$this->_out('/XObject <<');
if (count($this->images)) {
foreach($this->images as $image)
$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
}
if (count($this->tpls)) {
foreach($this->tpls as $tplidx => $tpl)
$this->_out($this->tplprefix.$tplidx.' '.$tpl['n'].' 0 R');
}
$this->_out('>>');
}
$this->_out('>>');
$this->_out('endobj');
}
/**
* Private Method
*/
function _out($s) {
//Add a line to the document
if ($this->state==2) {
if (!$this->intpl)
$this->pages[$this->page].=$s."\n";
else
$this->tpls[$this->tpl]['buffer'] .= $s."\n";
} else {
$this->buffer.=$s."\n";
}
}
}
<?php
//
// fpdf_tpl - Version 1.0.2
//
// Copyright 2004,2005 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
require_once(FPDF_PATH.'fpdf.php');
class fpdf_tpl extends fpdf {
/**
* Array of Tpl-Data
* @var array
*/
var $tpls = array();
/**
* Current Template-ID
* @var int
*/
var $tpl = 0;
/**
* "In Template"-Flag
* @var boolean
*/
var $intpl = false;
/**
* 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 $tplprefix = "/TPL";
/**
* Nameprefix of Fonts used in Resources-Dictonary
* (not realy needed, but for future versions with import-function needed)
* @var string
*/
var $fontprefix = "/F";
/**
* Resources used By Templates and Pages
* @var array
*/
var $res = array();
/**
* Constructor
* See FPDF-Documentation
* @param string $orientation
* @param string $unit
* @param mixed $format
*/
function fpdf_tpl($orientation='P',$unit='mm',$format='A4') {
parent::fpdf($orientation,$unit,$format);
}
/**
* Start a Template
*
* 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.
* 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.
*
* 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.
* 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 $y The y-coordinate given in user-unit
* @param int $w The width given in user-unit
* @param int $h The height given in user-unit
* @return int The ID of new created Template
*/
function beginTemplate($x=null,$y=null,$w=null,$h=null) {
if ($this->page <= 0)
$this->error("You have to add a page to fpdf first!");
// Save settings
$this->tpl++;
$this->tpls[$this->tpl]['o_x'] = $this->x;
$this->tpls[$this->tpl]['o_y'] = $this->y;
$this->tpls[$this->tpl]['o_AutoPageBreak'] = $this->AutoPageBreak;
$this->tpls[$this->tpl]['o_bMargin'] = $this->bMargin;
$this->tpls[$this->tpl]['o_tMargin'] = $this->tMargin;
$this->tpls[$this->tpl]['o_lMargin'] = $this->lMargin;
$this->tpls[$this->tpl]['o_rMargin'] = $this->rMargin;
$this->tpls[$this->tpl]['o_h'] = $this->h;
$this->tpls[$this->tpl]['o_w'] = $this->w;
$this->SetAutoPageBreak(false);
if ($x == null)
$x = 0;
if ($y == null)
$y = 0;
if ($w == null)
$w = $this->w;
if ($h == null)
$h = $this->h;
// Define own high and width to calculate possitions correct
$this->h = $h;
$this->w = $w;
$this->tpls[$this->tpl]['buffer'] = "";
$this->tpls[$this->tpl]['x'] = $x;
$this->tpls[$this->tpl]['y'] = $y;
$this->tpls[$this->tpl]['w'] = $w;
$this->tpls[$this->tpl]['h'] = $h;
$this->intpl = true;
$this->SetXY($x+$this->lMargin,$y+$this->tMargin);
$this->SetRightMargin($this->w-$w+$this->rMargin);
return $this->tpl;
}
/**
* End Template
*
* 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.
*/
function endTemplate() {
if ($this->intpl) {
$this->intpl = false;
$this->SetAutoPageBreak($this->tpls[$this->tpl]['o_AutoPageBreak'],$this->tpls[$this->tpl]['o_bMargin']);
$this->SetXY($this->tpls[$this->tpl]['o_x'],$this->tpls[$this->tpl]['o_y']);
$this->tMargin = $this->tpls[$this->tpl]['o_tMargin'];
$this->lMargin = $this->tpls[$this->tpl]['o_lMargin'];
$this->rMargin = $this->tpls[$this->tpl]['o_rMargin'];
$this->h = $this->tpls[$this->tpl]['o_h'];
$this->w = $this->tpls[$this->tpl]['o_w'];
return $this->tpl;
} else {
return false;
}
}
/**
* Use a Template in current Page or other 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.
* 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
* beginTemplate() is used.
* The calculated or used width and height are returned as an array.
*
* @param int $tplidx A valid template-Id
* @param int $_x The x-position
* @param int $_y The y-position
* @param int $_w The new width of the template
* @param int $_h The new height of the template
* @retrun array The height and width of the template
*/
function useTemplate($tplidx, $_x=null, $_y=null, $_w=0, $_h=0) {
if ($this->page <= 0)
$this->error("You have to add a page to fpdf first!");
if (!$this->tpls[$tplidx])
$this->error("Template does not exist!");
if ($this->intpl) {
$this->res['tpl'][$this->tpl]['tpls'][$tplidx] =& $this->tpls[$tplidx];
}
extract($this->tpls[$tplidx]);
if ($_x == null)
$_x = $x;
if ($_y == null)
$_y = $y;
$wh = $this->getTemplateSize($tplidx,$_w,$_h);
$_w = $wh['w'];
$_h = $wh['h'];
$this->_out(sprintf("q %.4f 0 0 %.4f %.2f %.2f cm", ($_w/$w), ($_h/$h), $_x*$this->k, ($this->h-($_y+$_h))*$this->k)); // Translate
$this->_out($this->tplprefix.$tplidx." Do Q");
return array("w" => $_w, "h" => $_h);
}
/**
* Get The calculated Size of a Template
*
* If one size is given, this method calculates the other one.
*
* @param int $tplidx A valid template-Id
* @param int $_w The width of the template
* @param int $_h The height of the template
* @return array The height and width of the template
*/
function getTemplateSize($tplidx, $_w=0, $_h=0) {
if (!$this->tpls[$tplidx])
return false;
extract($this->tpls[$tplidx]);
if ($_w == 0 and $_h == 0) {
$_w = $w;
$_h = $h;
}
if($_w==0)
$_w=$_h*$w/$h;
if($_h==0)
$_h=$_w*$h/$w;
return array("w" => $_w, "h" => $_h);
}
/**
* See FPDF-Documentation ;-)
*/
function SetFont($family,$style='',$size=0) {
//Select a font; size given in points
global $fpdf_charwidths;
$family=strtolower($family);
if($family=='')
$family=$this->FontFamily;
if($family=='arial')
$family='helvetica';
elseif($family=='symbol' or $family=='zapfdingbats')
$style='';
$style=strtoupper($style);
if(is_int(strpos($style,'U')))
{
$this->underline=true;
$style=str_replace('U','',$style);
}
else
$this->underline=false;
if($style=='IB')
$style='BI';
if($size==0)
$size=$this->FontSizePt;
//Test if font is already selected
if($this->FontFamily==$family and $this->FontStyle==$style and $this->FontSizePt==$size and !$this->intpl)
return;
//Test if used for the first time
$fontkey=$family.$style;
if(!isset($this->fonts[$fontkey]))
{
//Check if one of the standard fonts
if(isset($this->CoreFonts[$fontkey]))
{
if(!isset($fpdf_charwidths[$fontkey]))
{
//Load metric file
$file=$family;
if($family=='times' or $family=='helvetica')
$file.=strtolower($style);
$file.='.php';
if(defined('FPDF_FONTPATH'))
$file=FPDF_FONTPATH.$file;
include($file);
if(!isset($fpdf_charwidths[$fontkey]))
$this->Error('Could not include font metric file');
}
$i = $this->findNextAvailFont();
$this->fonts[$fontkey]=array('i'=>$i,'type'=>'core','name'=>$this->CoreFonts[$fontkey],'up'=>-100,'ut'=>50,'cw'=>$fpdf_charwidths[$fontkey]);
}
else
$this->Error('Undefined font: '.$family.' '.$style);
}
//Select it
$this->FontFamily=$family;
$this->FontStyle=$style;
$this->FontSizePt=$size;
$this->FontSize=$size/$this->k;
$this->CurrentFont=&$this->fonts[$fontkey];
if($this->page>0)
$this->_out(sprintf('BT '.$this->fontprefix.'%d %.2f Tf ET',$this->CurrentFont['i'],$this->FontSizePt));
if ($this->intpl) {
$this->res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
} else {
$this->res['page'][$this->page]['fonts'][$fontkey] =& $this->fonts[$fontkey];
}
}
/**
* Find the next available Font-No.
*
* @return int
*/
function findNextAvailFont() {
return count($this->fonts)+1;
}
/**
* See FPDF-Documentation ;-)
*/
function Image($file,$x,$y,$w=0,$h=0,$type='',$link='') {
parent::Image($file,$x,$y,$w,$h,$type,$link);
if ($this->intpl) {
$this->res['tpl'][$this->tpl]['images'][$file] =& $this->images[$file];
} else {
$this->res['page'][$this->page]['images'][$file] =& $this->images[$file];
}
}
/**
* See FPDF-Documentation ;-)
*
* AddPage is not available when you're "in" a template.
*/
function AddPage($orientation='') {
if ($this->intpl)
$this->Error('Adding pages in templates isn\'t possible!');
parent::AddPage($orientation);
}
/**
* Preserve adding Links in Templates ...won't work
*/
function Link($x,$y,$w,$h,$link) {
if ($this->intpl)
$this->Error('Using links in templates aren\'t possible!');
parent::Link($x,$y,$w,$h,$link);
}
function AddLink() {
if ($this->intpl)
$this->Error('Adding links in templates aren\'t possible!');
return parent::AddLink();
}
function SetLink($link,$y=0,$page=-1) {
if ($this->intpl)
$this->Error('Setting links in templates aren\'t possible!');
parent::SetLink($link,$y,$page);
}
/**
* Private Method that writes the Resources-Objects
*/
function _puttemplates() {
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
reset($this->tpls);
foreach($this->tpls AS $tplidx => $tpl) {
$p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
$this->_newobj();
$this->tpls[$tplidx]['n'] = $this->n;
$this->_out('<<'.$filter.'/Type /XObject');
$this->_out('/Subtype /Form');
$this->_out('/FormType 1');
$this->_out(sprintf('/BBox [%.2f %.2f %.2f %.2f]',$tpl['x']*$this->k, ($tpl['h']-$tpl['y'])*$this->k, $tpl['w']*$this->k, ($tpl['h']-$tpl['y']-$tpl['h'])*$this->k)); // ($this->h-$tpl['y'])*$this->k
$this->_out('/Resources ');
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
if (count($this->res['tpl'][$tplidx]['fonts'])) {
$this->_out('/Font <<');
foreach($this->res['tpl'][$tplidx]['fonts'] as $font)
$this->_out($this->fontprefix.$font['i'].' '.$font['n'].' 0 R');
$this->_out('>>');
}
if(count($this->res['tpl'][$tplidx]['images']) || count($this->res['tpl'][$tplidx]['tpls']))
{
$this->_out('/XObject <<');
if (count($this->res['tpl'][$tplidx]['images'])) {
foreach($this->res['tpl'][$tplidx]['images'] as $image)
$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
}
if (count($this->res['tpl'][$tplidx]['tpls'])) {
foreach($this->res['tpl'][$tplidx]['tpls'] as $i => $tpl)
$this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R');
}
$this->_out('>>');
}
$this->_out('>>');
$this->_out('/Length '.strlen($p).' >>');
$this->_putstream($p);
$this->_out('endobj');
}
}
/**
* Private Method
*/
function _putresources() {
$this->_putfonts();
$this->_putimages();
$this->_puttemplates();
//Resource dictionary
$this->offsets[2]=strlen($this->buffer);
$this->_out('2 0 obj');
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
$this->_out('/Font <<');
foreach($this->fonts as $font)
$this->_out($this->fontprefix.$font['i'].' '.$font['n'].' 0 R');
$this->_out('>>');
if(count($this->images) || count($this->tpls))
{
$this->_out('/XObject <<');
if (count($this->images)) {
foreach($this->images as $image)
$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
}
if (count($this->tpls)) {
foreach($this->tpls as $tplidx => $tpl)
$this->_out($this->tplprefix.$tplidx.' '.$tpl['n'].' 0 R');
}
$this->_out('>>');
}
$this->_out('>>');
$this->_out('endobj');
}
/**
* Private Method
*/
function _out($s) {
//Add a line to the document
if ($this->state==2) {
if (!$this->intpl)
$this->pages[$this->page].=$s."\n";
else
$this->tpls[$this->tpl]['buffer'] .= $s."\n";
} else {
$this->buffer.=$s."\n";
}
}
}
?>

View File

@ -1,413 +1,413 @@
<?php
//
// FPDI - Version 1.1
//
// Copyright 2004,2005 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
define ('PDF_TYPE_NULL', 0);
define ('PDF_TYPE_NUMERIC', 1);
define ('PDF_TYPE_TOKEN', 2);
define ('PDF_TYPE_HEX', 3);
define ('PDF_TYPE_STRING', 4);
define ('PDF_TYPE_DICTIONARY', 5);
define ('PDF_TYPE_ARRAY', 6);
define ('PDF_TYPE_OBJDEC', 7);
define ('PDF_TYPE_OBJREF', 8);
define ('PDF_TYPE_OBJECT', 9);
define ('PDF_TYPE_STREAM', 10);
ini_set('auto_detect_line_endings',1); // Strongly required!
require_once("fpdf_tpl.php");
require_once("fpdi_pdf_parser.php");
class fpdi extends fpdf_tpl {
/**
* Actual filename
* @var string
*/
var $current_filename;
/**
* Parser-Objects
* @var array
*/
var $parsers;
/**
* Current parser
* @var object
*/
var $current_parser;
/**
* FPDF/FPDI - PDF-Version
* @var double
*/
var $PDFVersion = 1.3;
/**
* Highest version of imported PDF
* @var double
*/
var $importVersion = 1.3;
/**
* object stack
* @var array
*/
var $obj_stack;
/**
* done object stack
* @var array
*/
var $don_obj_stack;
/**
* Current Object Id.
* @var integer
*/
var $current_obj_id;
/**
* Constructor
* See FPDF-Manual
*/
function fpdi($orientation='P',$unit='mm',$format='A4') {
parent::fpdf_tpl($orientation,$unit,$format);
}
/**
* Set a source-file
*
* @param string $filename a valid filename
* @return int number of available pages
*/
function setSourceFile($filename) {
$this->current_filename = $filename;
$fn =& $this->current_filename;
$this->parsers[$fn] = new fpdi_pdf_parser($fn,$this);
$this->current_parser =& $this->parsers[$fn];
return $this->parsers[$fn]->getPageCount();
}
/**
* Import a page
*
* @param int $pageno pagenumber
* @return int Index of imported page - to use with fpdf_tpl::useTemplate()
*/
function ImportPage($pageno) {
$fn =& $this->current_filename;
$this->parsers[$fn]->setPageno($pageno);
$this->tpl++;
$this->tpls[$this->tpl] = array();
$this->tpls[$this->tpl]['parser'] =& $this->parsers[$fn];
$this->tpls[$this->tpl]['resources'] = $this->parsers[$fn]->getPageResources();
$this->tpls[$this->tpl]['buffer'] = $this->parsers[$fn]->getContent();
// $mediabox holds the dimensions of the source page
$mediabox = $this->parsers[$fn]->getPageMediaBox($pageno);
// To build array that can used by pdf_tpl::useTemplate()
$this->tpls[$this->tpl] = array_merge($this->tpls[$this->tpl],$mediabox);
return $this->tpl;
}
/**
* Private method, that rebuilds all needed objects of source files
*/
function _putOobjects() {
if (is_array($this->parsers) && count($this->parsers) > 0) {
foreach($this->parsers AS $filename => $p) {
$this->current_parser =& $this->parsers[$filename];
if (is_array($this->obj_stack[$filename])) {
while($n = key($this->obj_stack[$filename])) {
$nObj = $this->current_parser->pdf_resolve_object($this->current_parser->c,$this->obj_stack[$filename][$n][1]);
$this->_newobj($this->obj_stack[$filename][$n][0]);
if ($nObj[0] == PDF_TYPE_STREAM) {
$this->pdf_write_value ($nObj);
} else {
$this->pdf_write_value ($nObj[1]);
}
$this->_out('endobj');
$this->obj_stack[$filename][$n] = null; // free memory
unset($this->obj_stack[$filename][$n]);
reset($this->obj_stack[$filename]);
}
}
}
}
}
/**
* Rewritten for handling own defined PDF-Versions
* only needed by FPDF 1.52
*/
function _begindoc() {
//Start document
$this->state=1;
}
/**
* Sets the PDF Version to the highest of imported documents
*/
function setVersion() {
if ($this->importVersion > $this->PDFVersion)
$this->PDFVersion = $this->importVersion;
if (!method_exists($this, '_putheader')) {
$this->buffer = '%PDF-'.$this->PDFVersion."\n".$this->buffer;
}
}
/**
* rewritten for handling higher PDF Versions
*/
function _enddoc() {
$this->setVersion();
parent::_enddoc();
}
/**
* Put resources
*/
function _putresources() {
$this->_putfonts();
$this->_putimages();
$this->_puttemplates();
$this->_putOobjects();
//Resource dictionary
$this->offsets[2]=strlen($this->buffer);
$this->_out('2 0 obj');
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
$this->_out('/Font <<');
foreach($this->fonts as $font)
$this->_out($this->fontprefix.$font['i'].' '.$font['n'].' 0 R');
$this->_out('>>');
if(count($this->images) || count($this->tpls))
{
$this->_out('/XObject <<');
if (count($this->images)) {
foreach($this->images as $image)
$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
}
if (count($this->tpls)) {
foreach($this->tpls as $tplidx => $tpl)
$this->_out($this->tplprefix.$tplidx.' '.$tpl['n'].' 0 R');
}
$this->_out('>>');
}
$this->_out('>>');
$this->_out('endobj');
}
/**
* Private Method that writes /XObjects - "Templates"
*/
function _puttemplates() {
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
reset($this->tpls);
foreach($this->tpls AS $tplidx => $tpl) {
$p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
$this->_newobj();
$this->tpls[$tplidx]['n'] = $this->n;
$this->_out('<<'.$filter.'/Type /XObject');
$this->_out('/Subtype /Form');
$this->_out('/FormType 1');
$this->_out(sprintf('/BBox [%.2f %.2f %.2f %.2f]',$tpl['x']*$this->k, ($tpl['h']-$tpl['y'])*$this->k, $tpl['w']*$this->k, ($tpl['h']-$tpl['y']-$tpl['h'])*$this->k));
$this->_out('/Resources ');
if ($tpl['resources']) {
$this->current_parser =& $tpl['parser'];
$this->pdf_write_value($tpl['resources']);
} else {
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
if (count($this->res['tpl'][$tplidx]['fonts'])) {
$this->_out('/Font <<');
foreach($this->res['tpl'][$tplidx]['fonts'] as $font)
$this->_out($this->fontprefix.$font['i'].' '.$font['n'].' 0 R');
$this->_out('>>');
}
if(count($this->res['tpl'][$tplidx]['images']) || count($this->res['tpl'][$tplidx]['tpls']))
{
$this->_out('/XObject <<');
if (count($this->res['tpl'][$tplidx]['images'])) {
foreach($this->res['tpl'][$tplidx]['images'] as $image)
$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
}
if (count($this->res['tpl'][$tplidx]['tpls'])) {
foreach($this->res['tpl'][$tplidx]['tpls'] as $i => $tpl)
$this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R');
}
$this->_out('>>');
}
$this->_out('>>');
}
$this->_out('/Length '.strlen($p).' >>');
$this->_putstream($p);
$this->_out('endobj');
}
}
/**
* Rewritten to handle existing own defined objects
*/
function _newobj($obj_id=false,$onlynewobj=false) {
if (!$obj_id) {
$obj_id = ++$this->n;
}
//Begin a new object
if (!$onlynewobj) {
$this->offsets[$obj_id]=strlen($this->buffer);
$this->_out($obj_id.' 0 obj');
$this->current_obj_id = $obj_id; // for later use with encryption
}
}
/**
* Writes a value
* Needed to rebuild the source document
*
* @param mixed $value A PDF-Value. Structure of values see cases in this method
*/
function pdf_write_value(&$value)
{
switch ($value[0]) {
case PDF_TYPE_NUMERIC :
case PDF_TYPE_TOKEN :
// A numeric value or a token.
// Simply output them
$this->_out($value[1]." ");
break;
case PDF_TYPE_ARRAY :
// An array. Output the proper
// structure and move on.
$this->_out("[",false);
for ($i = 0; $i < count($value[1]); $i++) {
$this->pdf_write_value($value[1][$i]);
}
$this->_out("]");
break;
case PDF_TYPE_DICTIONARY :
// A dictionary.
$this->_out("<<",false);
reset ($value[1]);
while (list($k, $v) = each($value[1])) {
$this->_out($k . " ",false);
$this->pdf_write_value($v);
}
$this->_out(">>");
break;
case PDF_TYPE_OBJREF :
// An indirect object reference
// Fill the object stack if needed
if (!isset($this->don_obj_stack[$this->current_parser->filename][$value[1]])) {
$this->_newobj(false,true);
$this->obj_stack[$this->current_parser->filename][$value[1]] = array($this->n,$value);
$this->don_obj_stack[$this->current_parser->filename][$value[1]] = array($this->n,$value);
}
$objid = $this->don_obj_stack[$this->current_parser->filename][$value[1]][0];
$this->_out("{$objid} 0 R"); //{$value[2]}
break;
case PDF_TYPE_STRING :
// A string.
$this->_out('(' . $value[1] . ')');
break;
case PDF_TYPE_STREAM :
// A stream. First, output the
// stream dictionary, then the
// stream data itself.
$this->pdf_write_value($value[1]);
$this->_out("stream");
$this->_out($value[2][1]);
$this->_out("endstream");
break;
case PDF_TYPE_HEX :
$this->_out("<" . $value[1] . ">");
break;
case PDF_TYPE_NULL :
// The null object.
$this->_out("null");
break;
}
}
/**
* Private Method
*/
function _out($s,$ln=true) {
//Add a line to the document
if ($this->state==2) {
if (!$this->intpl)
$this->pages[$this->page].=$s.($ln == true ? "\n" : '');
else
$this->tpls[$this->tpl]['buffer'] .= $s.($ln == true ? "\n" : '');
} else {
$this->buffer.=$s.($ln == true ? "\n" : '');
}
}
/**
* close all files opened by parsers
*/
function closeParsers() {
foreach ($this->parsers as $parser){
$parser->closeFile();
}
}
}
<?php
//
// FPDI - Version 1.1
//
// Copyright 2004,2005 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
define ('PDF_TYPE_NULL', 0);
define ('PDF_TYPE_NUMERIC', 1);
define ('PDF_TYPE_TOKEN', 2);
define ('PDF_TYPE_HEX', 3);
define ('PDF_TYPE_STRING', 4);
define ('PDF_TYPE_DICTIONARY', 5);
define ('PDF_TYPE_ARRAY', 6);
define ('PDF_TYPE_OBJDEC', 7);
define ('PDF_TYPE_OBJREF', 8);
define ('PDF_TYPE_OBJECT', 9);
define ('PDF_TYPE_STREAM', 10);
ini_set('auto_detect_line_endings',1); // Strongly required!
require_once(FPDF_PATH.'fpdf_tpl.php');
require_once(FPDF_PATH.'fpdi_pdf_parser.php');
class fpdi extends fpdf_tpl {
/**
* Actual filename
* @var string
*/
var $current_filename;
/**
* Parser-Objects
* @var array
*/
var $parsers;
/**
* Current parser
* @var object
*/
var $current_parser;
/**
* FPDF/FPDI - PDF-Version
* @var double
*/
var $PDFVersion = 1.3;
/**
* Highest version of imported PDF
* @var double
*/
var $importVersion = 1.3;
/**
* object stack
* @var array
*/
var $obj_stack;
/**
* done object stack
* @var array
*/
var $don_obj_stack;
/**
* Current Object Id.
* @var integer
*/
var $current_obj_id;
/**
* Constructor
* See FPDF-Manual
*/
function fpdi($orientation='P',$unit='mm',$format='A4') {
parent::fpdf_tpl($orientation,$unit,$format);
}
/**
* Set a source-file
*
* @param string $filename a valid filename
* @return int number of available pages
*/
function setSourceFile($filename) {
$this->current_filename = $filename;
$fn =& $this->current_filename;
$this->parsers[$fn] = new fpdi_pdf_parser($fn,$this);
$this->current_parser =& $this->parsers[$fn];
return $this->parsers[$fn]->getPageCount();
}
/**
* Import a page
*
* @param int $pageno pagenumber
* @return int Index of imported page - to use with fpdf_tpl::useTemplate()
*/
function ImportPage($pageno) {
$fn =& $this->current_filename;
$this->parsers[$fn]->setPageno($pageno);
$this->tpl++;
$this->tpls[$this->tpl] = array();
$this->tpls[$this->tpl]['parser'] =& $this->parsers[$fn];
$this->tpls[$this->tpl]['resources'] = $this->parsers[$fn]->getPageResources();
$this->tpls[$this->tpl]['buffer'] = $this->parsers[$fn]->getContent();
// $mediabox holds the dimensions of the source page
$mediabox = $this->parsers[$fn]->getPageMediaBox($pageno);
// To build array that can used by pdf_tpl::useTemplate()
$this->tpls[$this->tpl] = array_merge($this->tpls[$this->tpl],$mediabox);
return $this->tpl;
}
/**
* Private method, that rebuilds all needed objects of source files
*/
function _putOobjects() {
if (is_array($this->parsers) && count($this->parsers) > 0) {
foreach($this->parsers AS $filename => $p) {
$this->current_parser =& $this->parsers[$filename];
if (is_array($this->obj_stack[$filename])) {
while($n = key($this->obj_stack[$filename])) {
$nObj = $this->current_parser->pdf_resolve_object($this->current_parser->c,$this->obj_stack[$filename][$n][1]);
$this->_newobj($this->obj_stack[$filename][$n][0]);
if ($nObj[0] == PDF_TYPE_STREAM) {
$this->pdf_write_value ($nObj);
} else {
$this->pdf_write_value ($nObj[1]);
}
$this->_out('endobj');
$this->obj_stack[$filename][$n] = null; // free memory
unset($this->obj_stack[$filename][$n]);
reset($this->obj_stack[$filename]);
}
}
}
}
}
/**
* Rewritten for handling own defined PDF-Versions
* only needed by FPDF 1.52
*/
function _begindoc() {
//Start document
$this->state=1;
}
/**
* Sets the PDF Version to the highest of imported documents
*/
function setVersion() {
if ($this->importVersion > $this->PDFVersion)
$this->PDFVersion = $this->importVersion;
if (!method_exists($this, '_putheader')) {
$this->buffer = '%PDF-'.$this->PDFVersion."\n".$this->buffer;
}
}
/**
* rewritten for handling higher PDF Versions
*/
function _enddoc() {
$this->setVersion();
parent::_enddoc();
}
/**
* Put resources
*/
function _putresources() {
$this->_putfonts();
$this->_putimages();
$this->_puttemplates();
$this->_putOobjects();
//Resource dictionary
$this->offsets[2]=strlen($this->buffer);
$this->_out('2 0 obj');
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
$this->_out('/Font <<');
foreach($this->fonts as $font)
$this->_out($this->fontprefix.$font['i'].' '.$font['n'].' 0 R');
$this->_out('>>');
if(count($this->images) || count($this->tpls))
{
$this->_out('/XObject <<');
if (count($this->images)) {
foreach($this->images as $image)
$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
}
if (count($this->tpls)) {
foreach($this->tpls as $tplidx => $tpl)
$this->_out($this->tplprefix.$tplidx.' '.$tpl['n'].' 0 R');
}
$this->_out('>>');
}
$this->_out('>>');
$this->_out('endobj');
}
/**
* Private Method that writes /XObjects - "Templates"
*/
function _puttemplates() {
$filter=($this->compress) ? '/Filter /FlateDecode ' : '';
reset($this->tpls);
foreach($this->tpls AS $tplidx => $tpl) {
$p=($this->compress) ? gzcompress($tpl['buffer']) : $tpl['buffer'];
$this->_newobj();
$this->tpls[$tplidx]['n'] = $this->n;
$this->_out('<<'.$filter.'/Type /XObject');
$this->_out('/Subtype /Form');
$this->_out('/FormType 1');
$this->_out(sprintf('/BBox [%.2f %.2f %.2f %.2f]',$tpl['x']*$this->k, ($tpl['h']-$tpl['y'])*$this->k, $tpl['w']*$this->k, ($tpl['h']-$tpl['y']-$tpl['h'])*$this->k));
$this->_out('/Resources ');
if ($tpl['resources']) {
$this->current_parser =& $tpl['parser'];
$this->pdf_write_value($tpl['resources']);
} else {
$this->_out('<</ProcSet [/PDF /Text /ImageB /ImageC /ImageI]');
if (count($this->res['tpl'][$tplidx]['fonts'])) {
$this->_out('/Font <<');
foreach($this->res['tpl'][$tplidx]['fonts'] as $font)
$this->_out($this->fontprefix.$font['i'].' '.$font['n'].' 0 R');
$this->_out('>>');
}
if(count($this->res['tpl'][$tplidx]['images']) || count($this->res['tpl'][$tplidx]['tpls']))
{
$this->_out('/XObject <<');
if (count($this->res['tpl'][$tplidx]['images'])) {
foreach($this->res['tpl'][$tplidx]['images'] as $image)
$this->_out('/I'.$image['i'].' '.$image['n'].' 0 R');
}
if (count($this->res['tpl'][$tplidx]['tpls'])) {
foreach($this->res['tpl'][$tplidx]['tpls'] as $i => $tpl)
$this->_out($this->tplprefix.$i.' '.$tpl['n'].' 0 R');
}
$this->_out('>>');
}
$this->_out('>>');
}
$this->_out('/Length '.strlen($p).' >>');
$this->_putstream($p);
$this->_out('endobj');
}
}
/**
* Rewritten to handle existing own defined objects
*/
function _newobj($obj_id=false,$onlynewobj=false) {
if (!$obj_id) {
$obj_id = ++$this->n;
}
//Begin a new object
if (!$onlynewobj) {
$this->offsets[$obj_id]=strlen($this->buffer);
$this->_out($obj_id.' 0 obj');
$this->current_obj_id = $obj_id; // for later use with encryption
}
}
/**
* Writes a value
* Needed to rebuild the source document
*
* @param mixed $value A PDF-Value. Structure of values see cases in this method
*/
function pdf_write_value(&$value)
{
switch ($value[0]) {
case PDF_TYPE_NUMERIC :
case PDF_TYPE_TOKEN :
// A numeric value or a token.
// Simply output them
$this->_out($value[1]." ");
break;
case PDF_TYPE_ARRAY :
// An array. Output the proper
// structure and move on.
$this->_out("[",false);
for ($i = 0; $i < count($value[1]); $i++) {
$this->pdf_write_value($value[1][$i]);
}
$this->_out("]");
break;
case PDF_TYPE_DICTIONARY :
// A dictionary.
$this->_out("<<",false);
reset ($value[1]);
while (list($k, $v) = each($value[1])) {
$this->_out($k . " ",false);
$this->pdf_write_value($v);
}
$this->_out(">>");
break;
case PDF_TYPE_OBJREF :
// An indirect object reference
// Fill the object stack if needed
if (!isset($this->don_obj_stack[$this->current_parser->filename][$value[1]])) {
$this->_newobj(false,true);
$this->obj_stack[$this->current_parser->filename][$value[1]] = array($this->n,$value);
$this->don_obj_stack[$this->current_parser->filename][$value[1]] = array($this->n,$value);
}
$objid = $this->don_obj_stack[$this->current_parser->filename][$value[1]][0];
$this->_out("{$objid} 0 R"); //{$value[2]}
break;
case PDF_TYPE_STRING :
// A string.
$this->_out('(' . $value[1] . ')');
break;
case PDF_TYPE_STREAM :
// A stream. First, output the
// stream dictionary, then the
// stream data itself.
$this->pdf_write_value($value[1]);
$this->_out("stream");
$this->_out($value[2][1]);
$this->_out("endstream");
break;
case PDF_TYPE_HEX :
$this->_out("<" . $value[1] . ">");
break;
case PDF_TYPE_NULL :
// The null object.
$this->_out("null");
break;
}
}
/**
* Private Method
*/
function _out($s,$ln=true) {
//Add a line to the document
if ($this->state==2) {
if (!$this->intpl)
$this->pages[$this->page].=$s.($ln == true ? "\n" : '');
else
$this->tpls[$this->tpl]['buffer'] .= $s.($ln == true ? "\n" : '');
} else {
$this->buffer.=$s.($ln == true ? "\n" : '');
}
}
/**
* close all files opened by parsers
*/
function closeParsers() {
foreach ($this->parsers as $parser){
$parser->closeFile();
}
}
}
?>

View File

@ -1,482 +1,482 @@
<?php
//
// FPDI - Version 1.1
//
// Copyright 2004,2005 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
if (!defined ('PDF_TYPE_NULL'))
define ('PDF_TYPE_NULL', 0);
if (!defined ('PDF_TYPE_NUMERIC'))
define ('PDF_TYPE_NUMERIC', 1);
if (!defined ('PDF_TYPE_TOKEN'))
define ('PDF_TYPE_TOKEN', 2);
if (!defined ('PDF_TYPE_HEX'))
define ('PDF_TYPE_HEX', 3);
if (!defined ('PDF_TYPE_STRING'))
define ('PDF_TYPE_STRING', 4);
if (!defined ('PDF_TYPE_DICTIONARY'))
define ('PDF_TYPE_DICTIONARY', 5);
if (!defined ('PDF_TYPE_ARRAY'))
define ('PDF_TYPE_ARRAY', 6);
if (!defined ('PDF_TYPE_OBJDEC'))
define ('PDF_TYPE_OBJDEC', 7);
if (!defined ('PDF_TYPE_OBJREF'))
define ('PDF_TYPE_OBJREF', 8);
if (!defined ('PDF_TYPE_OBJECT'))
define ('PDF_TYPE_OBJECT', 9);
if (!defined ('PDF_TYPE_STREAM'))
define ('PDF_TYPE_STREAM', 10);
require_once("wrapper_functions.php");
require_once("pdf_parser.php");
class fpdi_pdf_parser extends pdf_parser {
/**
* Pages
* Index beginns at 0
*
* @var array
*/
var $pages;
/**
* Page count
* @var integer
*/
var $page_count;
/**
* actual page number
* @var integer
*/
var $pageno;
/**
* PDF Version of imported Document
* @var string
*/
var $pdfVersion;
/**
* FPDI Reference
* @var object
*/
var $fpdi;
/**
* Constructor
*
* @param string $filename Source-Filename
* @param object $fpdi Object of type fpdi
*/
function fpdi_pdf_parser($filename,&$fpdi) {
$this->fpdi =& $fpdi;
$this->filename = $filename;
parent::pdf_parser($filename);
// Get Info
$this->getInfo();
// resolve Pages-Dictonary
$pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']);
// Read pages
$this->read_pages($this->c, $pages, $this->pages);
// count pages;
$this->page_count = count($this->pages);
}
/**
* Overwrite parent::error()
*
* @param string $msg Error-Message
*/
function error($msg) {
$this->fpdi->error($msg);
}
/**
* Get pagecount from sourcefile
*
* @return int
*/
function getPageCount() {
return $this->page_count;
}
/**
* Set pageno
*
* @param int $pageno Pagenumber to use
*/
function setPageno($pageno) {
$pageno-=1;
if ($pageno < 0 || $pageno >= $this->getPageCount()) {
$this->fpdi->error("Pagenumber is wrong!");
}
$this->pageno = $pageno;
}
/**
* Get page-resources from current page
*
* @return array
*/
function getPageResources() {
return $this->_getPageResources($this->pages[$this->pageno]);
}
/**
* Get page-resources from /Page
*
* @param array $obj Array of pdf-data
*/
function _getPageResources ($obj) { // $obj = /Page
$obj = $this->pdf_resolve_object($this->c, $obj);
// If the current object has a resources
// dictionary associated with it, we use
// it. Otherwise, we move back to its
// parent object.
if (isset ($obj[1][1]['/Resources'])) {
$res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Resources']);
if ($res[0] == PDF_TYPE_OBJECT)
return $res[1];
return $res;
} else {
if (!isset ($obj[1][1]['/Parent'])) {
return false;
} else {
$res = $this->_getPageResources($obj[1][1]['/Parent']);
if ($res[0] == PDF_TYPE_OBJECT)
return $res[1];
return $res;
}
}
}
function getInfo() {
$avail_infos = array("Title", "Author", "Subject", "Keywords", "Creator", "Producer", "CreationDate", "ModDate", "Trapped");
$_infos = $this->pdf_resolve_object($this->c,$this->xref['trailer'][1]['/Info']);
$infos = array();
foreach ($avail_infos AS $info) {
if (isset($_infos[1][1]["/".$info])) {
if ($_infos[1][1]["/".$info][0] == PDF_TYPE_STRING) {
$infos[$info] = $this->deescapeString($_infos[1][1]["/".$info][1]);
} else if ($_infos[1][1]["/".$info][0] == PDF_TYPE_HEX) {
$infos[$info] = $this->hex2String($_infos[1][1]["/".$info][1]);
}
}
}
$this->infos = $infos;
}
/**
* Rebuilds a hexstring to string
*
* @param string $hex hexstring
* @return string
*/
function hex2String($hex) {
$endian = false;
if (preg_match("/^FEFF/",$hex)) { // is utf-16 aka big endian
$i = 4;
$endian = "big";
} else if (preg_match("/^FFFE/",$hex)) { // is utf-16 aka little endian
$i = 4;
$endian = "little";
} else {
$i = 0;
}
$s = "";
$l = strlen($hex);
for (; $i < $l; $i+=2) {
if (!$endian) {
$s .= chr(hexdec($hex[$i].(isset($hex[$i+1]) ? $hex[$i+1] : '0')));
} else {
if ($endian == "big") {
$_c = $hex[$i].$hex[$i+1];
$i+=2;
$c = $hex[$i].$hex[$i+1];
if ($_c != "00") {
$s .= "?";
continue;
} else {
$s .= chr(hexdec($c));
continue;
}
} else if ($endian == "little") {
$c = $hex[$i].$hex[$i+1];
$i+=2;
$_c = $hex[$i].$hex[$i+1];
if ($_c != "00") {
$s .= "?";
continue;
} else {
$s .= chr(hexdec($c));
continue;
}
}
}
}
return $s;
}
function deescapeString($s) {
$torepl = array("/\\\(\d{1,3})/e" => "chr(octdec(\\1))",
"/\\\\\(/" => "(",
"/\\\\\)/" => ")");
return preg_replace(array_keys($torepl),$torepl,$s);
}
/**
* Get content of current page
*
* If more /Contents is an array, the streams are concated
*
* @return string
*/
function getContent() {
$buffer = "";
$contents = $this->getPageContent($this->pages[$this->pageno][1][1]['/Contents']);
foreach($contents AS $tmp_content) {
$buffer .= $this->rebuildContentStream($tmp_content);
}
return $buffer;
}
/**
* Resolve all content-objects
*
* @param array $content_ref
* @return array
*/
function getPageContent($content_ref) {
$contents = array();
if ($content_ref[0] == PDF_TYPE_OBJREF) {
$content = $this->pdf_resolve_object($this->c, $content_ref);
if ($content[1][0] == PDF_TYPE_ARRAY) {
$contents = $this->getPageContent($content[1]);
} else {
$contents[] = $content;
}
} else if ($content_ref[0] == PDF_TYPE_ARRAY) {
foreach ($content_ref[1] AS $tmp_content_ref) {
$contents = array_merge($contents,$this->getPageContent($tmp_content_ref));
}
}
return $contents;
}
/**
* Rebuild content-streams
* only non-compressed streams and /FlateDecode are ready!
*
* @param array $obj
* @return string
*/
function rebuildContentStream($obj) {
$filters = array();
if (isset($obj[1][1]['/Filter'])) {
$_filter = $obj[1][1]['/Filter'];
if ($_filter[0] == PDF_TYPE_TOKEN) {
$filters[] = $_filter;
} else if ($_filter[0] == PDF_TYPE_ARRAY) {
$filters = $_filter[1];
}
}
$stream = $obj[2][1];
foreach ($filters AS $_filter) {
switch ($_filter[1]) {
case "/FlateDecode":
if (function_exists('gzuncompress')) {
$stream = @gzuncompress($stream);
} else {
$this->fpdi->error(sprintf("To handle %s filter, please compile php with zlib support.",$_filter[1]));
}
if ($stream === false) {
$this->fpdi->error("Error while decompressing string.");
}
break;
case "/LZWDecode":
@include_once("decoders/lzw.php");
if (class_exists("LZWDecode")) {
$lzwdec = new LZWDecode($this->fpdi);
$stream = $lzwdec->decode($stream);
} else {
$this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1]));
}
break;
case "/ASCII85Decode":
@include_once("decoders/ascii85.php");
if (class_exists("ASCII85Decode")) {
$ascii85 = new ASCII85Decode($this->fpdi);
$stream = $ascii85->decode(trim($stream));
} else {
$this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1]));
}
break;
case null:
$stream = $stream;
break;
default:
$this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1]));
}
}
return $stream;
}
/**
* Get MediaBox
*
* gets an array that describes the size of a page.
*
* @param integer $pageno
* @return array @see getPageBox()
*/
function getPageMediaBox($pageno) {
return $this->getPageBox($this->pages[$pageno-1],"/MediaBox");
}
/**
* Get a Box from a page
* Arrayformat is same as used by fpdf_tpl
*
* @param array $page a /Page
* @param string $box_index Type of Box @see getPageBoxes()
* @return array
*/
function getPageBox($page, $box_index) {
$page = $this->pdf_resolve_object($this->c,$page);
$box = null;
if (isset($page[1][1][$box_index]))
$box =& $page[1][1][$box_index];
if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) {
$tmp_box = $this->pdf_resolve_object($this->c,$box);
$box = $tmp_box[1];
}
if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) {
$b =& $box[1];
return array("x" => $b[0][1]/$this->fpdi->k,
"y" => $b[1][1]/$this->fpdi->k,
"w" => $b[2][1]/$this->fpdi->k,
"h" => $b[3][1]/$this->fpdi->k);
} else if (!isset ($page[1][1]['/Parent'])) {
return false;
} else {
return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index);
}
}
/**
* Get all Boxes from /Page
*
* @param array a /Page
* @return array
*/
function getPageBoxes($page) {
$_boxes = array("/MediaBox","/CropBox","/BleedBox","/TrimBox","/ArtBox");
$boxes = array();
foreach($_boxes AS $box) {
if ($_box = $this->getPageBox($page,$box)) {
$boxes[$box] = $_box;
}
}
return $boxes;
}
/**
* Read all /Page(es)
*
* @param object pdf_context
* @param array /Pages
* @param array the result-array
*/
function read_pages (&$c, &$pages, &$result) {
// Get the kids dictionary
$kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']);
if (!is_array($kids))
$this->fpdi->Error("Cannot find /Kids in current /Page-Dictionary");
foreach ($kids[1] as $v) {
$pg = $this->pdf_resolve_object ($c, $v);
#print_r($pg);
if ($pg[1][1]['/Type'][1] === '/Pages') {
// If one of the kids is an embedded
// /Pages array, resolve it as well.
$this->read_pages ($c, $pg, $result);
} else {
$result[] = $pg;
}
}
}
/**
* Get PDF-Version
*
* And reset the PDF Version used in FPDI if needed
*/
function getPDFVersion() {
parent::getPDFVersion();
if (isset($this->fpdi->importVersion) && $this->pdfVersion > $this->fpdi->importVersion) {
$this->fpdi->importVersion = $this->pdfVersion;
}
}
}
<?php
//
// FPDI - Version 1.1
//
// Copyright 2004,2005 Setasign - Jan Slabon
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
if (!defined ('PDF_TYPE_NULL'))
define ('PDF_TYPE_NULL', 0);
if (!defined ('PDF_TYPE_NUMERIC'))
define ('PDF_TYPE_NUMERIC', 1);
if (!defined ('PDF_TYPE_TOKEN'))
define ('PDF_TYPE_TOKEN', 2);
if (!defined ('PDF_TYPE_HEX'))
define ('PDF_TYPE_HEX', 3);
if (!defined ('PDF_TYPE_STRING'))
define ('PDF_TYPE_STRING', 4);
if (!defined ('PDF_TYPE_DICTIONARY'))
define ('PDF_TYPE_DICTIONARY', 5);
if (!defined ('PDF_TYPE_ARRAY'))
define ('PDF_TYPE_ARRAY', 6);
if (!defined ('PDF_TYPE_OBJDEC'))
define ('PDF_TYPE_OBJDEC', 7);
if (!defined ('PDF_TYPE_OBJREF'))
define ('PDF_TYPE_OBJREF', 8);
if (!defined ('PDF_TYPE_OBJECT'))
define ('PDF_TYPE_OBJECT', 9);
if (!defined ('PDF_TYPE_STREAM'))
define ('PDF_TYPE_STREAM', 10);
require_once(FPDF_PATH.'wrapper_functions.php');
require_once(FPDF_PATH.'pdf_parser.php');
class fpdi_pdf_parser extends pdf_parser {
/**
* Pages
* Index beginns at 0
*
* @var array
*/
var $pages;
/**
* Page count
* @var integer
*/
var $page_count;
/**
* actual page number
* @var integer
*/
var $pageno;
/**
* PDF Version of imported Document
* @var string
*/
var $pdfVersion;
/**
* FPDI Reference
* @var object
*/
var $fpdi;
/**
* Constructor
*
* @param string $filename Source-Filename
* @param object $fpdi Object of type fpdi
*/
function fpdi_pdf_parser($filename,&$fpdi) {
$this->fpdi =& $fpdi;
$this->filename = $filename;
parent::pdf_parser($filename);
// Get Info
$this->getInfo();
// resolve Pages-Dictonary
$pages = $this->pdf_resolve_object($this->c, $this->root[1][1]['/Pages']);
// Read pages
$this->read_pages($this->c, $pages, $this->pages);
// count pages;
$this->page_count = count($this->pages);
}
/**
* Overwrite parent::error()
*
* @param string $msg Error-Message
*/
function error($msg) {
$this->fpdi->error($msg);
}
/**
* Get pagecount from sourcefile
*
* @return int
*/
function getPageCount() {
return $this->page_count;
}
/**
* Set pageno
*
* @param int $pageno Pagenumber to use
*/
function setPageno($pageno) {
$pageno-=1;
if ($pageno < 0 || $pageno >= $this->getPageCount()) {
$this->fpdi->error("Pagenumber is wrong!");
}
$this->pageno = $pageno;
}
/**
* Get page-resources from current page
*
* @return array
*/
function getPageResources() {
return $this->_getPageResources($this->pages[$this->pageno]);
}
/**
* Get page-resources from /Page
*
* @param array $obj Array of pdf-data
*/
function _getPageResources ($obj) { // $obj = /Page
$obj = $this->pdf_resolve_object($this->c, $obj);
// If the current object has a resources
// dictionary associated with it, we use
// it. Otherwise, we move back to its
// parent object.
if (isset ($obj[1][1]['/Resources'])) {
$res = $this->pdf_resolve_object($this->c, $obj[1][1]['/Resources']);
if ($res[0] == PDF_TYPE_OBJECT)
return $res[1];
return $res;
} else {
if (!isset ($obj[1][1]['/Parent'])) {
return false;
} else {
$res = $this->_getPageResources($obj[1][1]['/Parent']);
if ($res[0] == PDF_TYPE_OBJECT)
return $res[1];
return $res;
}
}
}
function getInfo() {
$avail_infos = array("Title", "Author", "Subject", "Keywords", "Creator", "Producer", "CreationDate", "ModDate", "Trapped");
$_infos = $this->pdf_resolve_object($this->c,$this->xref['trailer'][1]['/Info']);
$infos = array();
foreach ($avail_infos AS $info) {
if (isset($_infos[1][1]["/".$info])) {
if ($_infos[1][1]["/".$info][0] == PDF_TYPE_STRING) {
$infos[$info] = $this->deescapeString($_infos[1][1]["/".$info][1]);
} else if ($_infos[1][1]["/".$info][0] == PDF_TYPE_HEX) {
$infos[$info] = $this->hex2String($_infos[1][1]["/".$info][1]);
}
}
}
$this->infos = $infos;
}
/**
* Rebuilds a hexstring to string
*
* @param string $hex hexstring
* @return string
*/
function hex2String($hex) {
$endian = false;
if (preg_match("/^FEFF/",$hex)) { // is utf-16 aka big endian
$i = 4;
$endian = "big";
} else if (preg_match("/^FFFE/",$hex)) { // is utf-16 aka little endian
$i = 4;
$endian = "little";
} else {
$i = 0;
}
$s = "";
$l = strlen($hex);
for (; $i < $l; $i+=2) {
if (!$endian) {
$s .= chr(hexdec($hex[$i].(isset($hex[$i+1]) ? $hex[$i+1] : '0')));
} else {
if ($endian == "big") {
$_c = $hex[$i].$hex[$i+1];
$i+=2;
$c = $hex[$i].$hex[$i+1];
if ($_c != "00") {
$s .= "?";
continue;
} else {
$s .= chr(hexdec($c));
continue;
}
} else if ($endian == "little") {
$c = $hex[$i].$hex[$i+1];
$i+=2;
$_c = $hex[$i].$hex[$i+1];
if ($_c != "00") {
$s .= "?";
continue;
} else {
$s .= chr(hexdec($c));
continue;
}
}
}
}
return $s;
}
function deescapeString($s) {
$torepl = array("/\\\(\d{1,3})/e" => "chr(octdec(\\1))",
"/\\\\\(/" => "(",
"/\\\\\)/" => ")");
return preg_replace(array_keys($torepl),$torepl,$s);
}
/**
* Get content of current page
*
* If more /Contents is an array, the streams are concated
*
* @return string
*/
function getContent() {
$buffer = "";
$contents = $this->getPageContent($this->pages[$this->pageno][1][1]['/Contents']);
foreach($contents AS $tmp_content) {
$buffer .= $this->rebuildContentStream($tmp_content);
}
return $buffer;
}
/**
* Resolve all content-objects
*
* @param array $content_ref
* @return array
*/
function getPageContent($content_ref) {
$contents = array();
if ($content_ref[0] == PDF_TYPE_OBJREF) {
$content = $this->pdf_resolve_object($this->c, $content_ref);
if ($content[1][0] == PDF_TYPE_ARRAY) {
$contents = $this->getPageContent($content[1]);
} else {
$contents[] = $content;
}
} else if ($content_ref[0] == PDF_TYPE_ARRAY) {
foreach ($content_ref[1] AS $tmp_content_ref) {
$contents = array_merge($contents,$this->getPageContent($tmp_content_ref));
}
}
return $contents;
}
/**
* Rebuild content-streams
* only non-compressed streams and /FlateDecode are ready!
*
* @param array $obj
* @return string
*/
function rebuildContentStream($obj) {
$filters = array();
if (isset($obj[1][1]['/Filter'])) {
$_filter = $obj[1][1]['/Filter'];
if ($_filter[0] == PDF_TYPE_TOKEN) {
$filters[] = $_filter;
} else if ($_filter[0] == PDF_TYPE_ARRAY) {
$filters = $_filter[1];
}
}
$stream = $obj[2][1];
foreach ($filters AS $_filter) {
switch ($_filter[1]) {
case "/FlateDecode":
if (function_exists('gzuncompress')) {
$stream = @gzuncompress($stream);
} else {
$this->fpdi->error(sprintf("To handle %s filter, please compile php with zlib support.",$_filter[1]));
}
if ($stream === false) {
$this->fpdi->error("Error while decompressing string.");
}
break;
case "/LZWDecode":
@include_once("decoders/lzw.php");
if (class_exists("LZWDecode")) {
$lzwdec = new LZWDecode($this->fpdi);
$stream = $lzwdec->decode($stream);
} else {
$this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1]));
}
break;
case "/ASCII85Decode":
@include_once("decoders/ascii85.php");
if (class_exists("ASCII85Decode")) {
$ascii85 = new ASCII85Decode($this->fpdi);
$stream = $ascii85->decode(trim($stream));
} else {
$this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1]));
}
break;
case null:
$stream = $stream;
break;
default:
$this->fpdi->error(sprintf("Unsupported Filter: %s",$_filter[1]));
}
}
return $stream;
}
/**
* Get MediaBox
*
* gets an array that describes the size of a page.
*
* @param integer $pageno
* @return array @see getPageBox()
*/
function getPageMediaBox($pageno) {
return $this->getPageBox($this->pages[$pageno-1],"/MediaBox");
}
/**
* Get a Box from a page
* Arrayformat is same as used by fpdf_tpl
*
* @param array $page a /Page
* @param string $box_index Type of Box @see getPageBoxes()
* @return array
*/
function getPageBox($page, $box_index) {
$page = $this->pdf_resolve_object($this->c,$page);
$box = null;
if (isset($page[1][1][$box_index]))
$box =& $page[1][1][$box_index];
if (!is_null($box) && $box[0] == PDF_TYPE_OBJREF) {
$tmp_box = $this->pdf_resolve_object($this->c,$box);
$box = $tmp_box[1];
}
if (!is_null($box) && $box[0] == PDF_TYPE_ARRAY) {
$b =& $box[1];
return array("x" => $b[0][1]/$this->fpdi->k,
"y" => $b[1][1]/$this->fpdi->k,
"w" => $b[2][1]/$this->fpdi->k,
"h" => $b[3][1]/$this->fpdi->k);
} else if (!isset ($page[1][1]['/Parent'])) {
return false;
} else {
return $this->getPageBox($this->pdf_resolve_object($this->c, $page[1][1]['/Parent']), $box_index);
}
}
/**
* Get all Boxes from /Page
*
* @param array a /Page
* @return array
*/
function getPageBoxes($page) {
$_boxes = array("/MediaBox","/CropBox","/BleedBox","/TrimBox","/ArtBox");
$boxes = array();
foreach($_boxes AS $box) {
if ($_box = $this->getPageBox($page,$box)) {
$boxes[$box] = $_box;
}
}
return $boxes;
}
/**
* Read all /Page(es)
*
* @param object pdf_context
* @param array /Pages
* @param array the result-array
*/
function read_pages (&$c, &$pages, &$result) {
// Get the kids dictionary
$kids = $this->pdf_resolve_object ($c, $pages[1][1]['/Kids']);
if (!is_array($kids))
$this->fpdi->Error("Cannot find /Kids in current /Page-Dictionary");
foreach ($kids[1] as $v) {
$pg = $this->pdf_resolve_object ($c, $v);
#print_r($pg);
if ($pg[1][1]['/Type'][1] === '/Pages') {
// If one of the kids is an embedded
// /Pages array, resolve it as well.
$this->read_pages ($c, $pg, $result);
} else {
$result[] = $pg;
}
}
}
/**
* Get PDF-Version
*
* And reset the PDF Version used in FPDI if needed
*/
function getPDFVersion() {
parent::getPDFVersion();
if (isset($this->fpdi->importVersion) && $this->pdfVersion > $this->fpdi->importVersion) {
$this->fpdi->importVersion = $this->pdfVersion;
}
}
}
?>

View File

@ -20,7 +20,7 @@
* *
****************************************************************************/
require_once("fpdi.php");
require_once(FPDF_PATH.'fpdi.php');
class FPDI_Protection extends fpdi {

File diff suppressed because it is too large Load Diff