Browse Source

Update FPDF_TPL library to 1.2.3

aspangaro 10 years ago
parent
commit
014f255f22
2 changed files with 31 additions and 20 deletions
  1. 1 1
      COPYRIGHT
  2. 30 19
      htdocs/includes/fpdfi/fpdf_tpl.php

+ 1 - 1
COPYRIGHT

@@ -16,7 +16,7 @@ AdoDb-Date             0.33          Modified BSD License        Yes
 ChromePHP              4.3.3         Apache Software License 2.0 Yes             Return server log to chrome browser console
 CKEditor               4.3.3         LGPL-2.1+                   Yes             Editor WYSIWYG
 FPDI                   1.4.2         Apache Software License 2.0 Yes             PDF templates management
-FPDF_TPL               1.2           Apache Software License 2.0 Yes             PDF templates management
+FPDF_TPL               1.2.3         Apache Software License 2.0 Yes             PDF templates management
 GeoIP                  1.4           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)
 odtPHP                 1.0.1         GPL-2+  b                   Yes             Library to build/edit ODT files

+ 30 - 19
htdocs/includes/fpdfi/fpdf_tpl.php

@@ -1,8 +1,8 @@
 <?php
 //
-//  FPDF_TPL - Version 1.2
+//  FPDF_TPL - Version 1.2.3
 //
-//    Copyright 2004-2010 Setasign - Jan Slabon
+//    Copyright 2004-2013 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.
@@ -104,6 +104,10 @@ class FPDF_TPL extends FPDF {
             'o_rMargin' => $this->rMargin,
             'o_h' => $this->h,
             'o_w' => $this->w,
+            'o_FontFamily' => $this->FontFamily,
+            'o_FontStyle' => $this->FontStyle,
+            'o_FontSizePt' => $this->FontSizePt,
+            'o_FontSize' => $this->FontSize,
             'buffer' => '',
             'x' => $x,
             'y' => $y,
@@ -121,6 +125,13 @@ class FPDF_TPL extends FPDF {
         $this->SetXY($x + $this->lMargin, $y + $this->tMargin);
         $this->SetRightMargin($this->w - $w + $this->rMargin);
 
+        if ($this->CurrentFont) {
+            $fontkey = $this->FontFamily . $this->FontStyle;
+		    $this->_res['tpl'][$this->tpl]['fonts'][$fontkey] =& $this->fonts[$fontkey];
+            
+        	$this->_out(sprintf('BT /F%d %.2f Tf ET', $this->CurrentFont['i'], $this->FontSizePt));
+        }
+        
         return $this->tpl;
     }
     
@@ -148,6 +159,15 @@ class FPDF_TPL extends FPDF {
             $this->w = $tpl['o_w'];
             $this->SetAutoPageBreak($tpl['o_AutoPageBreak'], $tpl['o_bMargin']);
             
+            $this->FontFamily = $tpl['o_FontFamily'];
+			$this->FontStyle = $tpl['o_FontStyle'];
+			$this->FontSizePt = $tpl['o_FontSizePt'];
+			$this->FontSize = $tpl['o_FontSize'];
+        	
+			$fontkey = $this->FontFamily . $this->FontStyle;
+			if ($fontkey)
+            	$this->CurrentFont =& $this->fonts[$fontkey];
+            
             return $this->tpl;
         } else {
             return false;
@@ -213,13 +233,6 @@ class FPDF_TPL extends FPDF {
         $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));
 
-        // reset font in the outer graphic state
-        if ($this->FontFamily) {
-	        $family = $this->FontFamily;
-	        $this->FontFamily = '';
-	        $this->SetFont($family);
-        }
-        
         $this->lastUsedTemplateData = $tData;
         
         return array('w' => $_w, 'h' => $_h);
@@ -236,7 +249,7 @@ class FPDF_TPL extends FPDF {
      * @return array The height and width of the template
      */
     function getTemplateSize($tplidx, $_w = 0, $_h = 0) {
-        if (!$this->tpls[$tplidx])
+        if (!isset($this->tpls[$tplidx]))
             return false;
 
         $tpl =& $this->tpls[$tplidx];
@@ -265,12 +278,6 @@ class FPDF_TPL extends FPDF {
         	return call_user_func_array(array($this, 'TCPDF::SetFont'), $args);
         }
         
-        /**
-         * force the resetting of font changes in a template
-         */
-        if ($this->_intpl)
-            $this->FontFamily = '';
-            
         parent::SetFont($family, $style, $size);
        
         $fontkey = $this->FontFamily . $this->FontStyle;
@@ -285,7 +292,11 @@ class FPDF_TPL extends FPDF {
     /**
      * See FPDF/TCPDF-Documentation ;-)
      */
-    function Image($file, $x = null, $y = null, $w = 0, $h = 0, $type = '', $link = '') {
+    function Image(
+		$file, $x = '', $y = '', $w = 0, $h = 0, $type = '', $link = '', $align = '', $resize = false,
+		$dpi = 300, $palign = '', $ismask = false, $imgmask = false, $border = 0, $fitbox = false,
+		$hidden = false, $fitonpage = false, $alt = false, $altimgs = array()
+    ) {
         if (is_subclass_of($this, 'TCPDF')) {
         	$args = func_get_args();
 			return call_user_func_array(array($this, 'TCPDF::Image'), $args);
@@ -306,7 +317,7 @@ class FPDF_TPL extends FPDF {
      *
      * AddPage is not available when you're "in" a template.
      */
-    function AddPage($orientation = '', $format = '') {
+    function AddPage($orientation = '', $format = '', $keepmargins = false, $tocpage = false) {
     	if (is_subclass_of($this, 'TCPDF')) {
         	$args = func_get_args();
         	return call_user_func_array(array($this, 'TCPDF::AddPage'), $args);
@@ -321,7 +332,7 @@ class FPDF_TPL extends FPDF {
     /**
      * Preserve adding Links in Templates ...won't work
      */
-    function Link($x, $y, $w, $h, $link) {
+    function Link($x, $y, $w, $h, $link, $spaces = 0) {
         if (is_subclass_of($this, 'TCPDF')) {
         	$args = func_get_args();
 			return call_user_func_array(array($this, 'TCPDF::Link'), $args);