32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-11-22 12:55:10 +00:00
This commit is contained in:
nicolaasuni 2010-01-25 18:14:23 +01:00
parent 0bece4a862
commit 5c4d8e62e9
16 changed files with 459 additions and 372 deletions

View File

@ -1,5 +1,8 @@
4.8.027 (2010-01-25)
- Bug item #2938412 "Table related problems - thead, nobr, table width" was fixed.
4.8.026 (2010-01-19) 4.8.026 (2010-01-19)
- The misspelled word "lenght" was replaced with "length" is some variables and comments. - The misspelled word "lenght" was replaced with "length" in some variables and comments.
4.8.025 (2010-01-18) 4.8.025 (2010-01-18)
- addExtGState() method was improved to reuse existing ExtGState objects. - addExtGState() method was improved to reuse existing ExtGState objects.

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------ ------------------------------------------------------------
Name: TCPDF Name: TCPDF
Version: 4.8.026 Version: 4.8.027
Release date: 2010-01-19 Release date: 2010-01-25
Author: Nicola Asuni Author: Nicola Asuni
Copyright (c) 2001-2010: Copyright (c) 2001-2010:

View File

@ -45,7 +45,7 @@
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Tue, 19 Jan 2010 09:38:16 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Mon, 25 Jan 2010 18:14:10 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

File diff suppressed because it is too large Load Diff

View File

