32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-11-25 22:07:33 +00:00

6.0.064 (2014-04-07)

- Header and Footer fonts are now set by default.
- Bug #904 "PDF corrupted" was fixed.
This commit is contained in:
nicolaasuni 2014-04-07 20:56:16 +01:00
parent d24b4d4a07
commit 5afe31385d
5 changed files with 47 additions and 24 deletions

View File

@ -1,3 +1,7 @@
6.0.064 (2014-04-07)
- Header and Footer fonts are now set by default.
- Bug #904 "PDF corrupted" was fixed.
6.0.063 (2014-04-03) 6.0.063 (2014-04-03)
- Method TCPDF_IMAGES::_parsepng() was fixed to support transparency in Indexed images. - Method TCPDF_IMAGES::_parsepng() was fixed to support transparency in Indexed images.

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------ ------------------------------------------------------------
Name: TCPDF Name: TCPDF
Version: 6.0.063 Version: 6.0.064
Release date: 2014-04-03 Release date: 2014-04-07
Author: Nicola Asuni Author: Nicola Asuni
Copyright (c) 2002-2014: Copyright (c) 2002-2014:

View File

@ -1,6 +1,6 @@
{ {
"name": "tecnick.com/tcpdf", "name": "tecnick.com/tcpdf",
"version": "6.0.063", "version": "6.0.064",
"homepage": "http://www.tcpdf.org/", "homepage": "http://www.tcpdf.org/",
"type": "library", "type": "library",
"description": "TCPDF is a PHP class for generating PDF documents.", "description": "TCPDF is a PHP class for generating PDF documents.",

View File

@ -55,7 +55,7 @@ class TCPDF_STATIC {
* Current TCPDF version. * Current TCPDF version.
* @private static * @private static
*/ */
private static $tcpdf_version = '6.0.063'; private static $tcpdf_version = '6.0.064';
/** /**
* String alias for total number of pages. * String alias for total number of pages.

View File

@ -1,9 +1,9 @@
<?php <?php
//============================================================+ //============================================================+
// File name : tcpdf.php // File name : tcpdf.php
// Version : 6.0.063 // Version : 6.0.064
// Begin : 2002-08-03 // Begin : 2002-08-03
// Last Update : 2014-04-03 // Last Update : 2014-04-07
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com // Author : Nicola Asuni - Tecnick.com LTD - 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)
// ------------------------------------------------------------------- // -------------------------------------------------------------------
@ -104,7 +104,7 @@
* Tools to encode your unicode fonts are on fonts/utils directory.</p> * Tools to encode your unicode fonts are on fonts/utils directory.</p>
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @author Nicola Asuni * @author Nicola Asuni
* @version 6.0.063 * @version 6.0.064
*/ */
// TCPDF configuration // TCPDF configuration
@ -128,7 +128,7 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.php');
* TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.<br> * TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.<br>
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions. * @brief PHP class for generating PDF documents without requiring external extensions.
* @version 6.0.063 * @version 6.0.064
* @author Nicola Asuni - info@tecnick.com * @author Nicola Asuni - info@tecnick.com
*/ */
class TCPDF { class TCPDF {
@ -560,7 +560,7 @@ class TCPDF {
* ID of the stored default header template (-1 = not set). * ID of the stored default header template (-1 = not set).
* @protected * @protected
*/ */
protected $header_xobjid = -1; protected $header_xobjid = false;
/** /**
* If true reset the Header Xobject template at each page * If true reset the Header Xobject template at each page
@ -1949,6 +1949,8 @@ class TCPDF {
TCPDF_FONTS::utf8Bidi(array(''), '', false, $this->isunicode, $this->CurrentFont); TCPDF_FONTS::utf8Bidi(array(''), '', false, $this->isunicode, $this->CurrentFont);
// set default font // set default font
$this->SetFont($this->FontFamily, $this->FontStyle, $this->FontSizePt); $this->SetFont($this->FontFamily, $this->FontStyle, $this->FontSizePt);
$this->setHeaderFont(array($this->FontFamily, $this->FontStyle, $this->FontSizePt));
$this->setFooterFont(array($this->FontFamily, $this->FontStyle, $this->FontSizePt));
// check if PCRE Unicode support is enabled // check if PCRE Unicode support is enabled
if ($this->isunicode AND (@preg_match('/\pL/u', 'a') == 1)) { if ($this->isunicode AND (@preg_match('/\pL/u', 'a') == 1)) {
// PCRE unicode support is turned ON // PCRE unicode support is turned ON
@ -2950,14 +2952,14 @@ class TCPDF {
$this->x = 0; $this->x = 0;
$this->y = $this->h - (1 / $this->k); $this->y = $this->h - (1 / $this->k);
$this->lMargin = 0; $this->lMargin = 0;
$this->_out('q'); $this->_outSaveGraphicsState();
$font = defined('PDF_FONT_NAME_MAIN')?PDF_FONT_NAME_MAIN:'helvetica'; $font = defined('PDF_FONT_NAME_MAIN')?PDF_FONT_NAME_MAIN:'helvetica';
$this->SetFont($font, '', 1); $this->SetFont($font, '', 1);
$this->setTextRenderingMode(0, false, false); $this->setTextRenderingMode(0, false, false);
$msg = "\x50\x6f\x77\x65\x72\x65\x64\x20\x62\x79\x20\x54\x43\x50\x44\x46\x20\x28\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29"; $msg = "\x50\x6f\x77\x65\x72\x65\x64\x20\x62\x79\x20\x54\x43\x50\x44\x46\x20\x28\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29";
$lnk = "\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67"; $lnk = "\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67";
$this->Cell(0, 0, $msg, 0, 0, 'L', 0, $lnk, 0, false, 'D', 'B'); $this->Cell(0, 0, $msg, 0, 0, 'L', 0, $lnk, 0, false, 'D', 'B');
$this->_out('Q'); $this->_outRestoreGraphicsState();
// restore graphic settings // restore graphic settings
$this->setGraphicVars($gvars); $this->setGraphicVars($gvars);
} }
@ -3357,7 +3359,7 @@ class TCPDF {
* @public * @public
*/ */
public function resetHeaderTemplate() { public function resetHeaderTemplate() {
$this->header_xobjid = -1; $this->header_xobjid = false;
} }
/** /**
@ -3375,7 +3377,7 @@ class TCPDF {
* @public * @public
*/ */
public function Header() { public function Header() {
if ($this->header_xobjid < 0) { if ($this->header_xobjid === false) {
// start a new XObject Template // start a new XObject Template
$this->header_xobjid = $this->startTemplate($this->w, $this->tMargin); $this->header_xobjid = $this->startTemplate($this->w, $this->tMargin);
$headerfont = $this->getHeaderFont(); $headerfont = $this->getHeaderFont();
@ -3442,7 +3444,7 @@ class TCPDF {
$this->printTemplate($this->header_xobjid, $x, 0, 0, 0, '', '', false); $this->printTemplate($this->header_xobjid, $x, 0, 0, 0, '', '', false);
if ($this->header_xobj_autoreset) { if ($this->header_xobj_autoreset) {
// reset header xobject template at each page // reset header xobject template at each page
$this->header_xobjid = -1; $this->header_xobjid = false;
} }
} }
@ -3507,7 +3509,8 @@ class TCPDF {
$temp_thead = $this->thead; $temp_thead = $this->thead;
$temp_theadMargins = $this->theadMargins; $temp_theadMargins = $this->theadMargins;
$lasth = $this->lasth; $lasth = $this->lasth;
$this->_out('q'); $newline = $this->newline;
$this->_outSaveGraphicsState();
$this->rMargin = $this->original_rMargin; $this->rMargin = $this->original_rMargin;
$this->lMargin = $this->original_lMargin; $this->lMargin = $this->original_lMargin;
$this->SetCellPadding(0); $this->SetCellPadding(0);
@ -3525,11 +3528,11 @@ class TCPDF {
} else { } else {
$this->SetXY($this->original_lMargin, $this->tMargin); $this->SetXY($this->original_lMargin, $this->tMargin);
} }
$this->_out('Q'); $this->_outRestoreGraphicsState();
$this->lasth = $lasth; $this->lasth = $lasth;
$this->thead = $temp_thead; $this->thead = $temp_thead;
$this->theadMargins = $temp_theadMargins; $this->theadMargins = $temp_theadMargins;
$this->newline = false; $this->newline = $newline;
$this->InHeader = false; $this->InHeader = false;
} }
@ -3555,7 +3558,7 @@ class TCPDF {
$temp_thead = $this->thead; $temp_thead = $this->thead;
$temp_theadMargins = $this->theadMargins; $temp_theadMargins = $this->theadMargins;
$lasth = $this->lasth; $lasth = $this->lasth;
$this->_out('q'); $this->_outSaveGraphicsState();
$this->rMargin = $this->original_rMargin; $this->rMargin = $this->original_rMargin;
$this->lMargin = $this->original_lMargin; $this->lMargin = $this->original_lMargin;
$this->SetCellPadding(0); $this->SetCellPadding(0);
@ -3574,7 +3577,7 @@ class TCPDF {
} else { } else {
$this->SetXY($this->original_lMargin, $this->tMargin); $this->SetXY($this->original_lMargin, $this->tMargin);
} }
$this->_out('Q'); $this->_outRestoreGraphicsState();
$this->lasth = $lasth; $this->lasth = $lasth;
$this->thead = $temp_thead; $this->thead = $temp_thead;
$this->theadMargins = $temp_theadMargins; $this->theadMargins = $temp_theadMargins;
@ -10965,7 +10968,7 @@ class TCPDF {
if ($this->state != 2) { if ($this->state != 2) {
return; return;
} }
$this->_out('q'); $this->_outSaveGraphicsState();
if ($this->inxobj) { if ($this->inxobj) {
// we are inside an XObject template // we are inside an XObject template
$this->xobjects[$this->xobjid]['transfmrk'][] = strlen($this->xobjects[$this->xobjid]['outdata']); $this->xobjects[$this->xobjid]['transfmrk'][] = strlen($this->xobjects[$this->xobjid]['outdata']);
@ -10988,7 +10991,7 @@ class TCPDF {
if ($this->state != 2) { if ($this->state != 2) {
return; return;
} }
$this->_out('Q'); $this->_outRestoreGraphicsState();
if (isset($this->transfmatrix[$this->transfmatrix_key])) { if (isset($this->transfmatrix[$this->transfmatrix_key])) {
array_pop($this->transfmatrix[$this->transfmatrix_key]); array_pop($this->transfmatrix[$this->transfmatrix_key]);
--$this->transfmatrix_key; --$this->transfmatrix_key;
@ -14377,7 +14380,7 @@ class TCPDF {
//paint the gradient //paint the gradient
$this->_out('/Sh'.$n.' sh'); $this->_out('/Sh'.$n.' sh');
//restore previous Graphic State //restore previous Graphic State
$this->_out('Q'); $this->_outRestoreGraphicsState();
if ($this->inxobj) { if ($this->inxobj) {
// we are inside an XObject template // we are inside an XObject template
$this->xobjects[$this->xobjid]['gradients'][$n] = $this->gradients[$n]; $this->xobjects[$this->xobjid]['gradients'][$n] = $this->gradients[$n];
@ -14515,7 +14518,7 @@ class TCPDF {
//paint the gradient //paint the gradient
$this->_out('/Sh'.$n.' sh'); $this->_out('/Sh'.$n.' sh');
//restore previous Graphic State //restore previous Graphic State
$this->_out('Q'); $this->_outRestoreGraphicsState();
if ($this->inxobj) { if ($this->inxobj) {
// we are inside an XObject template // we are inside an XObject template
$this->xobjects[$this->xobjid]['gradients'][$n] = $this->gradients[$n]; $this->xobjects[$this->xobjid]['gradients'][$n] = $this->gradients[$n];
@ -20538,6 +20541,22 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
} }
} }
/**
* Outputs the "save graphics state" operator 'q'
* @protected
*/
protected function _outSaveGraphicsState() {
$this->_out('q');
}
/**
* Outputs the "restore graphics state" operator 'Q'
* @protected
*/
protected function _outRestoreGraphicsState() {
$this->_out('Q');
}
/** /**
* Writes data to a temporary file on filesystem. * Writes data to a temporary file on filesystem.
* @param $filename (string) file name * @param $filename (string) file name
@ -23034,7 +23053,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$gradient = $newgradient; $gradient = $newgradient;
} }
//save current Graphic State //save current Graphic State
$this->_out('q'); $this->_outSaveGraphicsState();
//set clipping area //set clipping area
if (!empty($clip_function) AND method_exists($this, $clip_function)) { if (!empty($clip_function) AND method_exists($this, $clip_function)) {
$bbox = call_user_func_array(array($this, $clip_function), $clip_params); $bbox = call_user_func_array(array($this, $clip_function), $clip_params);