diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index 1a8d869..bd2632e 100755 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,4 +1,8 @@ -5.9.1998 (2012-11-29) +5.9.200 (2012-12-05) + - Bug item #768 "Rowspan with Pagebreak error" was fixed. + - Page regions now works also with limited MultiCell() cells. + +5.9.199 (2012-11-29) - Internal setImageBuffer() method was improved. 5.9.198 (2012-11-19) diff --git a/README.TXT b/README.TXT index 61ff935..497bd74 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.199 -Release date: 2012-11-29 +Version: 5.9.200 +Release date: 2012-12-05 Author: Nicola Asuni Copyright (c) 2002-2012: diff --git a/composer.json b/composer.json index bf914b0..85fc1bf 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "tecnick.com/tcpdf", - "version": "5.9.199", + "version": "5.9.200", "homepage": "http://www.tcpdf.org/", "type": "library", "description": "TCPDF is a PHP class for generating PDF documents.", diff --git a/tcpdf.php b/tcpdf.php index 0075ec2..a2fe575 100755 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 5.9.199 + * @version 5.9.200 */ // Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file. @@ -151,7 +151,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.199 + * @version 5.9.200 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { @@ -162,7 +162,7 @@ class TCPDF { * Current TCPDF version. * @private */ - private $tcpdf_version = '5.9.199'; + private $tcpdf_version = '5.9.200'; // Protected properties @@ -274,18 +274,30 @@ class TCPDF { */ protected $lMargin; - /** - * Top margin. - * @protected - */ - protected $tMargin; - /** * Right margin. * @protected */ protected $rMargin; + /** + * Cell left margin (used by regions). + * @protected + */ + protected $clMargin; + + /** + * Cell right margin (used by regions). + * @protected + */ + protected $crMargin; + + /** + * Top margin. + * @protected + */ + protected $tMargin; + /** * Page break margin. * @protected @@ -1653,6 +1665,12 @@ class TCPDF { */ protected $page_regions = array(); + /** + * Boolean value true when page region check is active. + * @protected + */ + protected $check_page_regions = true; + /** * Array containing HTML color names and values. * @protected @@ -2034,6 +2052,8 @@ class TCPDF { // page margins (1 cm) $margin = 28.35 / $this->k; $this->SetMargins($margin, $margin); + $this->clMargin = $this->lMargin; + $this->crMargin = $this->rMargin; // internal cell padding $cpadding = $margin / 10; $this->setCellPaddings($cpadding, 0, $cpadding, 0); @@ -6726,30 +6746,32 @@ class TCPDF { // apply margins $oy = $y + $mc_margin['T']; if ($this->rtl) { - $ox = $this->w - $x - $mc_margin['R']; + $ox = ($this->w - $x - $mc_margin['R']); } else { - $ox = $x + $mc_margin['L']; + $ox = ($x + $mc_margin['L']); } $this->x = $ox; $this->y = $oy; // set width if ($this->empty_string($w) OR ($w <= 0)) { if ($this->rtl) { - $w = $this->x - $this->lMargin - $mc_margin['L']; + $w = ($this->x - $this->lMargin - $mc_margin['L']); } else { - $w = $this->w - $this->x - $this->rMargin - $mc_margin['R']; + $w = ($this->w - $this->x - $this->rMargin - $mc_margin['R']); } } // store original margin values $lMargin = $this->lMargin; $rMargin = $this->rMargin; if ($this->rtl) { - $this->rMargin = $this->w - $this->x; - $this->lMargin = $this->x - $w; + $this->rMargin = ($this->w - $this->x); + $this->lMargin = ($this->x - $w); } else { - $this->lMargin = $this->x; - $this->rMargin = $this->w - $this->x - $w; + $this->lMargin = ($this->x); + $this->rMargin = ($this->w - $this->x - $w); } + $this->clMargin = $this->lMargin; + $this->crMargin = $this->rMargin; if ($autopadding) { // add top padding $this->y += $mc_padding['T']; @@ -6832,6 +6854,9 @@ class TCPDF { if ($this->num_columns == 0) { $this->num_columns = 1; } + // disable page regions check + $check_page_regions = $this->check_page_regions; + $this->check_page_regions = false; // get border modes $border_start = $this->getBorderMode($border, $position='start'); $border_end = $this->getBorderMode($border, $position='end'); @@ -6975,6 +7000,8 @@ class TCPDF { } } } // end for each page + // restore page regions check + $this->check_page_regions = $check_page_regions; // Get end-of-cell Y position $currentY = $this->GetY(); // restore previous values @@ -7009,6 +7036,8 @@ class TCPDF { $this->setContentMark(); $this->cell_padding = $prev_cell_padding; $this->cell_margin = $prev_cell_margin; + $this->clMargin = $this->lMargin; + $this->crMargin = $this->rMargin; return $nl; } @@ -23835,6 +23864,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $cs = 0; $dom[$key]['rowspans'] = array(); if (!isset($dom[$key]['attribute']['nested']) OR ($dom[$key]['attribute']['nested'] != 'true')) { + $this->htmlvspace = 0; // set table header if (!$this->empty_string($dom[$key]['thead'])) { // set table header @@ -24585,12 +24615,12 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: // update row-spanned cells if (isset($dom[($dom[$key]['parent'])]['rowspans'])) { foreach ($dom[($dom[$key]['parent'])]['rowspans'] as $k => $trwsp) { - if ($trwsp['trid'] == $trkey) { - $dom[($dom[$key]['parent'])]['rowspans'][$k]['mrowspan'] -= 1; - } - if (isset($prevtrkey) AND ($trwsp['trid'] == $prevtrkey) AND ($trwsp['mrowspan'] >= 0)) { + if (isset($prevtrkey) AND ($trwsp['trid'] == $prevtrkey) AND ($trwsp['mrowspan'] > 0)) { $dom[($dom[$key]['parent'])]['rowspans'][$k]['trid'] = $trkey; } + if ($dom[($dom[$key]['parent'])]['rowspans'][$k]['trid'] == $trkey) { + $dom[($dom[$key]['parent'])]['rowspans'][$k]['mrowspan'] -= 1; + } } } if (isset($prevtrkey) AND ($dom[$trkey]['startpage'] > $dom[$prevtrkey]['endpage'])) { @@ -27975,7 +28005,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if ($y === '') { $y = $this->y; } - if (empty($this->page_regions)) { + if (!$this->check_page_regions OR empty($this->page_regions)) { // no page regions defined return array($x, $y); } @@ -27990,15 +28020,15 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } if ($this->num_columns > 1) { if ($this->rtl) { - $this->lMargin = $this->columns[$this->current_column]['x'] - $this->columns[$this->current_column]['w']; + $this->lMargin = ($this->columns[$this->current_column]['x'] - $this->columns[$this->current_column]['w']); } else { - $this->rMargin = $this->w - $this->columns[$this->current_column]['x'] - $this->columns[$this->current_column]['w']; + $this->rMargin = ($this->w - $this->columns[$this->current_column]['x'] - $this->columns[$this->current_column]['w']); } } else { if ($this->rtl) { - $this->lMargin = $this->original_lMargin; + $this->lMargin = max($this->clMargin, $this->original_lMargin); } else { - $this->rMargin = $this->original_rMargin; + $this->rMargin = max($this->crMargin, $this->original_rMargin); } } // adjust coordinates and page margins @@ -28017,7 +28047,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if ($this->lMargin < $new_margin) { if ($this->rtl) { // adjust left page margin - $this->lMargin = $new_margin; + $this->lMargin = max(0, $new_margin); } if ($x < $new_margin) { // adjust x position @@ -28033,7 +28063,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if (($this->w - $this->rMargin) > $new_margin) { if (!$this->rtl) { // adjust right page margin - $this->rMargin = ($this->w - $new_margin); + $this->rMargin = max(0, ($this->w - $new_margin)); } if ($x > $new_margin) { // adjust x position