From d8cbe417c810e8aaa00035fcaf3f55dccf1319a0 Mon Sep 17 00:00:00 2001 From: nicolaasuni Date: Tue, 10 Apr 2012 18:02:43 +0100 Subject: [PATCH] 5.9.156 --- CHANGELOG.TXT | 4 ++++ README.TXT | 4 ++-- tcpdf.php | 64 +++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 61 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index d6d4b3e..23a14f9 100755 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,3 +1,7 @@ +5.9.156 (2012-04-10) + - Bug item #3515885 "TOC and booklet: left and right page exchanged". + - SetAutoPageBreak(false) now works also in multicolumn mode. + 5.9.155 (2012-04-02) - Bug item #3512596 "font import problems" was fixed. - Method addTTFfont() was modified to extract only specified Platform ID and Encoding ID (check the source code documentation). diff --git a/README.TXT b/README.TXT index c87bba6..83520bb 100755 --- a/README.TXT +++ b/README.TXT @@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076 ------------------------------------------------------------ Name: TCPDF -Version: 5.9.155 -Release date: 2012-04-02 +Version: 5.9.156 +Release date: 2012-04-10 Author: Nicola Asuni Copyright (c) 2002-2012: diff --git a/tcpdf.php b/tcpdf.php index a0aee5d..7c18096 100755 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 5.9.155 + * @version 5.9.156 */ // Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file. @@ -149,7 +149,7 @@ require_once(dirname(__FILE__).'/config/tcpdf_config.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 5.9.155 + * @version 5.9.156 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { @@ -160,7 +160,7 @@ class TCPDF { * Current TCPDF version. * @private */ - private $tcpdf_version = '5.9.155'; + private $tcpdf_version = '5.9.156'; // Protected properties @@ -5718,7 +5718,7 @@ class TCPDF { if ($this->current_column < ($this->num_columns - 1)) { // go to next column $this->selectColumn($this->current_column + 1); - } else { + } elseif ($this->AutoPageBreak) { // add a new page $this->AddPage(); // set first column @@ -26045,11 +26045,13 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $fontstyle = $this->FontStyle; $w = $this->w - $this->lMargin - $this->rMargin; $spacer = $this->GetStringWidth(chr(32)) * 4; - $page_first = $this->getPage(); $lmargin = $this->lMargin; $rmargin = $this->rMargin; $x_start = $this->GetX(); + $page_first = $this->page; $current_page = $this->page; + $page_fill_start = false; + $page_fill_end = false; $current_column = $this->current_column; if ($this->empty_string($numbersfont)) { $numbersfont = $this->default_monospaced_font; @@ -26155,8 +26157,26 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->Cell($tw, 0, $pagenum, 0, 1, $alignnum, 0, $link, 0); } $page_last = $this->getPage(); + $numpages = ($page_last - $page_first + 1); + // account for booklet mode + if ($this->booklet) { + // check if a blank page is required before TOC + $page_fill_start = ((($page_first % 2) == 0) XOR (($page % 2) == 0)); + $page_fill_end = (!((($numpages % 2) == 0) XOR ($page_fill_start))); + if ($page_fill_start) { + // add a page at the end (to be moved before TOC) + $this->addPage(); + ++$page_last; + ++$numpages; + } + if ($page_fill_end) { + // add a page at the end + $this->addPage(); + ++$page_last; + ++$numpages; + } + } $maxpage = max($maxpage, $page_last); - $numpages = $page_last - $page_first + 1; if (!$this->empty_string($page)) { for ($p = $page_first; $p <= $page_last; ++$p) { // get page data @@ -26199,6 +26219,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } // move pages $this->Bookmark($toc_name, 0, 0, $page_first, $style, $color); + if ($page_fill_start) { + $this->movePage($page_last, $page_first); + } for ($i = 0; $i < $numpages; ++$i) { $this->movePage($page_last, $page); } @@ -26229,6 +26252,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->htmlLinkColorArray = array(); $this->htmlLinkFontStyle = ''; $page_first = $this->getPage(); + $page_fill_start = false; + $page_fill_end = false; // get the font type used for numbers in each template $current_font = $this->FontFamily; foreach ($templates as $level => $html) { @@ -26268,8 +26293,26 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->htmlLinkFontStyle = $prev_htmlLinkFontStyle; // move TOC page and replace numbers $page_last = $this->getPage(); + $numpages = ($page_last - $page_first + 1); + // account for booklet mode + if ($this->booklet) { + // check if a blank page is required before TOC + $page_fill_start = ((($page_first % 2) == 0) XOR (($page % 2) == 0)); + $page_fill_end = (!((($numpages % 2) == 0) XOR ($page_fill_start))); + if ($page_fill_start) { + // add a page at the end (to be moved before TOC) + $this->addPage(); + ++$page_last; + ++$numpages; + } + if ($page_fill_end) { + // add a page at the end + $this->addPage(); + ++$page_last; + ++$numpages; + } + } $maxpage = max($maxpage, $page_last); - $numpages = $page_last - $page_first + 1; if (!$this->empty_string($page)) { for ($p = $page_first; $p <= $page_last; ++$p) { // get page data @@ -26320,6 +26363,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } // move pages $this->Bookmark($toc_name, 0, 0, $page_first, $style, $color); + if ($page_fill_start) { + $this->movePage($page_last, $page_first); + } for ($i = 0; $i < $numpages; ++$i) { $this->movePage($page_last, $page); }