@ -1368,7 +1368,7 @@ $type)</code>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Tue, 19 Jan 2010 09:38:16 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Mon, 25 Jan 2010 18:14:10 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -96,7 +96,7 @@ PHP class to creates array representations for common 1D barcodes to be used wit
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Tue, 19 Jan 2010 09:38:16 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Mon, 25 Jan 2010 18:14:10 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -507,7 +507,7 @@ Configuration file for TCPDF.<br /><br /><br /><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Tue, 19 Jan 2010 09:38:19 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Mon, 25 Jan 2010 18:14:12 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -88,7 +88,7 @@ Array of WEB safe colors.<br /><br /><br /><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Tue, 19 Jan 2010 09:38:16 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Mon, 25 Jan 2010 18:14:10 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -73,7 +73,7 @@ This is a PHP class for generating PDF documents without requiring external exte
<td><b>author:</b>&nbsp;&nbsp;</td><td>Nicola Asuni</td> <td><b>author:</b>&nbsp;&nbsp;</td><td>Nicola Asuni</td>
</tr> </tr>
<tr> <tr>
<td><b>version:</b>&nbsp;&nbsp;</td><td>4.8.026</td> <td><b>version:</b>&nbsp;&nbsp;</td><td>4.8.027</td>
</tr> </tr>
<tr> <tr>
<td><b>copyright:</b>&nbsp;&nbsp;</td><td>2002-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com</td> <td><b>copyright:</b>&nbsp;&nbsp;</td><td>2002-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com</td>
@ -104,7 +104,7 @@ unicode data<br /><br /></div>
<div class="tags"> <div class="tags">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border"> <table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code"> <table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>PDF_PRODUCER = 'TCPDF 4.8.026 (http://www.tcpdf.org)'</code> <code>PDF_PRODUCER = 'TCPDF 4.8.027 (http://www.tcpdf.org)'</code>
</td></tr></table> </td></tr></table>
</td></tr></table> </td></tr></table>
@ -115,7 +115,7 @@ unicode data<br /><br /></div>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Tue, 19 Jan 2010 09:38:16 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Mon, 25 Jan 2010 18:14:10 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -237,7 +237,7 @@ Unicode Include file for TCPDF.<br /><br /><br /><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Tue, 19 Jan 2010 09:38:19 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Mon, 25 Jan 2010 18:14:12 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -386,7 +386,7 @@
<dt><b>getAnnotOptFromJSProp</b></dt> <dt><b>getAnnotOptFromJSProp</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetAnnotOptFromJSProp">TCPDF::getAnnotOptFromJSProp()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Convert JavaScript form fields properties array to Annotation Properties array.</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetAnnotOptFromJSProp">TCPDF::getAnnotOptFromJSProp()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Convert JavaScript form fields properties array to Annotation Properties array.</dd>
<dt><b>GetArrStringWidth</b></dt> <dt><b>GetArrStringWidth</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodGetArrStringWidth">TCPDF::GetArrStringWidth()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the string length of an array of chars in user unit. A font must be selected.<br /></dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodGetArrStringWidth">TCPDF::GetArrStringWidth()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the string length of an array of chars in user unit or an array of characters widths. A font must be selected.<br /></dd>
<dt><b>getBarcode</b></dt> <dt><b>getBarcode</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetBarcode">TCPDF::getBarcode()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Get current barcode.</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetBarcode">TCPDF::getBarcode()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Get current barcode.</dd>
<dt><b>getBarcodeArray</b></dt> <dt><b>getBarcodeArray</b></dt>
@ -561,6 +561,8 @@
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$InFooter">TCPDF::$InFooter</a></dd> <dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$InFooter">TCPDF::$InFooter</a></dd>
<dt><b>$internal_encoding</b></dt> <dt><b>$internal_encoding</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$internal_encoding">TCPDF::$internal_encoding</a></dd> <dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$internal_encoding">TCPDF::$internal_encoding</a></dd>
<dt><b>$inthead</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$inthead">TCPDF::$inthead</a><br>&nbsp;&nbsp;&nbsp;&nbsp;True when we are in thead</dd>
<dt><b>$intmrk</b></dt> <dt><b>$intmrk</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$intmrk">TCPDF::$intmrk</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Array used to store positions inside the pages buffer.</dd> <dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$intmrk">TCPDF::$intmrk</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Array used to store positions inside the pages buffer.</dd>
<dt><b>$isunicode</b></dt> <dt><b>$isunicode</b></dt>
@ -1452,7 +1454,7 @@
<a href="elementindex.html#top">top</a><br> <a href="elementindex.html#top">top</a><br>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Tue, 19 Jan 2010 09:38:16 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Mon, 25 Jan 2010 18:14:10 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -545,7 +545,7 @@
<dt><b>getAnnotOptFromJSProp</b></dt> <dt><b>getAnnotOptFromJSProp</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetAnnotOptFromJSProp">TCPDF::getAnnotOptFromJSProp()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Convert JavaScript form fields properties array to Annotation Properties array.</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetAnnotOptFromJSProp">TCPDF::getAnnotOptFromJSProp()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Convert JavaScript form fields properties array to Annotation Properties array.</dd>
<dt><b>GetArrStringWidth</b></dt> <dt><b>GetArrStringWidth</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodGetArrStringWidth">TCPDF::GetArrStringWidth()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the string length of an array of chars in user unit. A font must be selected.<br /></dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodGetArrStringWidth">TCPDF::GetArrStringWidth()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Returns the string length of an array of chars in user unit or an array of characters widths. A font must be selected.<br /></dd>
<dt><b>getBarcode</b></dt> <dt><b>getBarcode</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetBarcode">TCPDF::getBarcode()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Get current barcode.</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodgetBarcode">TCPDF::getBarcode()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Get current barcode.</dd>
<dt><b>getBarcodeArray</b></dt> <dt><b>getBarcodeArray</b></dt>
@ -720,6 +720,8 @@
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$InFooter">TCPDF::$InFooter</a></dd> <dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$InFooter">TCPDF::$InFooter</a></dd>
<dt><b>$internal_encoding</b></dt> <dt><b>$internal_encoding</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$internal_encoding">TCPDF::$internal_encoding</a></dd> <dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$internal_encoding">TCPDF::$internal_encoding</a></dd>
<dt><b>$inthead</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$inthead">TCPDF::$inthead</a><br>&nbsp;&nbsp;&nbsp;&nbsp;True when we are in thead</dd>
<dt><b>$intmrk</b></dt> <dt><b>$intmrk</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$intmrk">TCPDF::$intmrk</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Array used to store positions inside the pages buffer.</dd> <dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$intmrk">TCPDF::$intmrk</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Array used to store positions inside the pages buffer.</dd>
<dt><b>$isunicode</b></dt> <dt><b>$isunicode</b></dt>
@ -1475,7 +1477,7 @@
<a href="elementindex_com-tecnick-tcpdf.html#top">top</a><br> <a href="elementindex_com-tecnick-tcpdf.html#top">top</a><br>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Tue, 19 Jan 2010 09:38:16 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Mon, 25 Jan 2010 18:14:09 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -35,7 +35,7 @@
<a href="#Post-parsing">Post-parsing</a><br> <a href="#Post-parsing">Post-parsing</a><br>
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Tue, 19 Jan 2010 09:38:19 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Mon, 25 Jan 2010 18:14:12 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -58,7 +58,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br /> This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Tue, 19 Jan 2010 09:38:16 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Mon, 25 Jan 2010 18:14:10 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -58,7 +58,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br /> This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Tue, 19 Jan 2010 09:38:16 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a> Documentation generated on Mon, 25 Jan 2010 18:14:10 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -2,9 +2,9 @@
//============================================================+ //============================================================+
// File name : tcpdf.php // File name : tcpdf.php
// Begin : 2002-08-03 // Begin : 2002-08-03
// Last Update : 2010-01-19 // Last Update : 2010-01-25
// Author : Nicola Asuni - info@tecnick.com - http://www.tcpdf.org // Author : Nicola Asuni - info@tecnick.com - http://www.tcpdf.org
// Version : 4.8.026 // Version : 4.8.027
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html) // License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Copyright (C) 2002-2010 Nicola Asuni - Tecnick.com S.r.l. // Copyright (C) 2002-2010 Nicola Asuni - Tecnick.com S.r.l.
@ -128,7 +128,7 @@
* @copyright 2002-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com * @copyright 2002-2010 Nicola Asuni - Tecnick.com S.r.l (www.tecnick.com) Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
* @link http://www.tcpdf.org * @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL * @license http://www.gnu.org/copyleft/lesser.html LGPL
* @version 4.8.026 * @version 4.8.027
*/ */
/** /**
@ -152,14 +152,14 @@ if (!class_exists('TCPDF', false)) {
/** /**
* define default PDF document producer * define default PDF document producer
*/ */
define('PDF_PRODUCER', 'TCPDF 4.8.026 (http://www.tcpdf.org)'); define('PDF_PRODUCER', 'TCPDF 4.8.027 (http://www.tcpdf.org)');
/** /**
* This is a PHP class for generating PDF documents without requiring external extensions.<br> * This is a PHP class for generating PDF documents without requiring external extensions.<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> * 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>
* @name TCPDF * @name TCPDF
* @package com.tecnick.tcpdf * @package com.tecnick.tcpdf
* @version 4.8.026 * @version 4.8.027
* @author Nicola Asuni - info@tecnick.com * @author Nicola Asuni - info@tecnick.com
* @link http://www.tcpdf.org * @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL * @license http://www.gnu.org/copyleft/lesser.html LGPL
@ -1479,6 +1479,13 @@ if (!class_exists('TCPDF', false)) {
*/ */
protected $start_transaction_page = 0; protected $start_transaction_page = 0;
/**
* True when we are in thead
* @access protected
* @since 4.8.027 (2010-01-25)
*/
protected $inthead = false;
//------------------------------------------------------------ //------------------------------------------------------------
// METHODS // METHODS
//------------------------------------------------------------ //------------------------------------------------------------
@ -2756,7 +2763,7 @@ if (!class_exists('TCPDF', false)) {
$this->pagedim[$this->page]['tm'] = $this->tMargin; $this->pagedim[$this->page]['tm'] = $this->tMargin;
$this->y = $this->tMargin; $this->y = $this->tMargin;
} }
if (!$this->empty_string($this->thead)) { if (!$this->empty_string($this->thead) AND (!$this->inthead)) {
// set margins // set margins
$prev_lMargin = $this->lMargin; $prev_lMargin = $this->lMargin;
$prev_rMargin = $this->rMargin; $prev_rMargin = $this->rMargin;
@ -3059,27 +3066,29 @@ if (!class_exists('TCPDF', false)) {
* @param string $fontname Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained. * @param string $fontname Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained.
* @param string $fontstyle Font style. Possible values are (case insensitive):<ul><li>empty string: regular</li><li>B: bold</li><li>I: italic</li><li>U: underline</li><li>D: line trough</li></ul> or any combination. The default value is regular. * @param string $fontstyle Font style. Possible values are (case insensitive):<ul><li>empty string: regular</li><li>B: bold</li><li>I: italic</li><li>U: underline</li><li>D: line trough</li></ul> or any combination. The default value is regular.
* @param float $fontsize Font size in points. The default value is the current size. * @param float $fontsize Font size in points. The default value is the current size.
* @return int string length * @param boolean $getarray if true returns an array of characters widths, if false returns the total length.
* @return mixed int total string length or array of characted widths
* @author Nicola Asuni * @author Nicola Asuni
* @access public * @access public
* @since 1.2 * @since 1.2
*/ */
public function GetStringWidth($s, $fontname='', $fontstyle='', $fontsize=0) { public function GetStringWidth($s, $fontname='', $fontstyle='', $fontsize=0, $getarray=false) {
return $this->GetArrStringWidth($this->utf8Bidi($this->UTF8StringToArray($s), $s, $this->tmprtl), $fontname, $fontstyle, $fontsize); return $this->GetArrStringWidth($this->utf8Bidi($this->UTF8StringToArray($s), $s, $this->tmprtl), $fontname, $fontstyle, $fontsize, $getarray);
} }
/** /**
* Returns the string length of an array of chars in user unit. A font must be selected.<br> * Returns the string length of an array of chars in user unit or an array of characters widths. A font must be selected.<br>
* @param string $sa The array of chars whose total length is to be computed * @param string $sa The array of chars whose total length is to be computed
* @param string $fontname Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained. * @param string $fontname Family font. It can be either a name defined by AddFont() or one of the standard families. It is also possible to pass an empty string, in that case, the current family is retained.
* @param string $fontstyle Font style. Possible values are (case insensitive):<ul><li>empty string: regular</li><li>B: bold</li><li>I: italic</li><li>U: underline</li><li>D: line trough</li></ul> or any combination. The default value is regular. * @param string $fontstyle Font style. Possible values are (case insensitive):<ul><li>empty string: regular</li><li>B: bold</li><li>I: italic</li><li>U: underline</li><li>D: line trough</li></ul> or any combination. The default value is regular.
* @param float $fontsize Font size in points. The default value is the current size. * @param float $fontsize Font size in points. The default value is the current size.
* @return int string length * @param boolean $getarray if true returns an array of characters widths, if false returns the total length.
* @return mixed int total string length or array of characted widths
* @author Nicola Asuni * @author Nicola Asuni
* @access public * @access public
* @since 2.4.000 (2008-03-06) * @since 2.4.000 (2008-03-06)
*/ */
public function GetArrStringWidth($sa, $fontname='', $fontstyle='', $fontsize=0) { public function GetArrStringWidth($sa, $fontname='', $fontstyle='', $fontsize=0, $getarray=false) {
// store current values // store current values
if (!$this->empty_string($fontname)) { if (!$this->empty_string($fontname)) {
$prev_FontFamily = $this->FontFamily; $prev_FontFamily = $this->FontFamily;
@ -3089,14 +3098,21 @@ if (!class_exists('TCPDF', false)) {
} }
// convert UTF-8 array to Latin1 if required // convert UTF-8 array to Latin1 if required
$sa = $this->UTF8ArrToLatin1($sa); $sa = $this->UTF8ArrToLatin1($sa);
$w = 0; $w = 0; // total width
$wa = array(); // array of characters widths
foreach ($sa as $char) { foreach ($sa as $char) {
$w += $this->GetCharWidth($char); // character width
$cw = $this->GetCharWidth($char);
$wa[] = $cw;
$w += $cw;
} }
// restore previous values // restore previous values
if (!$this->empty_string($fontname)) { if (!$this->empty_string($fontname)) {
$this->SetFont($prev_FontFamily, $prev_FontStyle, $prev_FontSizePt); $this->SetFont($prev_FontFamily, $prev_FontStyle, $prev_FontSizePt);
} }
if ($getarray) {
return $wa;
}
return $w; return $w;
} }
@ -4227,12 +4243,13 @@ if (!class_exists('TCPDF', false)) {
} }
// divide text in blocks // divide text in blocks
$txtblocks = explode("\n", $txt); $txtblocks = explode("\n", $txt);
// for each block; // for each text block
foreach ($txtblocks as $block) { foreach ($txtblocks as $block) {
// estimate the number of lines // estimate the number of lines
$lines += $this->empty_string($block) ? 1 : (ceil($this->GetStringWidth($block) / $wmax)); $lines += $this->empty_string($block) ? 1 : (ceil($this->GetStringWidth($block) / $wmax));
} }
return $lines; // return the number of lines
return $lines;
} }
/** /**
@ -12829,6 +12846,8 @@ if (!class_exists('TCPDF', false)) {
$dom[($dom[$key]['parent'])]['content'] .= $a[$dom[$i]['elkey']]; $dom[($dom[$key]['parent'])]['content'] .= $a[$dom[$i]['elkey']];
} }
$key = $i; $key = $i;
// mark nested tables
$dom[($dom[$key]['parent'])]['content'] = str_replace('<table', '<table nested="true"', $dom[($dom[$key]['parent'])]['content']);
} }
// store header rows on a new table // store header rows on a new table
if (($dom[$key]['value'] == 'tr') AND ($dom[($dom[$key]['parent'])]['thead'] === true)) { if (($dom[$key]['value'] == 'tr') AND ($dom[($dom[$key]['parent'])]['thead'] === true)) {
@ -12838,8 +12857,15 @@ if (!class_exists('TCPDF', false)) {
for ($i = $dom[$key]['parent']; $i <= $key; ++$i) { for ($i = $dom[$key]['parent']; $i <= $key; ++$i) {
$dom[($dom[($dom[$key]['parent'])]['parent'])]['thead'] .= $a[$dom[$i]['elkey']]; $dom[($dom[($dom[$key]['parent'])]['parent'])]['thead'] .= $a[$dom[$i]['elkey']];
} }
if (!isset($dom[($dom[$key]['parent'])]['attribute'])) {
$dom[($dom[$key]['parent'])]['attribute'] = array();
}
// header elements must be always contained in a single page
$dom[($dom[$key]['parent'])]['attribute']['nobr'] = 'true';
} }
if (($dom[$key]['value'] == 'table') AND (!$this->empty_string($dom[($dom[$key]['parent'])]['thead']))) { if (($dom[$key]['value'] == 'table') AND (!$this->empty_string($dom[($dom[$key]['parent'])]['thead']))) {
// remove the nobr attributes from the table header
$dom[($dom[$key]['parent'])]['thead'] = str_replace(' nobr="true"', '', $dom[($dom[$key]['parent'])]['thead']);
$dom[($dom[$key]['parent'])]['thead'] .= '</tablehead>'; $dom[($dom[$key]['parent'])]['thead'] .= '</tablehead>';
} }
} else { } else {
@ -13179,7 +13205,7 @@ if (!class_exists('TCPDF', false)) {
$prevrMargin = $this->rMargin; $prevrMargin = $this->rMargin;
$curfontname = $this->FontFamily; $curfontname = $this->FontFamily;
$curfontstyle = $this->FontStyle; $curfontstyle = $this->FontStyle;
$curfontsize = $this->FontSizePt; $curfontsize = $this->FontSizePt;
$this->newline = true; $this->newline = true;
$startlinepage = $this->page; $startlinepage = $this->page;
$minstartliney = $this->y; $minstartliney = $this->y;
@ -13757,13 +13783,17 @@ if (!class_exists('TCPDF', false)) {
$this->textindent = $dom[$key]['text-indent']; $this->textindent = $dom[$key]['text-indent'];
} }
if ($dom[$key]['value'] == 'table') { if ($dom[$key]['value'] == 'table') {
// available page width
if ($this->rtl) { if ($this->rtl) {
$wtmp = $this->x - $this->lMargin; $wtmp = $this->x - $this->lMargin;
} else { } else {
$wtmp = $this->w - $this->rMargin - $this->x; $wtmp = $this->w - $this->rMargin - $this->x;
} }
$wtmp -= (2 * $this->cMargin); if (isset($dom[$key]['attribute']['nested']) AND ($dom[$key]['attribute']['nested'] == 'true')) {
// calculate cell width // add margin for nested tables
$wtmp -= $this->cMargin; // DEBUG
}
// table width
if (isset($dom[$key]['width'])) { if (isset($dom[$key]['width'])) {
$table_width = $this->getHTMLUnitToUnits($dom[$key]['width'], $wtmp, 'px'); $table_width = $this->getHTMLUnitToUnits($dom[$key]['width'], $wtmp, 'px');
} else { } else {
@ -13795,9 +13825,10 @@ if (!class_exists('TCPDF', false)) {
$cellspacingx = $cellspacing; $cellspacingx = $cellspacing;
} }
$colspan = $dom[$key]['attribute']['colspan']; $colspan = $dom[$key]['attribute']['colspan'];
$wtmp = ($colspan * ($table_width / $dom[$table_el]['cols'])); $table_columns_width = ($table_width - ($cellspacing * ($dom[$table_el]['cols'] - 1)));
$wtmp = ($colspan * ($table_columns_width / $dom[$table_el]['cols'])) + (($colspan - 1) * $cellspacing);
if (isset($dom[$key]['width'])) { if (isset($dom[$key]['width'])) {
$cellw = $this->getHTMLUnitToUnits($dom[$key]['width'], $table_width, 'px'); $cellw = $this->getHTMLUnitToUnits($dom[$key]['width'], $table_columns_width, 'px');
} else { } else {
$cellw = $wtmp; $cellw = $wtmp;
} }
@ -13807,7 +13838,6 @@ if (!class_exists('TCPDF', false)) {
} else { } else {
$cellh = 0; $cellh = 0;
} }
$cellw -= $cellspacing;
if (isset($dom[$key]['content'])) { if (isset($dom[$key]['content'])) {
$cell_content = $dom[$key]['content']; $cell_content = $dom[$key]['content'];
} else { } else {
@ -13831,8 +13861,9 @@ if (!class_exists('TCPDF', false)) {
} }
if (!isset($dom[$trid]['startx'])) { if (!isset($dom[$trid]['startx'])) {
$dom[$trid]['startx'] = $this->x; $dom[$trid]['startx'] = $this->x;
} else {
$this->x += ($cellspacingx / 2);
} }
$this->x += ($cellspacingx / 2);
if (isset($dom[$parentid]['attribute']['rowspan'])) { if (isset($dom[$parentid]['attribute']['rowspan'])) {
$rowspan = intval($dom[$parentid]['attribute']['rowspan']); $rowspan = intval($dom[$parentid]['attribute']['rowspan']);
} else { } else {
@ -13897,7 +13928,7 @@ if (!class_exists('TCPDF', false)) {
$dom[$trid]['cellpos'][($cellid - 1)]['bgcolor'] = $dom[$parentid]['bgcolor']; $dom[$trid]['cellpos'][($cellid - 1)]['bgcolor'] = $dom[$parentid]['bgcolor'];
} }
$prevLastH = $this->lasth; $prevLastH = $this->lasth;
// ****** write the cell content ****** // ****** write the cell content ******
$this->MultiCell($cellw, $cellh, $cell_content, false, $lalign, false, 2, '', '', true, 0, true); $this->MultiCell($cellw, $cellh, $cell_content, false, $lalign, false, 2, '', '', true, 0, true);
$this->lasth = $prevLastH; $this->lasth = $prevLastH;
$this->cMargin = $oldmargin; $this->cMargin = $oldmargin;
@ -14048,17 +14079,25 @@ if (!class_exists('TCPDF', false)) {
++$key; ++$key;
if (isset($dom[$key]['tag']) AND $dom[$key]['tag'] AND (!isset($dom[$key]['opening']) OR !$dom[$key]['opening']) AND isset($dom[($dom[$key]['parent'])]['attribute']['nobr']) AND ($dom[($dom[$key]['parent'])]['attribute']['nobr'] == 'true')) { if (isset($dom[$key]['tag']) AND $dom[$key]['tag'] AND (!isset($dom[$key]['opening']) OR !$dom[$key]['opening']) AND isset($dom[($dom[$key]['parent'])]['attribute']['nobr']) AND ($dom[($dom[$key]['parent'])]['attribute']['nobr'] == 'true')) {
if ((!$undo) AND ($this->start_transaction_page == ($this->numpages - 1))) { if ((!$undo) AND ($this->start_transaction_page == ($this->numpages - 1))) {
if (isset($dom[($dom[$key]['parent'])]['thead']) AND ($dom[($dom[$key]['parent'])]['thead'])) {
// we are inside a thead section
$inthead = true;
} else {
$inthead = false;
}
// restore previous object // restore previous object
$this->rollbackTransaction(true); $this->rollbackTransaction(true);
// restore previous values // restore previous values
foreach ($this_method_vars as $vkey => $vval) { foreach ($this_method_vars as $vkey => $vval) {
$$vkey = $vval; $$vkey = $vval;
} }
$this->inthead = $inthead;
// add a page // add a page
$this->AddPage(); $this->AddPage();
$undo = true; // avoid infinite loop $undo = true; // avoid infinite loop
} else { } else {
$undo = false; $undo = false;
} }
} }
} // end for each $key } // end for each $key
@ -14769,6 +14808,7 @@ if (!class_exists('TCPDF', false)) {
case 'tablehead': case 'tablehead':
// closing tag used for the thead part // closing tag used for the thead part
$in_table_head = true; $in_table_head = true;
$this->inthead = false;
case 'table': { case 'table': {
$table_el = $parent; $table_el = $parent;
// draw borders // draw borders