30
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-06-06 07:40:48 +00:00
This commit is contained in:
nicolaasuni 2010-11-15 10:34:20 +01:00
parent f6b17d555d
commit 06a47e85e1
24 changed files with 417 additions and 383 deletions

View File

@ -1,6 +1,10 @@
5.9.013 (2010-11-15)
- Bug item #3109257 "Problem with interlaced GIFs and PNGs" was fixed.
- Image function now accepts image data streams (check example n. 9).
5.9.012 (2010-11-12)
- Method getTCPDFVersion() was added.
- PDF_PRODUCER constat was removed.
- PDF_PRODUCER constant was removed.
- Method convertHTMLColorToDec() was improved.
- HTML colors now support spot color names defined on the new spotcolors.php file.
- The default method Header() was improved to support SVG and EPS/AI images.
@ -212,7 +216,7 @@
- CSS borders are now supported for HTML tables and other block tags (see example n. 61);
- Cell borders were improved (see example n. 57);
- Minor bugs were fixed.
encry
------------------------------------------------------------
5.6.000 (2010-07-31)

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------
Name: TCPDF
Version: 5.9.012
Release date: 2010-11-12
Version: 5.9.013
Release date: 2010-11-15
Author: Nicola Asuni
Copyright (c) 2002-2010:

View File

@ -65,7 +65,7 @@
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:53 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:07 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -1004,7 +1004,7 @@ $code)</code>
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:53 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:08 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -5552,7 +5552,7 @@ $frame)</code>
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:53 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:08 +0100 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

