Add option MAIN_DISABLE_FPDI to allow packages without FPDI
This commit is contained in:
parent
a498525dda
commit
853a160e92
@ -24,7 +24,7 @@
|
|||||||
* \file htdocs/lib/pdf.lib.php
|
* \file htdocs/lib/pdf.lib.php
|
||||||
* \brief Set of functions used for PDF generation
|
* \brief Set of functions used for PDF generation
|
||||||
* \ingroup core
|
* \ingroup core
|
||||||
* \version $Id: pdf.lib.php,v 1.103 2011/08/11 12:14:04 eldy Exp $
|
* \version $Id: pdf.lib.php,v 1.104 2011/08/11 16:09:52 eldy Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
@ -76,14 +76,12 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
|
|||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
require_once(TCPDF_PATH.'tcpdf.php');
|
require_once(TCPDF_PATH.'tcpdf.php');
|
||||||
require_once(FPDFI_PATH.'fpdi.php');
|
// We need to instantiate fpdi object (instead of tcpdf) to use merging features. But we can disable it.
|
||||||
|
if (empty($conf->global->MAIN_DISABLE_FPDI)) require_once(FPDFI_PATH.'fpdi.php');
|
||||||
|
|
||||||
//if (! is_array($format) || empty($format) || empty($metric))
|
|
||||||
//{
|
|
||||||
$arrayformat=pdf_getFormat();
|
$arrayformat=pdf_getFormat();
|
||||||
$format=array($arrayformat['width'],$arrayformat['height']);
|
$format=array($arrayformat['width'],$arrayformat['height']);
|
||||||
$metric=$arrayformat['unit'];
|
$metric=$arrayformat['unit'];
|
||||||
//}
|
|
||||||
|
|
||||||
// Protection et encryption du pdf
|
// Protection et encryption du pdf
|
||||||
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
if ($conf->global->PDF_SECURITY_ENCRYPTION)
|
||||||
@ -99,15 +97,17 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
|
|||||||
- print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality.
|
- print-high : Print the document to a representation from which a faithful digital copy of the PDF content could be generated. When this is not set, printing is limited to a low-level representation of the appearance, possibly of degraded quality.
|
||||||
- owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions.
|
- owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions.
|
||||||
*/
|
*/
|
||||||
if ($conf->global->MAIN_USE_FPDF)
|
if (! empty($conf->global->MAIN_USE_FPDF))
|
||||||
{
|
{
|
||||||
|
require_once(FPDFI_PATH.'fpdi_protection.php');
|
||||||
$pdf = new FPDI_Protection($pagetype,$metric,$format);
|
$pdf = new FPDI_Protection($pagetype,$metric,$format);
|
||||||
// For FPDF, we specify permission we want to open
|
// For FPDF, we specify permission we want to open
|
||||||
$pdfrights = array('print');
|
$pdfrights = array('print');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pdf = new FPDI($pagetype,$metric,$format);
|
if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format);
|
||||||
|
else $pdf = new TCPDF($pagetype,$metric,$format);
|
||||||
// For TCPDF, we specify permission we want to block
|
// For TCPDF, we specify permission we want to block
|
||||||
$pdfrights = array('modify','copy');
|
$pdfrights = array('modify','copy');
|
||||||
}
|
}
|
||||||
@ -117,7 +117,8 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$pdf=new FPDI($pagetype,$metric,$format);
|
if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format);
|
||||||
|
else $pdf = new TCPDF($pagetype,$metric,$format);
|
||||||
}
|
}
|
||||||
return $pdf;
|
return $pdf;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user