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-08-21 17:31:00 +02:00
parent 8c917d7213
commit 3a2c3f45d2
17 changed files with 284 additions and 232 deletions

View File

@ -1,3 +1,7 @@
4.6.026 (2009-08-21)
- Bug #2841693 "Problem with MultiCell and ishtml and justification" was fixed.
- Signature functions were improved but not yet fixed (tcpdf.crt and example n. 52 were updated).
4.6.025 (2009-08-17) 4.6.025 (2009-08-17)
- Carriage returns (\r) were removed from source code. - Carriage returns (\r) were removed from source code.
- Problem related to set_magic_quotes_runtime() depracated was fixed. - Problem related to set_magic_quotes_runtime() depracated was fixed.

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------ ------------------------------------------------------------
Name: TCPDF Name: TCPDF
Version: 4.6.025 Version: 4.6.026
Release date: 2009-08-17 Release date: 2009-08-21
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 Mon, 17 Aug 2009 17:59:54 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Fri, 21 Aug 2009 17:30:46 +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 Mon, 17 Aug 2009 17:59:54 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Fri, 21 Aug 2009 17:30:46 +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 Mon, 17 Aug 2009 17:59:54 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Fri, 21 Aug 2009 17:30:46 +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 Mon, 17 Aug 2009 18:00:05 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Fri, 21 Aug 2009 17:30:52 +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 Mon, 17 Aug 2009 17:59:55 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Fri, 21 Aug 2009 17:30:47 +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.025</td> <td><b>version:</b>&nbsp;&nbsp;</td><td>4.6.026</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.025 (http://www.tcpdf.org)'</code> <code>PDF_PRODUCER = 'TCPDF 4.6.026 (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 Mon, 17 Aug 2009 17:59:56 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Fri, 21 Aug 2009 17:30:47 +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 Mon, 17 Aug 2009 18:00:05 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Fri, 21 Aug 2009 17:30:52 +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

@ -1378,7 +1378,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 Mon, 17 Aug 2009 17:59:54 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Fri, 21 Aug 2009 17:30:46 +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

@ -1401,7 +1401,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 Mon, 17 Aug 2009 17:59:53 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Fri, 21 Aug 2009 17:30:46 +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 Mon, 17 Aug 2009 18:00:05 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Fri, 21 Aug 2009 17:30:52 +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 Mon, 17 Aug 2009 17:59:54 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Fri, 21 Aug 2009 17:30:46 +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 Mon, 17 Aug 2009 17:59:54 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Fri, 21 Aug 2009 17:30:46 +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,7 +2,7 @@
//============================================================+ //============================================================+
// File name : example_052.php // File name : example_052.php
// Begin : 2009-05-07 // Begin : 2009-05-07
// Last Update : 2009-05-07 // Last Update : 2009-08-21
// //
// Description : Example 052 for TCPDF class // Description : Example 052 for TCPDF class
// Certification Signature (experimental) // Certification Signature (experimental)
@ -70,7 +70,7 @@ $pdf->setLanguageArray($l);
// --------------------------------------------------------- // ---------------------------------------------------------
// set certificate file // set certificate file
$certificate = 'file://../tcpdf.pem'; $certificate = 'file://../tcpdf.crt';
// set additional information // set additional information
$info = array( $info = array(
@ -81,7 +81,7 @@ $info = array(
); );
// set document signature // set document signature
$pdf->setSignature($certificate, $certificate, '', '', 2, $info); $pdf->setSignature($certificate, $certificate, 'tcpdfdemo', '', 2, $info);
// set font // set font
$pdf->SetFont('helvetica', '', 10); $pdf->SetFont('helvetica', '', 10);
@ -94,7 +94,8 @@ $pdf->Cell(0, 12, 'Signed Document', 1, 1, 'C');
// --------------------------------------------------------- // ---------------------------------------------------------
//Close and output PDF document //Close and output PDF document
//echo $pdf->Output('example_052.pdf', 'S');
$pdf->Output('example_052.pdf', 'I'); $pdf->Output('example_052.pdf', 'I');
//============================================================+ //============================================================+

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-08-17 // Last Update : 2009-08-21
// Author : Nicola Asuni - info@tecnick.com - http://www.tcpdf.org // Author : Nicola Asuni - info@tecnick.com - http://www.tcpdf.org
// Version : 4.6.025 // Version : 4.6.026
// 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.025 * @version 4.6.026
*/ */
/** /**
@ -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.025 (http://www.tcpdf.org)'); define('PDF_PRODUCER', 'TCPDF 4.6.026 (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.025 * @version 4.6.026
* @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
@ -5401,8 +5401,19 @@ if (!class_exists('TCPDF', false)) {
* @since 4.0.018 (2008-08-06) * @since 4.0.018 (2008-08-06)
*/ */
protected function _putannots($n) { protected function _putannots($n) {
if ($this->sign AND isset($this->signature_data['cert_type']) AND $this->signature_data['cert_type'] > 0) {
// set reference for signature object
$annots = '/Annots [ *!*!*! 0 R';
if (!isset($this->PageAnnots[$n])) {
$annots .= "\n]";
$this->_out($annots);
return;
}
}
if (isset($this->PageAnnots[$n])) { if (isset($this->PageAnnots[$n])) {
$annots = '/Annots ['; if (!isset($annots)) {
$annots = '/Annots [';
}
foreach ($this->PageAnnots[$n] as $key => $pl) { foreach ($this->PageAnnots[$n] as $key => $pl) {
$pl['opt'] = array_change_key_case($pl['opt'], CASE_LOWER); $pl['opt'] = array_change_key_case($pl['opt'], CASE_LOWER);
$a = $pl['x'] * $this->k; $a = $pl['x'] * $this->k;
@ -6330,6 +6341,19 @@ if (!class_exists('TCPDF', false)) {
} elseif (!is_string($this->ZoomMode)) { } elseif (!is_string($this->ZoomMode)) {
$this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode / 100).']'); $this->_out('/OpenAction [3 0 R /XYZ null null '.($this->ZoomMode / 100).']');
} }
// signatures
if ($this->sign AND isset($this->signature_data['cert_type'])) {
if ($this->signature_data['cert_type'] > 0) {
$this->_out('/AcroForm<<');
$this->_out('/Fields ['.$this->sig_obj_id.' 0 R]');
$this->_out('/NeedAppearances false');
$this->_out('/SigFlags 3');
$this->_out('>>');
$this->_out('/Perms<</DocMDP '.($this->sig_obj_id + 1).' 0 R>>');
} else {
$this->_out('/Perms<</UR3 '.($this->sig_obj_id + 1).' 0 R>>');
}
}
if (isset($this->LayoutMode) AND (!$this->empty_string($this->LayoutMode))) { if (isset($this->LayoutMode) AND (!$this->empty_string($this->LayoutMode))) {
$this->_out('/PageLayout /'.$this->LayoutMode.''); $this->_out('/PageLayout /'.$this->LayoutMode.'');
} }
@ -6353,19 +6377,6 @@ if (!class_exists('TCPDF', false)) {
$v = $this->n_ocg_view.' 0 R'; $v = $this->n_ocg_view.' 0 R';
$as = '<</Event /Print /OCGs ['.$p.' '.$v.'] /Category [/Print]>> <</Event /View /OCGs ['.$p.' '.$v.'] /Category [/View]>>'; $as = '<</Event /Print /OCGs ['.$p.' '.$v.'] /Category [/Print]>> <</Event /View /OCGs ['.$p.' '.$v.'] /Category [/View]>>';
$this->_out('/OCProperties <</OCGs ['.$p.' '.$v.'] /D <</ON ['.$p.'] /OFF ['.$v.'] /AS ['.$as.']>>>>'); $this->_out('/OCProperties <</OCGs ['.$p.' '.$v.'] /D <</ON ['.$p.'] /OFF ['.$v.'] /AS ['.$as.']>>>>');
// signatures
if ($this->sign AND isset($this->signature_data['cert_type'])) {
if ($this->signature_data['cert_type'] > 0) {
$this->_out('/AcroForm<<');
$this->_out('/Fields ['.$this->sig_obj_id.' 0 R]');
$this->_out('/NeedAppearances false');
$this->_out('/SigFlags 3');
$this->_out('>>');
$this->_out('/Perms<</DocMDP '.($this->sig_obj_id + 1).' 0 R>>');
} else {
$this->_out('/Perms<</UR3 '.($this->sig_obj_id + 1).' 0 R>>');
}
}
} }
/** /**
@ -6473,11 +6484,28 @@ if (!class_exists('TCPDF', false)) {
$this->_putresources(); $this->_putresources();
// Signature // Signature
if ($this->sign AND isset($this->signature_data['cert_type'])) { if ($this->sign AND isset($this->signature_data['cert_type'])) {
// widget annotation // widget annotation for signature
$this->sig_obj_id = $this->_newobj(); $this->sig_obj_id = $this->_newobj();
// --- replace signature ID on the first page ---
// get the document content
$pdfdoc = $this->getBuffer();
// Remove the original buffer
if (isset($this->diskcache) AND $this->diskcache) {
// remove buffer file from cache
unlink($this->buffer);
}
unset($this->buffer);
$signature_widget_ref = sprintf('/Annots [ % 6u 0 R', $this->sig_obj_id);
$pdfdoc = str_replace('/Annots [ *!*!*! 0 R', $signature_widget_ref, $pdfdoc);
$this->diskcache = false;
$this->buffer = &$pdfdoc;
$this->bufferlen = strlen($pdfdoc);
// ---
$this->_out('<<'); $this->_out('<<');
$this->_out('/Type /Annot /Subtype /Widget /Rect [0 0 0 0]');
$this->_out('/P 3 0 R'); // link to first page object
$this->_out('/FT /Sig'); $this->_out('/FT /Sig');
$this->_out('/T '.$this->_textstring('SIGNATURE')); $this->_out('/T '.$this->_textstring('Signature'));
$this->_out('/Ff 0'); $this->_out('/Ff 0');
$this->_out('/V '.($this->sig_obj_id + 1).' 0 R'); $this->_out('/V '.($this->sig_obj_id + 1).' 0 R');
$this->_out('>>'); $this->_out('>>');
@ -9422,6 +9450,9 @@ if (!class_exists('TCPDF', false)) {
$this->_out('/Signature['.$this->ur_signature.']'); $this->_out('/Signature['.$this->ur_signature.']');
} }
$this->_out('>>'); $this->_out('>>');
// /Data 30 0 R
$this->_out('>>'); $this->_out('>>');
$this->_out(']'); $this->_out(']');
} }
@ -9513,6 +9544,8 @@ if (!class_exists('TCPDF', false)) {
*/ */
public function setSignature($signing_cert='', $private_key='', $private_key_password='', $extracerts='', $cert_type=2, $info=array()) { public function setSignature($signing_cert='', $private_key='', $private_key_password='', $extracerts='', $cert_type=2, $info=array()) {
// to create self-signed signature: openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.pem -out tcpdf.pem // to create self-signed signature: openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.pem -out tcpdf.pem
// to convert pfx certificate to pem: openssl
// OpenSSL> pkcs12 -in <cert.pfx> -out <cert.pem> -nodes
$this->sign = true; $this->sign = true;
$this->signature_data = array(); $this->signature_data = array();
if (strlen($signing_cert) == 0) { if (strlen($signing_cert) == 0) {
@ -11679,8 +11712,9 @@ if (!class_exists('TCPDF', false)) {
$t_x = $this->lMargin - $this->endlinex - (($no - $ns - 1) * $this->GetStringWidth(chr(32))); $t_x = $this->lMargin - $this->endlinex - (($no - $ns - 1) * $this->GetStringWidth(chr(32)));
} }
// calculate additional space to add to each space // calculate additional space to add to each space
$spacewidth = (($tw - $linew + (($no - $ns) * $this->GetStringWidth(chr(32)))) / ($ns?$ns:1)) * $this->k; $spacelen = $this->GetStringWidth(chr(32));
$spacewidthu = -1000 * ($tw - $linew + ($no * $this->GetStringWidth(chr(32)))) / ($ns?$ns:1) / $this->FontSize; $spacewidth = (($tw - $linew + (($no - $ns) * $spacelen)) / ($ns?$ns:1)) * $this->k;
$spacewidthu = -1000 * ($tw - $linew + ($no * $spacelen)) / ($ns?$ns:1) / $this->FontSize;
$nsmax = $ns; $nsmax = $ns;
$ns = 0; $ns = 0;
reset($lnstring); reset($lnstring);
@ -11689,6 +11723,19 @@ if (!class_exists('TCPDF', false)) {
$prev_epsposbeg = 0; $prev_epsposbeg = 0;
global $spacew; global $spacew;
while (preg_match('/([0-9\.\+\-]*)[\s](Td|cm|m|l|c|re)[\s]/x', $pmid, $strpiece, PREG_OFFSET_CAPTURE, $offset) == 1) { while (preg_match('/([0-9\.\+\-]*)[\s](Td|cm|m|l|c|re)[\s]/x', $pmid, $strpiece, PREG_OFFSET_CAPTURE, $offset) == 1) {
// check if we are inside a string section '[( ... )]'
$stroffset = strpos($pmid, '[(', $offset);
if (($stroffset !== false) AND ($stroffset <= $strpiece[2][1])) {
// set offset to the end of string section
$offset = strpos($pmid, ')]', $stroffset);
while (($offset !== false) AND ($pmid{($offset - 1)} == '\\')) {
$offset = strpos($pmid, ')]', ($offset + 1));
}
if ($offset === false) {
$this->Error('HTML Justification: malformed PDF code.');
}
continue;
}
if ($this->rtl OR $this->tmprtl) { if ($this->rtl OR $this->tmprtl) {
$spacew = ($spacewidth * ($nsmax - $ns)); $spacew = ($spacewidth * ($nsmax - $ns));
} else { } else {