32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-11-22 21:05:10 +00:00
This commit is contained in:
nicolaasuni 2009-05-17 21:39:28 +02:00
parent 9575b1ee5f
commit f130300b55
16 changed files with 298 additions and 271 deletions

View File

@ -1,3 +1,9 @@
4.6.010 (2009-05-17)
- Image() method was improved: now is possible to specify the maximum dimensions for a constraint box defined by $w and $h parameters, and setting the $resize parameter to null.
- <tcpdf> tag indent problem was fixed.
- $y parameter was added to checkPageBreak() method.
- Bug n. 2791773 "writeHTML" was fixed.
4.6.009 (2009-05-13) 4.6.009 (2009-05-13)
- xref table for embedded files was fixed. - xref table for embedded files was fixed.

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------ ------------------------------------------------------------
Name: TCPDF Name: TCPDF
Version: 4.6.009 Version: 4.6.010
Release date: 2009-05-13 Release date: 2009-05-17
Author: Nicola Asuni Author: Nicola Asuni
Copyright (c) 2001-2009: Copyright (c) 2001-2009:

View File

@ -45,7 +45,7 @@
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 13 May 2009 13:03:43 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Sun, 17 May 2009 21:39:14 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</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 Wed, 13 May 2009 13:03:43 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Sun, 17 May 2009 21:39:14 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</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 Wed, 13 May 2009 13:03:43 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Sun, 17 May 2009 21:39:14 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</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 Wed, 13 May 2009 13:03:48 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Sun, 17 May 2009 21:39:20 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</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 Wed, 13 May 2009 13:03:43 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Sun, 17 May 2009 21:39:15 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</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.6.009</td> <td><b>version:</b>&nbsp;&nbsp;</td><td>4.6.010</td>
</tr> </tr>
<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> <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"> <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.6.009 (http://www.tcpdf.org)'</code> <code>PDF_PRODUCER = 'TCPDF 4.6.010 (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 Wed, 13 May 2009 13:03:43 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Sun, 17 May 2009 21:39:15 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</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 Wed, 13 May 2009 13:03:48 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Sun, 17 May 2009 21:39:20 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -1364,7 +1364,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 Wed, 13 May 2009 13:03:43 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Sun, 17 May 2009 21:39:14 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div> </div>
</td></tr></table> </td></tr></table>
</td> </td>

View File