@ -300,7 +300,7 @@ $type)</code>
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:53 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:07 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -1378,7 +1378,7 @@ $type)</code>
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:53 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:07 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -18704,7 +18704,7 @@ This is a PHP class containing Unicde data for TCPDF library<br /><br /><br /><b
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:59 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:14 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -106,7 +106,7 @@ PHP class to creates array representations for 2D barcodes to be used with TCPDF
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:53 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:07 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -106,7 +106,7 @@ PHP class to creates array representations for common 1D barcodes to be used wit
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:53 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:07 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -543,7 +543,7 @@ Configuration file for TCPDF.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:59 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:14 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -98,7 +98,7 @@ Array of WEB safe colors<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:53 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:08 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -158,7 +158,7 @@ Class to create PDF417 barcode arrays for TCPDF class.<br /><br /><p>PDF417 (ISO
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:53 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:08 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -481,7 +481,7 @@ string $string, [int $split_length = 1])</code>
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:53 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:08 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -83,7 +83,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.9.012</td>
<td><b>version:</b>&nbsp;&nbsp;</td><td>5.9.013</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>
@ -110,7 +110,7 @@ main configuration file<br /><br /><p>(define the K_TCPDF_EXTERNAL_CONFIG consta
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:55 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:09 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -103,7 +103,7 @@ Unicode data class for TCPDF library.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:59 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:14 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -2138,7 +2138,7 @@
<a href="elementindex.html#top">top</a><br>
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:53 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:07 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -2171,7 +2171,7 @@
<a href="elementindex_com-tecnick-tcpdf.html#top">top</a><br>
<div class="credit">
<hr />
Documentation generated on Fri, 12 Nov 2010 14:39:52 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:07 +0100 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, 12 Nov 2010 14:39:59 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:14 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -68,7 +68,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, 12 Nov 2010 14:39:53 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:07 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -68,7 +68,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, 12 Nov 2010 14:39:53 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
Documentation generated on Mon, 15 Nov 2010 10:34:07 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.3</a>
</div>
</td></tr></table>
</td>

View File

@ -2,7 +2,7 @@
//============================================================+
// File name : example_009.php
// Begin : 2008-03-04
// Last Update : 2010-08-08
// Last Update : 2010-11-15
//
// Description : Example 009 for TCPDF class
// Test Image
@ -77,14 +77,22 @@ $pdf->setJPEGQuality(75);
// Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false)
// Image example
$pdf->Image('../images/image_demo.jpg', 50, 50, 100, 150, 'JPG', 'http://www.tcpdf.org', '', true, 150, '', false, false, 1, false, false, false);
// Example of Image from data stream
$imgdata = base64_decode('iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABlBMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDrEX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==');
// The '@' character is used to indicate that follows image data stream and not image file name
$pdf->Image('@'.$imgdata);
// ---------------------------------------------------------
//Close and output PDF document
$pdf->Output('example_009.pdf', 'I');
//============================================================+
// END OF FILE
// END OF FILE
//============================================================+

106
tcpdf.php
View File

@ -1,9 +1,9 @@
<?php
//============================================================+
// File name : tcpdf.php
// Version : 5.9.012
// Version : 5.9.013
// Begin : 2002-08-03
// Last Update : 2010-11-12
// Last Update : 2010-11-15
// 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)
// -------------------------------------------------------------------
@ -134,7 +134,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.9.012
* @version 5.9.013
*/
/**
@ -148,7 +148,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.<br>
* @name TCPDF
* @package com.tecnick.tcpdf
* @version 5.9.012
* @version 5.9.013
* @author Nicola Asuni - info@tecnick.com
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
@ -161,7 +161,7 @@ class TCPDF {
* @var current TCPDF version
* @access private
*/
private $tcpdf_version = '5.9.012';
private $tcpdf_version = '5.9.013';
// Protected properties
@ -7081,7 +7081,7 @@ class TCPDF {
* The format can be specified explicitly or inferred from the file extension.<br />
* It is possible to put a link on the image.<br />
* Remark: if an image is used several times, only one copy will be embedded in the file.<br />
* @param string $file Name of the file containing the image.
* @param string $file Name of the file containing the image or a '@' character followed by the image data string.
* @param float $x Abscissa of the upper-left corner (LTR) or upper-right corner (RTL).
* @param float $y Ordinate of the upper-left corner (LTR) or upper-right corner (RTL).
* @param float $w Width of the image in the page. If not specified or equal to zero, it is automatically calculated.
@ -7112,44 +7112,60 @@ class TCPDF {
// check page for no-write regions and adapt page margins if necessary
$this->checkPageRegions($h, $x, $y);
$cached_file = false; // true when the file is cached
// check if is local file
if (!@file_exists($file)) {
// encode spaces on filename (file is probably an URL)
$file = str_replace(' ', '%20', $file);
}
// get image dimensions
$imsize = @getimagesize($file);
if ($imsize === FALSE) {
if (function_exists('curl_init')) {
// try to get remote file data using cURL
$cs = curl_init(); // curl session
curl_setopt($cs, CURLOPT_URL, $file);
curl_setopt($cs, CURLOPT_BINARYTRANSFER, true);
curl_setopt($cs, CURLOPT_FAILONERROR, true);
curl_setopt($cs, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cs, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($cs, CURLOPT_TIMEOUT, 30);
$imgdata = curl_exec($cs);
curl_close($cs);
if($imgdata !== FALSE) {
// copy image to cache
$file = tempnam(K_PATH_CACHE, 'img_');
$fp = fopen($file, 'w');
fwrite($fp, $imgdata);
fclose($fp);
unset($imgdata);
$cached_file = true;
$imsize = @getimagesize($file);
if ($imsize === FALSE) {
unlink($file);
$cached_file = false;
// check if we are passing an image as file or string
if ($file{0} === '@') { // image from string
$imgdata = substr($file, 1);
$file = tempnam(K_PATH_CACHE, 'img_');
$fp = fopen($file, 'w');
fwrite($fp, $imgdata);
fclose($fp);
unset($imgdata);
$cached_file = true;
$imsize = @getimagesize($file);
if ($imsize === FALSE) {
unlink($file);
$cached_file = false;
}
} else { // image file
// check if is local file
if (!@file_exists($file)) {
// encode spaces on filename (file is probably an URL)
$file = str_replace(' ', '%20', $file);
}
// get image dimensions
$imsize = @getimagesize($file);
if ($imsize === FALSE) {
if (function_exists('curl_init')) {
// try to get remote file data using cURL
$cs = curl_init(); // curl session
curl_setopt($cs, CURLOPT_URL, $file);
curl_setopt($cs, CURLOPT_BINARYTRANSFER, true);
curl_setopt($cs, CURLOPT_FAILONERROR, true);
curl_setopt($cs, CURLOPT_RETURNTRANSFER, true);
curl_setopt($cs, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($cs, CURLOPT_TIMEOUT, 30);
$imgdata = curl_exec($cs);
curl_close($cs);
if($imgdata !== FALSE) {
// copy image to cache
$file = tempnam(K_PATH_CACHE, 'img_');
$fp = fopen($file, 'w');
fwrite($fp, $imgdata);
fclose($fp);
unset($imgdata);
$cached_file = true;
$imsize = @getimagesize($file);
if ($imsize === FALSE) {
unlink($file);
$cached_file = false;
}
}
} elseif (($w > 0) AND ($h > 0)) {
// get measures from specified data
$pw = $this->getHTMLUnitToUnits($w, 0, $this->pdfunit, true) * $this->imgscale * $this->k;
$ph = $this->getHTMLUnitToUnits($h, 0, $this->pdfunit, true) * $this->imgscale * $this->k;
$imsize = array($pw, $ph);
}
} elseif (($w > 0) AND ($h > 0)) {
// get measures from specified data
$pw = $this->getHTMLUnitToUnits($w, 0, $this->pdfunit, true) * $this->imgscale * $this->k;
$ph = $this->getHTMLUnitToUnits($h, 0, $this->pdfunit, true) * $this->imgscale * $this->k;
$imsize = array($pw, $ph);
}
}
if ($imsize === FALSE) {
@ -7458,9 +7474,15 @@ class TCPDF {
* @since 4.9.016 (2010-04-20)
*/
protected function _toPNG($image) {
// set temporary image file name
$tempname = tempnam(K_PATH_CACHE, 'jpg_');
// turn off interlaced mode
imageinterlace($image, 0);
// create temporary PNG image
imagepng($image, $tempname);
// remove image from memory
imagedestroy($image);
// get PNG image data
$retvars = $this->_parsepng($tempname);
// tidy up by removing temporary image
unlink($tempname);