diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index d0007b4..cdef9eb 100644 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -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) - Method TCPDF_IMAGES::_parsepng() was fixed to support transparency in Indexed images. diff --git a/README.TXT b/README.TXT index 0cb1652..e3872db 100644 --- a/README.TXT +++ b/README.TXT @@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076 ------------------------------------------------------------ Name: TCPDF -Version: 6.0.063 -Release date: 2014-04-03 +Version: 6.0.064 +Release date: 2014-04-07 Author: Nicola Asuni Copyright (c) 2002-2014: diff --git a/composer.json b/composer.json index f3181a3..53c2941 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "tecnick.com/tcpdf", - "version": "6.0.063", + "version": "6.0.064", "homepage": "http://www.tcpdf.org/", "type": "library", "description": "TCPDF is a PHP class for generating PDF documents.", diff --git a/include/tcpdf_static.php b/include/tcpdf_static.php index df20f33..302f4a9 100644 --- a/include/tcpdf_static.php +++ b/include/tcpdf_static.php @@ -55,7 +55,7 @@ class TCPDF_STATIC { * Current TCPDF version. * @private static */ - private static $tcpdf_version = '6.0.063'; + private static $tcpdf_version = '6.0.064'; /** * String alias for total number of pages. diff --git a/tcpdf.php b/tcpdf.php index 9aa416f..9f6130a 100644 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 6.0.063 + * @version 6.0.064 */ // 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.
* @package com.tecnick.tcpdf * @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 */ class TCPDF { @@ -560,7 +560,7 @@ class TCPDF { * ID of the stored default header template (-1 = not set). * @protected */ - protected $header_xobjid = -1; + protected $header_xobjid = false; /** * 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); // set default font $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 if ($this->isunicode AND (@preg_match('/\pL/u', 'a') == 1)) { // PCRE unicode support is turned ON @@ -2950,14 +2952,14 @@ class TCPDF { $this->x = 0; $this->y = $this->h - (1 / $this->k); $this->lMargin = 0; - $this->_out('q'); + $this->_outSaveGraphicsState(); $font = defined('PDF_FONT_NAME_MAIN')?PDF_FONT_NAME_MAIN:'helvetica'; $this->SetFont($font, '', 1); $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"; $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->_out('Q'); + $this->_outRestoreGraphicsState(); // restore graphic settings $this->setGraphicVars($gvars); } @@ -3357,7 +3359,7 @@ class TCPDF { * @public */ public function resetHeaderTemplate() { - $this->header_xobjid = -1; + $this->header_xobjid = false; } /** @@ -3375,7 +3377,7 @@ class TCPDF { * @public */ public function Header() { - if ($this->header_xobjid < 0) { + if ($this->header_xobjid === false) { // start a new XObject Template $this->header_xobjid = $this->startTemplate($this->w, $this->tMargin); $headerfont = $this->getHeaderFont(); @@ -3442,7 +3444,7 @@ class TCPDF { $this->printTemplate($this->header_xobjid, $x, 0, 0, 0, '', '', false); if ($this->header_xobj_autoreset) { // 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_theadMargins = $this->theadMargins; $lasth = $this->lasth; - $this->_out('q'); + $newline = $this->newline; + $this->_outSaveGraphicsState(); $this->rMargin = $this->original_rMargin; $this->lMargin = $this->original_lMargin; $this->SetCellPadding(0); @@ -3525,11 +3528,11 @@ class TCPDF { } else { $this->SetXY($this->original_lMargin, $this->tMargin); } - $this->_out('Q'); + $this->_outRestoreGraphicsState(); $this->lasth = $lasth; $this->thead = $temp_thead; $this->theadMargins = $temp_theadMargins; - $this->newline = false; + $this->newline = $newline; $this->InHeader = false; } @@ -3555,7 +3558,7 @@ class TCPDF { $temp_thead = $this->thead; $temp_theadMargins = $this->theadMargins; $lasth = $this->lasth; - $this->_out('q'); + $this->_outSaveGraphicsState(); $this->rMargin = $this->original_rMargin; $this->lMargin = $this->original_lMargin; $this->SetCellPadding(0); @@ -3574,7 +3577,7 @@ class TCPDF { } else { $this->SetXY($this->original_lMargin, $this->tMargin); } - $this->_out('Q'); + $this->_outRestoreGraphicsState(); $this->lasth = $lasth; $this->thead = $temp_thead; $this->theadMargins = $temp_theadMargins; @@ -10965,7 +10968,7 @@ class TCPDF { if ($this->state != 2) { return; } - $this->_out('q'); + $this->_outSaveGraphicsState(); if ($this->inxobj) { // we are inside an XObject template $this->xobjects[$this->xobjid]['transfmrk'][] = strlen($this->xobjects[$this->xobjid]['outdata']); @@ -10988,7 +10991,7 @@ class TCPDF { if ($this->state != 2) { return; } - $this->_out('Q'); + $this->_outRestoreGraphicsState(); if (isset($this->transfmatrix[$this->transfmatrix_key])) { array_pop($this->transfmatrix[$this->transfmatrix_key]); --$this->transfmatrix_key; @@ -14377,7 +14380,7 @@ class TCPDF { //paint the gradient $this->_out('/Sh'.$n.' sh'); //restore previous Graphic State - $this->_out('Q'); + $this->_outRestoreGraphicsState(); if ($this->inxobj) { // we are inside an XObject template $this->xobjects[$this->xobjid]['gradients'][$n] = $this->gradients[$n]; @@ -14515,7 +14518,7 @@ class TCPDF { //paint the gradient $this->_out('/Sh'.$n.' sh'); //restore previous Graphic State - $this->_out('Q'); + $this->_outRestoreGraphicsState(); if ($this->inxobj) { // we are inside an XObject template $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. * @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; } //save current Graphic State - $this->_out('q'); + $this->_outSaveGraphicsState(); //set clipping area if (!empty($clip_function) AND method_exists($this, $clip_function)) { $bbox = call_user_func_array(array($this, $clip_function), $clip_params);