@ -1387,7 +1387,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 Wed, 13 May 2009 13:03:42 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Sun, 17 May 2009 21:39:14 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</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 Wed, 13 May 2009 13:03:48 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Sun, 17 May 2009 21:39:20 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</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.1</a><br /> This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.1</a><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 13 May 2009 13:03:43 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Sun, 17 May 2009 21:39:14 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</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.1</a><br /> This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.1</a><br />
<div class="credit"> <div class="credit">
<hr /> <hr />
Documentation generated on Wed, 13 May 2009 13:03:43 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Sun, 17 May 2009 21:39:14 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</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 : 2009-05-13 // Last Update : 2009-05-17
// Author : Nicola Asuni - info@tecnick.com - http://www.tcpdf.org // Author : Nicola Asuni - info@tecnick.com - http://www.tcpdf.org
// Version : 4.6.009 // Version : 4.6.010
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html) // License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Copyright (C) 2002-2009 Nicola Asuni - Tecnick.com S.r.l. // 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 * @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 * @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.6.009 * @version 4.6.010
*/ */
/** /**
@ -150,14 +150,14 @@ if (!class_exists('TCPDF', false)) {
/** /**
* define default PDF document producer * define default PDF document producer
*/ */
define('PDF_PRODUCER', 'TCPDF 4.6.009 (http://www.tcpdf.org)'); define('PDF_PRODUCER', 'TCPDF 4.6.010 (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.6.009 * @version 4.6.010
* @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
@ -3302,12 +3302,16 @@ if (!class_exists('TCPDF', false)) {
/** /**
* Add page if needed. * Add page if needed.
* @param float $h Cell height. Default value: 0. * @param float $h Cell height. Default value: 0.
* @param mixed $y starting y position, leave empty for current position.
* @return boolean true in case of page break, false otherwise. * @return boolean true in case of page break, false otherwise.
* @since 3.2.000 (2008-07-01) * @since 3.2.000 (2008-07-01)
* @access protected * @access protected
*/ */
protected function checkPageBreak($h) { protected function checkPageBreak($h=0, $y='') {
if ((($this->y + $h) > $this->PageBreakTrigger) AND (!$this->InFooter) AND ($this->AcceptPageBreak())) { if ($this->empty_string($y)) {
$y = $this->y;
}
if ((($y + $h) > $this->PageBreakTrigger) AND (!$this->InFooter) AND ($this->AcceptPageBreak())) {
//Automatic page break //Automatic page break
$x = $this->x; $x = $this->x;
$this->AddPage($this->CurOrientation); $this->AddPage($this->CurOrientation);
@ -4341,7 +4345,7 @@ if (!class_exists('TCPDF', false)) {
* @param string $type Image format. Possible values are (case insensitive): JPEG and PNG (whitout GD library) and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;. If not specified, the type is inferred from the file extension. * @param string $type Image format. Possible values are (case insensitive): JPEG and PNG (whitout GD library) and all images supported by GD: GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM;. If not specified, the type is inferred from the file extension.
* @param mixed $link URL or identifier returned by AddLink(). * @param mixed $link URL or identifier returned by AddLink().
* @param string $align Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:<ul><li>T: top-right for LTR or top-left for RTL</li><li>M: middle-right for LTR or middle-left for RTL</li><li>B: bottom-right for LTR or bottom-left for RTL</li><li>N: next line</li></ul> * @param string $align Indicates the alignment of the pointer next to image insertion relative to image height. The value can be:<ul><li>T: top-right for LTR or top-left for RTL</li><li>M: middle-right for LTR or middle-left for RTL</li><li>B: bottom-right for LTR or bottom-left for RTL</li><li>N: next line</li></ul>
* @param boolean $resize If true resize (reduce) the image to fit $w and $h (requires GD library). * @param mixed $resize If false do not resize, if true resize (reduce) the image to fit $w and $h (requires GD library), if null scale image dimensions to fit within the ($w,$h) box proportionally.
* @param int $dpi dot-per-inch resolution used on resize * @param int $dpi dot-per-inch resolution used on resize
* @param string $palign Allows to center or align the image on the current line. Possible values are:<ul><li>L : left align</li><li>C : center</li><li>R : right align</li><li>'' : empty string : left for LTR or right for RTL</li></ul> * @param string $palign Allows to center or align the image on the current line. Possible values are:<ul><li>L : left align</li><li>C : center</li><li>R : right align</li><li>'' : empty string : left for LTR or right for RTL</li></ul>
* @param boolean $ismask true if this image is a mask, false otherwise * @param boolean $ismask true if this image is a mask, false otherwise
@ -4379,6 +4383,14 @@ if (!class_exists('TCPDF', false)) {
$w = $h * $pixw / $pixh; $w = $h * $pixw / $pixh;
} elseif ($h <= 0) { } elseif ($h <= 0) {
$h = $w * $pixh / $pixw; $h = $w * $pixh / $pixw;
} elseif (($w > 0) AND ($h > 0) AND is_null($resize)) {
// scale image dimensions to fit within the ($w, $h) box proportionally without resampling the image
if ($pixw >= $pixh) {
$h = $w * $pixh / $pixw;
} else {
$w = $h * $pixw / $pixh;
}
$resize = false;
} }
// calculate new minimum dimensions in pixels // calculate new minimum dimensions in pixels
$neww = round($w * $this->k * $dpi / $this->dpi); $neww = round($w * $this->k * $dpi / $this->dpi);
@ -4464,10 +4476,7 @@ if (!class_exists('TCPDF', false)) {
$info = $this->getImageBuffer($file); $info = $this->getImageBuffer($file);
} }
// Check whether we need a new page first as this does not fit // Check whether we need a new page first as this does not fit
if ((($y + $h) > $this->PageBreakTrigger) AND (!$this->InFooter) AND $this->AcceptPageBreak()) { if ($this->checkPageBreak($h, $y)) {
// Automatic page break
$this->AddPage($this->CurOrientation);
// Reset Y coordinate to the top of next page
$y = $this->GetY() + $this->cMargin; $y = $this->GetY() + $this->cMargin;
} }
// set bottomcoordinates // set bottomcoordinates
@ -10093,10 +10102,7 @@ if (!class_exists('TCPDF', false)) {
} }
} }
// Check whether we need a new page first as this does not fit // Check whether we need a new page first as this does not fit
if ((($y + $h) > $this->PageBreakTrigger) AND (!$this->InFooter) AND $this->AcceptPageBreak()) { if ($this->checkPageBreak($h, $y)) {
// Automatic page break
$this->AddPage($this->CurOrientation);
// Reset Y coordinate to the top of next page
$y = $this->GetY() + $this->cMargin; $y = $this->GetY() + $this->cMargin;
} }
// set bottomcoordinates // set bottomcoordinates
@ -10822,7 +10828,7 @@ if (!class_exists('TCPDF', false)) {
$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><tcpdf><td><th><thead><tr><tt><u><ul>');
//replace some blank characters //replace some blank characters
$html = preg_replace('/<pre/', '<xre', $html); // preserve pre tag $html = preg_replace('/<pre/', '<xre', $html); // preserve pre tag
$html = preg_replace('/<(table|tr|td|th|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('/<(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); $html = preg_replace('@(\r\n|\r)@', "\n", $html);
$repTable = array("\t" => ' ', "\0" => ' ', "\x0B" => ' ', "\\" => "\\\\"); $repTable = array("\t" => ' ', "\0" => ' ', "\x0B" => ' ', "\\" => "\\\\");
$html = strtr($html, $repTable); $html = strtr($html, $repTable);
@ -11226,7 +11232,7 @@ if (!class_exists('TCPDF', false)) {
$newline = true; $newline = true;
$loop = 0; $loop = 0;
$curpos = 0; $curpos = 0;
$blocktags = array('blockquote','br','dd','div','dt','h1','h2','h3','h4','h5','h6','hr','li','ol','p','ul'); $blocktags = array('blockquote','br','dd','div','dt','h1','h2','h3','h4','h5','h6','hr','li','ol','p','ul','tcpdf');
$this->premode = false; $this->premode = false;
if (isset($this->PageAnnots[$this->page])) { if (isset($this->PageAnnots[$this->page])) {
$pask = count($this->PageAnnots[$this->page]); $pask = count($this->PageAnnots[$this->page]);
@ -11276,11 +11282,13 @@ if (!class_exists('TCPDF', false)) {
if ((!$this->newline) if ((!$this->newline)
AND ($dom[$key]['value'] == 'img') AND ($dom[$key]['value'] == 'img')
AND (isset($dom[$key]['attribute']['height'])) AND (isset($dom[$key]['attribute']['height']))
AND ($dom[$key]['attribute']['height'] > 0) AND ($dom[$key]['attribute']['height'] > 0)) {
AND (!((($this->y + $this->getHTMLUnitToUnits($dom[$key]['attribute']['height'], $this->lasth, 'px')) > $this->PageBreakTrigger) // get image height
AND (!$this->InFooter) $imgh = $this->getHTMLUnitToUnits($dom[$key]['attribute']['height'], $this->lasth, 'px');
AND $this->AcceptPageBreak())) if (!$this->InFooter) {
) { // check for page break
$this->checkPageBreak($imgh);
}
if ($this->page > $startlinepage) { if ($this->page > $startlinepage) {
// fix lines splitted over two pages // fix lines splitted over two pages
if (isset($this->footerlen[$startlinepage])) { if (isset($this->footerlen[$startlinepage])) {
@ -11311,9 +11319,14 @@ if (!class_exists('TCPDF', false)) {
} }
} }
} }
$startlinepos = $this->intmrk[$this->page];
$startlinepage = $this->page;
$startliney = $this->y;
} }
$this->y += (($curfontsize / $this->k) - $this->getHTMLUnitToUnits($dom[$key]['attribute']['height'], $this->lasth, 'px'));
$this->y += (($curfontsize / $this->k) - $imgh);
$minstartliney = min($this->y, $minstartliney); $minstartliney = min($this->y, $minstartliney);
} elseif (isset($dom[$key]['fontname']) OR isset($dom[$key]['fontstyle']) OR isset($dom[$key]['fontsize'])) { } elseif (isset($dom[$key]['fontname']) OR isset($dom[$key]['fontstyle']) OR isset($dom[$key]['fontsize'])) {
// account for different font size // account for different font size
$pfontname = $curfontname; $pfontname = $curfontname;
@ -12180,9 +12193,11 @@ if (!class_exists('TCPDF', false)) {
// currently only support 1 (frame) or a combination of 'LTRB' // currently only support 1 (frame) or a combination of 'LTRB'
$border = $tag['attribute']['border']; $border = $tag['attribute']['border'];
} }
$iw = '';
if (isset($tag['attribute']['width'])) { if (isset($tag['attribute']['width'])) {
$iw = $this->getHTMLUnitToUnits($tag['attribute']['width'], 1, 'px', false); $iw = $this->getHTMLUnitToUnits($tag['attribute']['width'], 1, 'px', false);
} }
$ih = '';
if (isset($tag['attribute']['height'])) { if (isset($tag['attribute']['height'])) {
$ih = $this->getHTMLUnitToUnits($tag['attribute']['height'], 1, 'px', false); $ih = $this->getHTMLUnitToUnits($tag['attribute']['height'], 1, 'px', false);
} }