30
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-06-04 23:10:46 +00:00
This commit is contained in:
nicolaasuni 2009-06-04 14:29:52 +02:00
parent 16fd2654c0
commit b3da98b92e
16 changed files with 335 additions and 308 deletions

View File

@ -1,3 +1,7 @@
4.6.014 (2009-06-04)
- Bug #2800931 "Table thead tag bug" was fixed.
- A bug related to <pre> tag was fixed.
4.6.013 (2009-05-28)
- List bullets position was fixed for RTL languages.

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------
Name: TCPDF
Version: 4.6.013
Release date: 2009-05-28
Version: 4.6.014
Release date: 2009-06-04
Author: Nicola Asuni
Copyright (c) 2001-2009:
@ -57,7 +57,7 @@ Main Features:
Installation (full instructions on http://www.tcpdf.org):
1. copy the folder on your Web server
2. set your installation path and other parameters on the config/tcpdf_config.php
3. call the example/example_001.php page with your browser to see an example
3. call the examples/example_001.php page with your browser to see an example
Source Code Documentation:
doc/index.html

View File

@ -45,7 +45,7 @@
<div class="credit">
<hr />
Documentation generated on Thu, 28 May 2009 19:14:09 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 04 Jun 2009 14:29:39 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

File diff suppressed because it is too large Load Diff

View File

@ -1368,7 +1368,7 @@ $type)</code>
<div class="credit">
<hr />
Documentation generated on Thu, 28 May 2009 19:14:09 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 04 Jun 2009 14:29:39 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -96,7 +96,7 @@ PHP class to creates array representations for common 1D barcodes to be used wit
<div class="credit">
<hr />
Documentation generated on Thu, 28 May 2009 19:14:09 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 04 Jun 2009 14:29:39 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -507,7 +507,7 @@ Configuration file for TCPDF.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Thu, 28 May 2009 19:14:15 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 04 Jun 2009 14:29:45 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -88,7 +88,7 @@ Array of WEB safe colors.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Thu, 28 May 2009 19:14:09 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 04 Jun 2009 14:29:39 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</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>
</tr>
<tr>
<td><b>version:</b>&nbsp;&nbsp;</td><td>4.6.013</td>
<td><b>version:</b>&nbsp;&nbsp;</td><td>4.6.014</td>
</tr>
<tr>
<td><b>copyright:</b>&nbsp;&nbsp;</td><td>2002-2009 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">
<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">
<code>PDF_PRODUCER = 'TCPDF 4.6.013 (http://www.tcpdf.org)'</code>
<code>PDF_PRODUCER = 'TCPDF 4.6.014 (http://www.tcpdf.org)'</code>
</td></tr></table>
</td></tr></table>
@ -115,7 +115,7 @@ unicode data<br /><br /></div>
<div class="credit">
<hr />
Documentation generated on Thu, 28 May 2009 19:14:09 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 04 Jun 2009 14:29:39 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -237,7 +237,7 @@ Unicode Include file for TCPDF.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Thu, 28 May 2009 19:14:15 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 04 Jun 2009 14:29:45 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -1087,8 +1087,8 @@
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$TextColor">TCPDF::$TextColor</a></dd>
<dt><b>$thead</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$thead">TCPDF::$thead</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Table header content to be repeated on each new page</dd>
<dt><b>$theadMargin</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$theadMargin">TCPDF::$theadMargin</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Distance between the top of page and end of table headers on a new page.</dd>
<dt><b>$theadMargins</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$theadMargins">TCPDF::$theadMargins</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Margins used for table header.</dd>
<dt><b>$title</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$title">TCPDF::$title</a></dd>
<dt><b>$tMargin</b></dt>
@ -1364,7 +1364,7 @@
<a href="elementindex.html#top">top</a><br>
<div class="credit">
<hr />
Documentation generated on Thu, 28 May 2009 19:14:09 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 04 Jun 2009 14:29:39 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -1238,8 +1238,8 @@
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$TextColor">TCPDF::$TextColor</a></dd>
<dt><b>$thead</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$thead">TCPDF::$thead</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Table header content to be repeated on each new page</dd>
<dt><b>$theadMargin</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$theadMargin">TCPDF::$theadMargin</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Distance between the top of page and end of table headers on a new page.</dd>
<dt><b>$theadMargins</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$theadMargins">TCPDF::$theadMargins</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Margins used for table header.</dd>
<dt><b>$title</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$title">TCPDF::$title</a></dd>
<dt><b>$tMargin</b></dt>
@ -1387,7 +1387,7 @@
<a href="elementindex_com-tecnick-tcpdf.html#top">top</a><br>
<div class="credit">
<hr />
Documentation generated on Thu, 28 May 2009 19:14:09 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 04 Jun 2009 14:29:38 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -35,7 +35,7 @@
<a href="#Post-parsing">Post-parsing</a><br>
<div class="credit">
<hr />
Documentation generated on Thu, 28 May 2009 19:14:15 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 04 Jun 2009 14:29:45 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -58,7 +58,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.1</a><br />
<div class="credit">
<hr />
Documentation generated on Thu, 28 May 2009 19:14:09 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 04 Jun 2009 14:29:39 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -58,7 +58,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.1</a><br />
<div class="credit">
<hr />
Documentation generated on Thu, 28 May 2009 19:14:09 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 04 Jun 2009 14:29:39 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -2,9 +2,9 @@
//============================================================+
// File name : tcpdf.php
// Begin : 2002-08-03
// Last Update : 2009-05-28
// Last Update : 2009-06-04
// Author : Nicola Asuni - info@tecnick.com - http://www.tcpdf.org
// Version : 4.6.013
// Version : 4.6.014
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
// ----------------------------------------------------------------------------
// Copyright (C) 2002-2009 Nicola Asuni - Tecnick.com S.r.l.
@ -126,7 +126,7 @@
* @copyright 2002-2009 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
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @version 4.6.013
* @version 4.6.014
*/
/**
@ -150,14 +150,14 @@ if (!class_exists('TCPDF', false)) {
/**
* define default PDF document producer
*/
define('PDF_PRODUCER', 'TCPDF 4.6.013 (http://www.tcpdf.org)');
define('PDF_PRODUCER', 'TCPDF 4.6.014 (http://www.tcpdf.org)');
/**
* 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>
* @name TCPDF
* @package com.tecnick.tcpdf
* @version 4.6.013
* @version 4.6.014
* @author Nicola Asuni - info@tecnick.com
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
@ -1239,11 +1239,11 @@ if (!class_exists('TCPDF', false)) {
protected $thead = '';
/**
* Distance between the top of page and end of table headers on a new page.
* Margins used for table header.
* @access protected
* @since 4.5.030 (2009-03-20)
*/
protected $theadMargin = '';
protected $theadMargins = array();
/**
* Cache array for UTF8StringToArray() method.
@ -2485,21 +2485,26 @@ if (!class_exists('TCPDF', false)) {
* @since 4.5.030 (2009-03-25)
*/
protected function setTableHeader() {
if (!$this->empty_string($this->theadMargin)) {
if (isset($this->theadMargins['top'])) {
// restore the original top-margin
$this->tMargin = $this->theadMargin;
$this->pagedim[$this->page]['tm'] = $this->theadMargin;
$this->y = $this->theadMargin;
$this->tMargin = $this->theadMargins['top'];
$this->pagedim[$this->page]['tm'] = $this->tMargin;
$this->y = $this->tMargin;
}
if (!$this->empty_string($this->thead)) {
if (!$this->empty_string($this->thead)) {
// set margins
$this->lMargin = $this->pagedim[$this->page]['olm'];
$this->rMargin = $this->pagedim[$this->page]['orm'];
$this->cMargin = $this->theadMargins['cmargin'];
// print table header
$this->writeHTML($this->thead, false, false, false, false, '');
// set new top margin to skip the table headers
if (!isset($this->theadMargin) OR ($this->empty_string($this->theadMargin))) {
$this->theadMargin = $this->tMargin;
if (!isset($this->theadMargins['top'])) {
$this->theadMargins['top'] = $this->tMargin;
}
$this->tMargin = $this->y;
$this->pagedim[$this->page]['tm'] = $this->tMargin;
$this->lasth = 0;
}
}
@ -3964,7 +3969,7 @@ if (!class_exists('TCPDF', false)) {
}
// max column width
$wmax = $w - (2 * $this->cMargin);
if ($chrwidth > $wmax) {
if (($chrwidth > $wmax) OR ($this->GetCharWidth($chars[0]) > $wmax)) {
// a single character do not fit on column
return '';
}
@ -10828,16 +10833,23 @@ if (!class_exists('TCPDF', false)) {
*/
protected function getHtmlDomArray($html) {
// remove all unsupported tags (the line below lists all supported tags)
$html = strip_tags($html, '<marker/><a><b><blockquote><br><br/><dd><del><div><dl><dt><em><font><h1><h2><h3><h4><h5><h6><hr><i><img><li><ol><p><pre><small><span><strong><sub><sup><table><tcpdf><td><th><thead><tr><tt><u><ul>');
$html = strip_tags($html, '<marker/><a><b><blockquote><br><br/><dd><del><div><dl><dt><em><font><h1><h2><h3><h4><h5><h6><hr><i><img><li><ol><p><pre><small><span><strong><sub><sup><table><tablehead><tcpdf><td><th><thead><tr><tt><u><ul>');
//replace some blank characters
$html = preg_replace('/<pre/', '<xre', $html); // preserve pre tag
$html = preg_replace('/<(table|tr|td|th|tcpdf|blockquote|dd|div|dt|h1|h2|h3|h4|h5|h6|br|hr|li|ol|ul|p)([^\>]*)>[\n\r\t]+/', '<\\1\\2>', $html);
$html = preg_replace('@(\r\n|\r)@', "\n", $html);
$repTable = array("\t" => ' ', "\0" => ' ', "\x0B" => ' ', "\\" => "\\\\");
$html = strtr($html, $repTable);
while (preg_match("'<xre([^\>]*)>(.*?)\n(.*?)</pre>'si", $html)) {
// preserve newlines on <pre> tag
$html = preg_replace("'<xre([^\>]*)>(.*?)\n(.*?)</pre>'si", "<xre\\1>\\2<br />\\3</pre>", $html);
$offset = 0;
while (($offset < strlen($html)) AND ($pos = strpos($html, '</pre>', $offset)) !== false) {
$html_a = substr($html, 0, $offset);
$html_b = substr($html, $offset, ($pos - $offset + 6));
while (preg_match("'<xre([^\>]*)>(.*?)\n(.*?)</pre>'si", $html_b)) {
// preserve newlines on <pre> tag
$html_b = preg_replace("'<xre([^\>]*)>(.*?)\n(.*?)</pre>'si", "<xre\\1>\\2<br />\\3</pre>", $html_b);
}
$html = $html_a.$html_b.substr($html, $pos + 6);
$offset = strlen($html_a.$html_b);
}
$html = str_replace("\n", ' ', $html);
// remove extra spaces from code
@ -10935,7 +10947,7 @@ if (!class_exists('TCPDF', false)) {
}
}
if (($dom[$key]['value'] == 'table') AND (!$this->empty_string($dom[($dom[$key]['parent'])]['thead']))) {
$dom[($dom[$key]['parent'])]['thead'] .= '</table>';
$dom[($dom[$key]['parent'])]['thead'] .= '</tablehead>';
}
} else {
// opening html tag
@ -12063,7 +12075,11 @@ if (!class_exists('TCPDF', false)) {
if (!$this->empty_string($dom[$key]['thead'])) {
// set table header
$this->thead = $dom[$key]['thead'];
}
if (!isset($this->theadMargins) OR (empty($this->theadMargins))) {
$this->theadMargins = array();
$this->theadMargins['cmargin'] = $this->cMargin;
}
}
if (isset($tag['attribute']['cellpadding'])) {
$cp = $this->getHTMLUnitToUnits($tag['attribute']['cellpadding'], 1, 'px');
$this->oldcMargin = $this->cMargin;
@ -12373,7 +12389,8 @@ if (!class_exists('TCPDF', false)) {
protected function closeHTMLTagHandler(&$dom, $key, $cell=false) {
$tag = $dom[$key];
$parent = $dom[($dom[$key]['parent'])];
$firstorlast = ((!isset($dom[($key + 1)])) OR ((!isset($dom[($key + 2)])) AND ($dom[($key + 1)]['value'] == 'marker')));
$firstorlast = ((!isset($dom[($key + 1)])) OR ((!isset($dom[($key + 2)])) AND ($dom[($key + 1)]['value'] == 'marker')));
$in_table_head = false;
//Closing tag
switch($tag['value']) {
case 'tr': {
@ -12433,7 +12450,10 @@ if (!class_exists('TCPDF', false)) {
}
}
break;
}
}
case 'tablehead':
// closing tag used for the thead part
$in_table_head = true;
case 'table': {
// draw borders
$table_el = $parent;
@ -12576,18 +12596,21 @@ if (!class_exists('TCPDF', false)) {
}
}
}
if (isset($parent['cellpadding'])) {
$this->cMargin = $this->oldcMargin;
}
$this->lasth = $this->FontSize * $this->cell_height_ratio;
if (!$this->empty_string($this->theadMargin)) {
// restore top margin
$this->tMargin = $this->theadMargin;
$this->pagedim[$this->page]['tm'] = $this->theadMargin;
}
// reset table header
$this->thead = '';
$this->theadMargin = '';
if (!$in_table_head) {
// we are not inside a thead section
if (isset($parent['cellpadding'])) {
$this->cMargin = $this->oldcMargin;
}
$this->lasth = $this->FontSize * $this->cell_height_ratio;
if (!empty($this->theadMargins)) {
// restore top margin
$this->tMargin = $this->theadMargins['top'];
$this->pagedim[$this->page]['tm'] = $this->tMargin;
}
// reset table header
$this->thead = '';
$this->theadMargins = array();
}
break;
}
case 'a': {