From d97c052d085f677bebda6ce57ae730fa7c8c383d Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Sat, 14 Apr 2018 10:41:38 +0200 Subject: [PATCH] Fix: broken $pdf object ! --- htdocs/core/lib/pdf.lib.php | 8 +++++--- htdocs/core/modules/facture/doc/pdf_crabe.modules.php | 6 +++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 573a562d467..41e53059fff 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -130,6 +130,10 @@ function pdf_getInstance($format='',$metric='mm',$pagetype='P') //$format=array($arrayformat['width'],$arrayformat['height']); //$metric=$arrayformat['unit']; + if (class_exists('TCPDI')) $pdf = new TCPDI($pagetype,$metric,$format); + else if (class_exists('FPDI')) $pdf = new FPDI($pagetype,$metric,$format); + else $pdf = new TCPDF($pagetype,$metric,$format); + // Protection and encryption of pdf if (! empty($conf->global->PDF_SECURITY_ENCRYPTION)) { @@ -144,9 +148,7 @@ 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. - owner : (inverted logic - only for public-key) when set permits change of encryption and enables all other permissions. */ - if (class_exists('TCPDI')) $pdf = new TCPDI($pagetype,$metric,$format); - else 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 $pdfrights = array('modify','copy'); diff --git a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php index 17b652ed2db..b5ee2fba63b 100644 --- a/htdocs/core/modules/facture/doc/pdf_crabe.modules.php +++ b/htdocs/core/modules/facture/doc/pdf_crabe.modules.php @@ -108,7 +108,7 @@ class pdf_crabe extends ModelePDFFactures function __construct($db) { global $conf,$langs,$mysoc; - + // Translations $langs->loadLangs(array("main", "bills")); @@ -204,7 +204,7 @@ class pdf_crabe extends ModelePDFFactures if (! is_object($outputlangs)) $outputlangs=$langs; // For backward compatibility with FPDF, force output charset to ISO, because FPDF expect text to be encoded in ISO if (! empty($conf->global->MAIN_USE_FPDF)) $outputlangs->charset_output='ISO-8859-1'; - + // Translations $outputlangs->loadLangs(array("main", "bills", "products", "dict", "companies")); @@ -1543,7 +1543,7 @@ class pdf_crabe extends ModelePDFFactures function _pagehead(&$pdf, $object, $showaddress, $outputlangs) { global $conf, $langs; - + // Translations $outputlangs->loadLangs(array("main", "bills", "propal", "companies"));