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 2010-07-05 12:21:38 +02:00
parent 59efe72b38
commit 439d7d02b0
22 changed files with 585 additions and 518 deletions

View File

@ -1,3 +1,7 @@
5.5.009 (2010-07-05)
- A problem related to last page footer was fixed.
- Image alignments and fit-on-page features were improved.
5.5.008 (2010-07-02)
- A problem on table header alignment in booklet mode was fixed.
- Default graphic vars are now applied for setHeader();

View File

@ -8,8 +8,8 @@ http: sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------
Name: TCPDF
Version: 5.5.008
Release date: 2010-07-02
Version: 5.5.009
Release date: 2010-07-05
Author: Nicola Asuni
Copyright (c) 2002-2010:

View File

@ -60,7 +60,7 @@
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:50 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:28 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -1003,7 +1003,7 @@ $code)</code>
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:51 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:28 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -5551,7 +5551,7 @@ $frame)</code>
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:51 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:28 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

File diff suppressed because it is too large Load Diff

View File

@ -299,7 +299,7 @@ $type)</code>
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:50 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:28 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -1377,7 +1377,7 @@ $type)</code>
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:50 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:28 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -105,7 +105,7 @@ PHP class to creates array representations for 2D barcodes to be used with TCPDF
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:50 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:28 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -105,7 +105,7 @@ PHP class to creates array representations for common 1D barcodes to be used wit
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:50 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:28 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -542,7 +542,7 @@ Configuration file for TCPDF.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:56 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:33 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -97,7 +97,7 @@ Array of WEB safe colors.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:51 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:28 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -157,7 +157,7 @@ Class to create PDF417 barcode arrays for TCPDF class.<br /><br /><p>PDF417 (ISO
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:51 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:28 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -480,7 +480,7 @@ string $string, [int $split_length = 1])</code>
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:51 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:28 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -82,7 +82,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>5.5.008</td>
<td><b>version:</b>&nbsp;&nbsp;</td><td>5.5.009</td>
</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>
@ -113,7 +113,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 5.5.008 (http://www.tcpdf.org)'</code>
<code>PDF_PRODUCER = 'TCPDF 5.5.009 (http://www.tcpdf.org)'</code>
</td></tr></table>
</td></tr></table>
@ -124,7 +124,7 @@ unicode data<br /><br /></div>
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:52 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:29 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -246,7 +246,7 @@ Unicode data for TCPDF library.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:56 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:33 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -527,6 +527,8 @@
<dd>in file qrcode.php, variable <a href="com-tecnick-tcpdf/QRcode.html#var$frames">QRcode::$frames</a></dd>
<dt><b>$fwPt</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$fwPt">TCPDF::$fwPt</a></dd>
<dt><b>fitBlock</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodfitBlock">TCPDF::fitBlock()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Set the block dimensions accounting for page breaks and page/column fitting</dd>
<dt><b>Footer</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodFooter">TCPDF::Footer()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;This method is used to render the page footer.</dd>
<dt><b>formatPageNumber</b></dt>
@ -2028,7 +2030,7 @@
<a href="elementindex.html#top">top</a><br>
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:50 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:27 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -725,6 +725,8 @@
<dd>in file qrcode.php, variable <a href="com-tecnick-tcpdf/QRcode.html#var$frames">QRcode::$frames</a></dd>
<dt><b>$fwPt</b></dt>
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$fwPt">TCPDF::$fwPt</a></dd>
<dt><b>fitBlock</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodfitBlock">TCPDF::fitBlock()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Set the block dimensions accounting for page breaks and page/column fitting</dd>
<dt><b>Footer</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methodFooter">TCPDF::Footer()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;This method is used to render the page footer.</dd>
<dt><b>formatPageNumber</b></dt>
@ -2060,7 +2062,7 @@
<a href="elementindex_com-tecnick-tcpdf.html#top">top</a><br>
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:50 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:27 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</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 Fri, 02 Jul 2010 16:13:56 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:33 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -67,7 +67,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br />
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:50 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:28 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -67,7 +67,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.3</a><br />
<div class="credit">
<hr />
Documentation generated on Fri, 02 Jul 2010 16:13:50 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 05 Jul 2010 12:21:28 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

183
tcpdf.php
View File

@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf.php
// Version : 5.5.008
// Version : 5.5.009
// Begin : 2002-08-03
// Last Update : 2010-07-02
// Last Update : 2010-07-05
// Author : Nicola Asuni - Tecnick.com S.r.l - Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
@ -126,7 +126,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
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @version 5.5.008
* @version 5.5.009
*/
/**
@ -150,14 +150,14 @@ if (!class_exists('TCPDF', false)) {
/**
* define default PDF document producer
*/
define('PDF_PRODUCER', 'TCPDF 5.5.008 (http://www.tcpdf.org)');
define('PDF_PRODUCER', 'TCPDF 5.5.009 (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 5.5.008
* @version 5.5.009
* @author Nicola Asuni - info@tecnick.com
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
@ -3345,6 +3345,9 @@ if (!class_exists('TCPDF', false)) {
if ($this->page == 0) {
$this->AddPage();
}
// save current graphic settings
$gvars = $this->getGraphicVars();
$this->lastpage();
$this->SetAutoPageBreak(false);
$this->x = 0;
@ -3359,6 +3362,8 @@ if (!class_exists('TCPDF', false)) {
$this->Cell(0, 0, $msg, 0, 0, 'L', 0, $lnk, 0, false, 'D', 'B');
$this->setVisibility('all');
$this->_out('Q');
// restore graphic settings
$this->setGraphicVars($gvars);
// close page
$this->endPage();
// close document
@ -3829,6 +3834,7 @@ if (!class_exists('TCPDF', false)) {
$this->footerpos[$this->page] = $this->pagelen[$this->page];
$this->_out("\n");
if ($this->print_footer) {
$this->setGraphicVars($this->default_graphic_vars);
$temp_thead = $this->thead;
$temp_theadMargins = $this->theadMargins;
$lasth = $this->lasth;
@ -6289,6 +6295,61 @@ if (!class_exists('TCPDF', false)) {
return $type;
}
/**
* Set the block dimensions accounting for page breaks and page/column fitting
* @param float $w width
* @param float $h height
* @param float $x X coordinate
* @param float $y Y coodiante
* @param boolean $fitonpage if true the block is resized to not exceed page dimensions.
* @access protected
* @since 5.5.009 (2010-07-05)
*/
protected function fitBlock(&$w, &$h, &$x, &$y, $fitonpage=false) {
// resize the block to be vertically contained on a single page or single column
if ($fitonpage OR $this->AutoPageBreak) {
$ratio_wh = ($w / $h);
if ($h > ($this->PageBreakTrigger - $this->tMargin)) {
$h = $this->PageBreakTrigger - $this->tMargin;
$w = ($h * $ratio_wh);
}
// resize the block to be horizontally contained on a single page or single column
if ($fitonpage) {
$maxw = ($this->w - $this->lMargin - $this->rMargin);
if ($w > $maxw) {
$w = $maxw;
$h = ($w / $ratio_wh);
}
}
}
// Check whether we need a new page or new column first as this does not fit
$prev_x = $this->x;
$prev_y = $this->y;
if ($this->checkPageBreak($h, $y) OR ($this->y < $prev_y)) {
$y = $this->y;
if ($this->rtl) {
$x += ($prev_x - $this->x);
} else {
$x += ($this->x - $prev_x);
}
}
// resize the block to be contained on the remaining available page or column space
if ($fitonpage) {
$ratio_wh = ($w / $h);
if (($y + $h) > $this->PageBreakTrigger) {
$h = $this->PageBreakTrigger - $y;
$w = ($h * $ratio_wh);
}
if ((!$this->rtl) AND (($x + $w) > ($this->w - $this->rMargin))) {
$w = $this->w - $this->rMargin - $x;
$h = ($w / $ratio_wh);
} elseif (($this->rtl) AND (($x - $w) < ($this->lMargin))) {
$w = $x - $this->lMargin;
$h = ($w / $ratio_wh);
}
}
}
/**
* Puts an image in the page.
* The upper-left corner must be given.
@ -6363,32 +6424,8 @@ if (!class_exists('TCPDF', false)) {
$w = $h * $pixw / $pixh;
}
}
// Check whether we need a new page or new column first as this does not fit
$prev_x = $this->x;
$prev_y = $this->y;
if ($this->checkPageBreak($h, $y) OR ($this->y < $prev_y)) {
$y = $this->y;
if ($this->rtl) {
$x += ($prev_x - $this->x);
} else {
$x += ($this->x - $prev_x);
}
}
// resize image to be contained on a single page
if ($fitonpage) {
$ratio_wh = $w / $h;
if (($y + $h) > $this->PageBreakTrigger) {
$h = $this->PageBreakTrigger - $y;
$w = $h * $ratio_wh;
}
if ((!$this->rtl) AND (($x + $w) > ($this->w - $this->rMargin))) {
$w = $this->w - $this->rMargin - $x;
$h = $w / $ratio_wh;
} elseif (($this->rtl) AND (($x - $w) < ($this->lMargin))) {
$w = $x - $this->lMargin;
$h = $w / $ratio_wh;
}
}
// fit the image on available space
$this->fitBlock($w, $h, $x, $y, $fitonpage);
// calculate new minimum dimensions in pixels
$neww = round($w * $this->k * $dpi / $this->dpi);
$newh = round($h * $this->k * $dpi / $this->dpi);
@ -7071,7 +7108,6 @@ if (!class_exists('TCPDF', false)) {
public function Output($name='doc.pdf', $dest='I') {
//Output PDF to some destination
//Finish document if necessary
$this->lastpage();
if ($this->state < 3) {
$this->Close();
}
@ -15362,32 +15398,8 @@ if (!class_exists('TCPDF', false)) {
} elseif ($h <= 0) {
$h = ($y2 - $y1) / $k * ($w / (($x2 - $x1) / $k));
}
// Check whether we need a new page or new column first as this does not fit
$prev_x = $this->x;
$prev_y = $this->y;
if ($this->checkPageBreak($h, $y) OR ($this->y < $prev_y)) {
$y = $this->y;
if ($this->rtl) {
$x += ($prev_x - $this->x);
} else {
$x += ($this->x - $prev_x);
}
}
// resize image to be contained on a single page
if ($fitonpage) {
$ratio_wh = $w / $h;
if (($y + $h) > $this->PageBreakTrigger) {
$h = $this->PageBreakTrigger - $y;
$w = $h * $ratio_wh;
}
if ((!$this->rtl) AND (($x + $w) > ($this->w - $this->rMargin))) {
$w = $this->w - $this->rMargin - $x;
$h = $w / $ratio_wh;
} elseif (($this->rtl) AND (($x - $w) < ($this->lMargin))) {
$w = $x - $this->lMargin;
$h = $w / $ratio_wh;
}
}
// fit the image on available space
$this->fitBlock($w, $h, $x, $y, $fitonpage);
if ($this->rasterize_vector_images) {
// convert EPS to raster image using GD or ImageMagick libraries
return $this->Image($file, $x, $y, $w, $h, 'EPS', $link, $align, true, 300, $palign, false, false, $border, false, false, $fitonpage);
@ -15680,17 +15692,8 @@ if (!class_exists('TCPDF', false)) {
// maximum bar height
$barh = $h;
$h += $extraspace;
// Check whether we need a new page or new column first as this does not fit
$prev_x = $this->x;
$prev_y = $this->y;
if ($this->checkPageBreak($h, $y) OR ($this->y < $prev_y)) {
$y = $this->y;
if ($this->rtl) {
$x += ($prev_x - $this->x);
} else {
$x += ($this->x - $prev_x);
}
}
// fit the barcode on available space
$this->fitBlock($w, $h, $x, $y, false);
// set alignment
$this->img_rb_y = $y + $h;
// set alignment
@ -15969,17 +15972,8 @@ if (!class_exists('TCPDF', false)) {
$style['vpadding'] = ($h - $bh) / (2 * $ch);
}
}
// Check whether we need a new page or new column first as this does not fit
$prev_x = $this->x;
$prev_y = $this->y;
if ($this->checkPageBreak($h, $y) OR ($this->y < $prev_y)) {
$y = $this->y;
if ($this->rtl) {
$x += ($prev_x - $this->x);
} else {
$x += ($this->x - $prev_x);
}
}
// fit the barcode on available space
$this->fitBlock($w, $h, $x, $y, false);
// set alignment
$this->img_rb_y = $y + $h;
// set alignment
@ -17326,6 +17320,7 @@ if (!class_exists('TCPDF', false)) {
$startlinepos = $this->cntmrk[$this->page];
$startlinepage = $this->page;
$startliney = $this->y;
$this->newline = false;
}
$this->y += ((($curfontsize * $this->cell_height_ratio / $this->k) + $curfontascent - $curfontdescent) / 2) - $imgh;
$minstartliney = min($this->y, $minstartliney);
@ -21277,32 +21272,8 @@ if (!class_exists('TCPDF', false)) {
} elseif ($h <= 0) {
$h = $w * $oh / $ow;
}
// Check whether we need a new page or new column first as this does not fit
$prev_x = $this->x;
$prev_y = $this->y;
if ($this->checkPageBreak($h, $y) OR ($this->y < $prev_y)) {
$y = $this->y;
if ($this->rtl) {
$x += ($prev_x - $this->x);
} else {
$x += ($this->x - $prev_x);
}
}
// resize image to be contained on a single page
if ($fitonpage) {
$ratio_wh = $w / $h;
if (($y + $h) > $this->PageBreakTrigger) {
$h = $this->PageBreakTrigger - $y;
$w = $h * $ratio_wh;
}
if ((!$this->rtl) AND (($x + $w) > ($this->w - $this->rMargin))) {
$w = $this->w - $this->rMargin - $x;
$h = $w / $ratio_wh;
} elseif (($this->rtl) AND (($x - $w) < ($this->lMargin))) {
$w = $x - $this->lMargin;
$h = $w / $ratio_wh;
}
}
// fit the image on available space
$this->fitBlock($w, $h, $x, $y, $fitonpage);
if ($this->rasterize_vector_images) {
// convert SVG to raster image using GD or ImageMagick libraries
return $this->Image($file, $x, $y, $w, $h, 'SVG', $link, $align, true, 300, $palign, false, false, $border, false, false, false);