32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-11-26 14:26:28 +00:00
This commit is contained in:
nicolaasuni 2009-09-02 14:35:08 +02:00
parent 5987497754
commit 00bcd86586
17 changed files with 264 additions and 302 deletions

View File

@ -1,3 +1,7 @@
4.7.002 (2009-09-02)
- Bug item #2848892 "writeHTML + table: Gaps between rows" was fixed.
- JavaScript support was fixed (see example n. 53).
4.7.001 (2009-08-30) 4.7.001 (2009-08-30)
- The Polygon() and Arrow() methods were fixed and improved (see example n. 12). - The Polygon() and Arrow() methods were fixed and improved (see example n. 12).

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------ ------------------------------------------------------------
Name: TCPDF Name: TCPDF
Version: 4.7.001 Version: 4.7.002
Release date: 2009-08-30 Release date: 2009-09-02
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 Sun, 30 Aug 2009 10:53:24 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Wed, 02 Sep 2009 14:34:54 +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 Sun, 30 Aug 2009 10:53:24 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Wed, 02 Sep 2009 14:34:54 +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 Sun, 30 Aug 2009 10:53:24 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Wed, 02 Sep 2009 14:34:54 +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 Sun, 30 Aug 2009 10:53:30 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Wed, 02 Sep 2009 14:35:00 +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 Sun, 30 Aug 2009 10:53:25 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Wed, 02 Sep 2009 14:34:55 +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.7.001</td> <td><b>version:</b>&nbsp;&nbsp;</td><td>4.7.002</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.7.001 (http://www.tcpdf.org)'</code> <code>PDF_PRODUCER = 'TCPDF 4.7.002 (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 Sun, 30 Aug 2009 10:53:25 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Wed, 02 Sep 2009 14:34:55 +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 Sun, 30 Aug 2009 10:53:30 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Wed, 02 Sep 2009 14:35:00 +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

@ -1369,8 +1369,6 @@
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_puttrailer">TCPDF::_puttrailer()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Output trailer.</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_puttrailer">TCPDF::_puttrailer()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Output trailer.</dd>
<dt><b>_puttruetypeunicode</b></dt> <dt><b>_puttruetypeunicode</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_puttruetypeunicode">TCPDF::_puttruetypeunicode()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Adds unicode fonts.<br /></dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_puttruetypeunicode">TCPDF::_puttruetypeunicode()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Adds unicode fonts.<br /></dd>
<dt><b>_putursignature</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_putursignature">TCPDF::_putursignature()</a></dd>
<dt><b>_putviewerpreferences</b></dt> <dt><b>_putviewerpreferences</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_putviewerpreferences">TCPDF::_putviewerpreferences()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Output viewer preferences.</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_putviewerpreferences">TCPDF::_putviewerpreferences()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Output viewer preferences.</dd>
<dt><b>_putxobjectdict</b></dt> <dt><b>_putxobjectdict</b></dt>
@ -1394,7 +1392,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 Sun, 30 Aug 2009 10:53:24 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Wed, 02 Sep 2009 14:34:54 +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

@ -190,8 +190,6 @@
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_puttrailer">TCPDF::_puttrailer()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Output trailer.</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_puttrailer">TCPDF::_puttrailer()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Output trailer.</dd>
<dt><b>_puttruetypeunicode</b></dt> <dt><b>_puttruetypeunicode</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_puttruetypeunicode">TCPDF::_puttruetypeunicode()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Adds unicode fonts.<br /></dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_puttruetypeunicode">TCPDF::_puttruetypeunicode()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Adds unicode fonts.<br /></dd>
<dt><b>_putursignature</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_putursignature">TCPDF::_putursignature()</a></dd>
<dt><b>_putviewerpreferences</b></dt> <dt><b>_putviewerpreferences</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_putviewerpreferences">TCPDF::_putviewerpreferences()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Output viewer preferences.</dd> <dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#method_putviewerpreferences">TCPDF::_putviewerpreferences()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Output viewer preferences.</dd>
<dt><b>_putxobjectdict</b></dt> <dt><b>_putxobjectdict</b></dt>
@ -1417,7 +1415,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 Sun, 30 Aug 2009 10:53:24 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Wed, 02 Sep 2009 14:34:54 +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 Sun, 30 Aug 2009 10:53:30 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Wed, 02 Sep 2009 14:35:00 +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 Sun, 30 Aug 2009 10:53:24 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Wed, 02 Sep 2009 14:34:54 +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 Sun, 30 Aug 2009 10:53:24 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a> Documentation generated on Wed, 02 Sep 2009 14:34:54 +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_014.php // File name : example_014.php
// Begin : 2008-03-04 // Begin : 2008-03-04
// Last Update : 2009-05-07 // Last Update : 2009-09-02
// //
// Description : Example 014 for TCPDF class // Description : Example 014 for TCPDF class
// Javascript Form and user rights (only works on Adobe Acrobat) // Javascript Form and user rights (only works on Adobe Acrobat)
@ -75,12 +75,8 @@ $pdf->SetFont('helvetica', 'BI', 18);
// add a page // add a page
$pdf->AddPage(); $pdf->AddPage();
// Release User's Rights For PDF reader.
// This is required to display and fill form fields on PDF Readers.
$pdf->setUserRights();
/* /*
Caution: the generated PDF works only with Acrobat Reader 5.1. Caution: the generated PDF works only with Adobe Acrobat
It is possible to create text fields, combo boxes, check boxes and buttons. Fields are created at the current position and are given a name. This name allows to manipulate them via JavaScript in order to perform some validation for instance. It is possible to create text fields, combo boxes, check boxes and buttons. Fields are created at the current position and are given a name. This name allows to manipulate them via JavaScript in order to perform some validation for instance.
Upon field creation, an associative array can be passed to set a number of properties, among which: Upon field creation, an associative array can be passed to set a number of properties, among which:
rect: Position and size of field on page. rect: Position and size of field on page.
@ -118,7 +114,8 @@ Colors can be chosen in the following list (case sensitive): black white red gre
*/ */
// WARNING: only works on Adobe Acrobat // WARNING: only works on Adobe Acrobat
$pdf->Cell(0, 5, 'THIS EXAMPLE ONLY WORKS ON ADOBE ACROBAT', 0, 1, 'C'); $pdf->Cell(0, 5, 'THIS EXAMPLE ONLY WORKS ON ADOBE ACROBAT!', 0, 1, 'C');
$pdf->Ln(10);
$pdf->Cell(0, 5, 'Subscription form', 0, 1, 'C'); $pdf->Cell(0, 5, 'Subscription form', 0, 1, 'C');
$pdf->Ln(10); $pdf->Ln(10);

117
tcpdf.php
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-30 // Last Update : 2009-09-02
// Author : Nicola Asuni - info@tecnick.com - http://www.tcpdf.org // Author : Nicola Asuni - info@tecnick.com - http://www.tcpdf.org
// Version : 4.7.001 // Version : 4.7.002
// 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.
@ -128,7 +128,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.7.001 * @version 4.7.002
*/ */
/** /**
@ -152,14 +152,14 @@ if (!class_exists('TCPDF', false)) {
/** /**
* define default PDF document producer * define default PDF document producer
*/ */
define('PDF_PRODUCER', 'TCPDF 4.7.001 (http://www.tcpdf.org)'); define('PDF_PRODUCER', 'TCPDF 4.7.002 (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.7.001 * @version 4.7.002
* @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
@ -1295,7 +1295,7 @@ if (!class_exists('TCPDF', false)) {
* @access protected * @access protected
* @since 4.6.005 (2009-04-24) * @since 4.6.005 (2009-04-24)
*/ */
protected $signature_max_lenght = 5120; protected $signature_max_lenght = 11742;
/** /**
* Regular expression used to find blank characters used for word-wrapping. * Regular expression used to find blank characters used for word-wrapping.
@ -5463,7 +5463,7 @@ if (!class_exists('TCPDF', false)) {
* @since 4.7.000 (2008-08-29) * @since 4.7.000 (2008-08-29)
*/ */
protected function _putannotsrefs($n) { protected function _putannotsrefs($n) {
if (!(isset($this->PageAnnots[$n]) OR ($this->sign AND isset($this->signature_data['cert_type']) AND ($this->signature_data['cert_type'] > 0)))) { if (!(isset($this->PageAnnots[$n]) OR ($this->sign AND isset($this->signature_data['cert_type'])))) {
return; return;
} }
$this->_out('/Annots ['); $this->_out('/Annots [');
@ -5474,7 +5474,7 @@ if (!class_exists('TCPDF', false)) {
$this->_out($this->annot_obj_id.' 0 R'); $this->_out($this->annot_obj_id.' 0 R');
} }
} }
if (($n==1) AND $this->sign AND isset($this->signature_data['cert_type']) AND ($this->signature_data['cert_type'] > 0)) { if (($n==1) AND $this->sign AND isset($this->signature_data['cert_type'])) {
// set reference for signature object // set reference for signature object
$this->_out($this->sig_annot_ref); $this->_out($this->sig_annot_ref);
} }
@ -6432,19 +6432,6 @@ 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.'');
} }
@ -6468,6 +6455,19 @@ 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'])) {
$this->_out('/AcroForm<<');
$this->_out('/Fields ['.$this->sig_obj_id.' 0 R]');
$this->_out('/NeedAppearances false');
$this->_out('/SigFlags 3');
$this->_out('>>');
if ($this->signature_data['cert_type'] > 0) {
$this->_out('/Perms<</DocMDP '.($this->sig_obj_id + 1).' 0 R>>');
} else {
$this->_out('/Perms<</UR3 '.($this->sig_obj_id + 1).' 0 R>>');
}
}
} }
/** /**
@ -6606,7 +6606,6 @@ if (!class_exists('TCPDF', false)) {
$this->_newobj(); $this->_newobj();
$this->_out('<<'); $this->_out('<<');
$this->_putsignature(); $this->_putsignature();
$this->_putursignature();
$this->_out('>>'); $this->_out('>>');
$this->_out('endobj'); $this->_out('endobj');
} }
@ -9381,9 +9380,17 @@ if (!class_exists('TCPDF', false)) {
if (empty($this->javascript)) { if (empty($this->javascript)) {
return; return;
} }
// the following two lines are uded to avoid form fields duplication after saving if (!$this->ur) {
$js1 = sprintf("ftcpdfdocsaved=this.addField('%s','%s',%d,[%.2F,%.2F,%.2F,%.2F]);", 'tcpdfdocsaved', 'text', 0, 0, 1, 0, 1); // enable JavaScript
$js2 = "getField('tcpdfdocsaved').value = 'saved';"; $this->setUserRights();
}
if (strpos($this->javascript, 'this.addField') > 0) {
// the following two lines are used to avoid form fields duplication after saving
// The addField method only works on Acrobat Writer, unless the document is signed with Adobe private key (UR3)
$jsa = sprintf("ftcpdfdocsaved=this.addField('%s','%s',%d,[%.2F,%.2F,%.2F,%.2F]);", 'tcpdfdocsaved', 'text', 0, 0, 1, 0, 1);
$jsb = "getField('tcpdfdocsaved').value='saved';";
$this->javascript = $jsa."\n".$this->javascript."\n".$jsb;
}
$this->_newobj(); $this->_newobj();
$this->n_js = $this->n; $this->n_js = $this->n;
$this->_out('<<'); $this->_out('<<');
@ -9393,7 +9400,7 @@ if (!class_exists('TCPDF', false)) {
$this->_newobj(); $this->_newobj();
$this->_out('<<'); $this->_out('<<');
$this->_out('/S /JavaScript'); $this->_out('/S /JavaScript');
$this->_out('/JS '.$this->_textstring($js1."\n".$this->javascript."\n".$js2)); $this->_out('/JS '.$this->_textstring($this->javascript));
$this->_out('>>'); $this->_out('>>');
$this->_out('endobj'); $this->_out('endobj');
} }
@ -9574,14 +9581,14 @@ if (!class_exists('TCPDF', false)) {
// END JAVASCRIPT - FORMS ------------------------------ // END JAVASCRIPT - FORMS ------------------------------
/* /*
* Enable Write permissions for PDF Reader. * Add certification signature (DocMDP or UR3)
* WARNING: This works only using the Adobe private key with the setSignature() method. * You can set only one signature type
* @access protected * @access protected
* @author Nicola Asuni * @author Nicola Asuni
* @since 2.9.000 (2008-03-26) * @since 4.6.008 (2009-05-07)
*/ */
protected function _putursignature() { protected function _putsignature() {
if ((!$this->sign) OR (isset($this->signature_data['cert_type']) AND ($this->signature_data['cert_type'] > 0))) { if ((!$this->sign) OR (!isset($this->signature_data['cert_type']))) {
return; return;
} }
$this->_out('/Type /Sig'); $this->_out('/Type /Sig');
@ -9589,11 +9596,18 @@ if (!class_exists('TCPDF', false)) {
$this->_out('/SubFilter /adbe.pkcs7.detached'); $this->_out('/SubFilter /adbe.pkcs7.detached');
$this->_out($this->byterange_string); $this->_out($this->byterange_string);
$this->_out('/Contents<>'.str_repeat(' ', $this->signature_max_lenght)); $this->_out('/Contents<>'.str_repeat(' ', $this->signature_max_lenght));
if ($this->ur) {
$this->_out('/Reference'); $this->_out('/Reference');
$this->_out('['); $this->_out('[');
$this->_out('<<'); $this->_out('<<');
$this->_out('/Type /SigRef'); $this->_out('/Type /SigRef');
if ($this->signature_data['cert_type'] > 0) {
$this->_out('/TransformMethod /DocMDP');
$this->_out('/TransformParams');
$this->_out('<<');
$this->_out('/Type /TransformParams');
$this->_out('/V /1.2');
$this->_out('/P '.$this->signature_data['cert_type'].'');
} else {
$this->_out('/TransformMethod /UR3'); $this->_out('/TransformMethod /UR3');
$this->_out('/TransformParams'); $this->_out('/TransformParams');
$this->_out('<<'); $this->_out('<<');
@ -9611,38 +9625,7 @@ if (!class_exists('TCPDF', false)) {
if (!$this->empty_string($this->ur_signature)) { if (!$this->empty_string($this->ur_signature)) {
$this->_out('/Signature['.$this->ur_signature.']'); $this->_out('/Signature['.$this->ur_signature.']');
} }
$this->_out('>>');
$this->_out('>>');
$this->_out(']');
} }
$this->_out('/M '.$this->_datestring());
}
/*
* Add certification signature (DocMDP)
* @access protected
* @author Nicola Asuni
* @since 4.6.008 (2009-05-07)
*/
protected function _putsignature() {
if ((!$this->sign) OR (isset($this->signature_data['cert_type']) AND ($this->signature_data['cert_type'] <= 0))) {
return;
}
$this->_out('/Type /Sig');
$this->_out('/Filter /Adobe.PPKLite');
$this->_out('/SubFilter /adbe.pkcs7.detached');
$this->_out($this->byterange_string);
$this->_out('/Contents<>'.str_repeat(' ', $this->signature_max_lenght));
$this->_out('/Reference');
$this->_out('[');
$this->_out('<<');
$this->_out('/Type /SigRef');
$this->_out('/TransformMethod /DocMDP');
$this->_out('/TransformParams');
$this->_out('<<');
$this->_out('/Type /TransformParams');
$this->_out('/V /1.2');
$this->_out('/P '.$this->signature_data['cert_type'].'');
$this->_out('>>'); $this->_out('>>');
$this->_out('>>'); $this->_out('>>');
$this->_out(']'); $this->_out(']');
@ -9686,6 +9669,10 @@ if (!class_exists('TCPDF', false)) {
$this->ur_annots = $annots; $this->ur_annots = $annots;
$this->ur_form = $form; $this->ur_form = $form;
$this->ur_signature = $signature; $this->ur_signature = $signature;
if (!$this->sign) {
// This signature only works using the Adobe Private key that is unavailable!
//$this->setSignature('', '', '', '', 0, array());
}
} }
/* /*
@ -9709,6 +9696,7 @@ if (!class_exists('TCPDF', false)) {
$this->signature_data = array(); $this->signature_data = array();
if (strlen($signing_cert) == 0) { if (strlen($signing_cert) == 0) {
$signing_cert = 'file://'.dirname(__FILE__).'/tcpdf.crt'; $signing_cert = 'file://'.dirname(__FILE__).'/tcpdf.crt';
$private_key_password = 'tcpdfdemo';
} }
if (strlen($private_key) == 0) { if (strlen($private_key) == 0) {
$private_key = $signing_cert; $private_key = $signing_cert;
@ -11650,6 +11638,7 @@ if (!class_exists('TCPDF', false)) {
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)) {
// get image height // get image height
$imgh = $this->getHTMLUnitToUnits($dom[$key]['attribute']['height'], $this->lasth, 'px'); $imgh = $this->getHTMLUnitToUnits($dom[$key]['attribute']['height'], $this->lasth, 'px');
if (!$this->InFooter) { if (!$this->InFooter) {
@ -11752,7 +11741,9 @@ if (!class_exists('TCPDF', false)) {
} }
$pask = $next_pask; $pask = $next_pask;
} }
if (($dom[$key]['value'] != 'td') AND ($dom[$key]['value'] != 'th')) {
$this->y += (($curfontsize - $fontsize) / $this->k); $this->y += (($curfontsize - $fontsize) / $this->k);
}
$minstartliney = min($this->y, $minstartliney); $minstartliney = min($this->y, $minstartliney);
} }
$curfontname = $fontname; $curfontname = $fontname;