32
1
mirror of https://github.com/vdm-io/tcpdf.git synced 2024-11-14 17:14:05 +00:00
This commit is contained in:
nicolaasuni 2009-04-23 10:53:25 +02:00
parent 3a42a876e7
commit 6ab6c9fb0d
17 changed files with 253 additions and 55 deletions

View File

@ -1,3 +1,6 @@
4.6.004 (2009-04-23)
- Method deletePage() was added to delete pages (see example n. 44).
4.6.003 (2009-04-21)
- The caching mechanism of the UTF8StringToArray() method was fixed.

View File

@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076
------------------------------------------------------------
Name: TCPDF
Version: 4.6.003
Release date: 2009-04-21
Version: 4.6.004
Release date: 2009-04-23
Author: Nicola Asuni
Copyright (c) 2001-2009:
@ -40,7 +40,7 @@ Main Features:
// * includes Javascript and forms support;
// * includes a method to print various barcode formats: CODE 39, ANSI MH10.8M-1983, USD-3, 3 of 9, CODE 93, USS-93, Standard 2 of 5, Interleaved 2 of 5, CODE 128 A/B/C, 2 and 5 Digits UPC-Based Extention, EAN 8, EAN 13, UPC-A, UPC-E, MSI, POSTNET, PLANET, RMS4CC (Royal Mail 4-state Customer Code), CBC (Customer Bar Code), KIX (Klant index - Customer index), Intelligent Mail Barcode, Onecode, USPS-B-3200, CODABAR, CODE 11, PHARMACODE, PHARMACODE TWO-TRACKS;
// * includes methods to set Bookmarks and print a Table of Content;
// * includes a method to move pages;
// * includes methods to move and delete pages;
// * includes methods for automatic page header and footer management;
// * supports automatic page break;
// * supports automatic page numbering and page groups;

View File

@ -45,7 +45,7 @@
<div class="credit">
<hr />
Documentation generated on Tue, 21 Apr 2009 12:11:53 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 23 Apr 2009 10:53:11 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -74,7 +74,7 @@ Source Location: /tcpdf.php<br /><br />
<h4>Version:</h4>
<ul>
<li>4.6.003</li>
<li>4.6.004</li>
</ul>
@ -284,6 +284,7 @@ Source Location: /tcpdf.php<br /><br />
<li><a href="../com-tecnick-tcpdf/TCPDF.html#methodconvertHTMLColorToDec">convertHTMLColorToDec</a></li>
<li><a href="../com-tecnick-tcpdf/TCPDF.html#methodCoonsPatchMesh">CoonsPatchMesh</a></li>
<li><a href="../com-tecnick-tcpdf/TCPDF.html#methodCurve">Curve</a></li>
<li><a href="../com-tecnick-tcpdf/TCPDF.html#methoddeletePage">deletePage</a></li>
<li><a href="../com-tecnick-tcpdf/TCPDF.html#methodEllipse">Ellipse</a></li>
<li><a href="../com-tecnick-tcpdf/TCPDF.html#methodempty_string">empty_string</a></li>
<li><a href="../com-tecnick-tcpdf/TCPDF.html#methodendPage">endPage</a></li>
@ -581,7 +582,7 @@ This is a PHP class for generating PDF documents without requiring external exte
<td><b>author:</b>&nbsp;&nbsp;</td><td>Nicola Asuni - info@tecnick.com</td>
</tr>
<tr>
<td><b>version:</b>&nbsp;&nbsp;</td><td>4.6.003</td>
<td><b>version:</b>&nbsp;&nbsp;</td><td>4.6.004</td>
</tr>
<tr>
<td><b>link:</b>&nbsp;&nbsp;</td><td><a href="http://www.tcpdf.org">http://www.tcpdf.org</a></td>
@ -5608,7 +5609,7 @@ $k)</code>
</div>
<hr />
<a name="methodaddTOC"></a>
<h3>method addTOC <span class="smalllinenumber">[line 13358]</span></h3>
<h3>method addTOC <span class="smalllinenumber">[line 13495]</span></h3>
<div class="function">
<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">
@ -6512,7 +6513,7 @@ $prop = array()])</code>
</div>
<hr />
<a name="methodcommitTransaction"></a>
<h3>method commitTransaction <span class="smalllinenumber">[line 13515]</span></h3>
<h3>method commitTransaction <span class="smalllinenumber">[line 13652]</span></h3>
<div class="function">
<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">
@ -6781,6 +6782,48 @@ $fill_color = array()])</code>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methoddeletePage"></a>
<h3>method deletePage <span class="smalllinenumber">[line 13355]</span></h3>
<div class="function">
<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>true deletePage(
int
$page)</code>
</td></tr></table>
</td></tr></table><br />
Remove the specified page.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b>&nbsp;&nbsp;</td><td>in case of success, false in case of error.</td>
</tr>
<tr>
<td><b>since:</b>&nbsp;&nbsp;</td><td>4.6.004 (2009-04-23)</td>
</tr>
<tr>
<td><b>access:</b>&nbsp;&nbsp;</td><td>public</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">int&nbsp;&nbsp;</td>
<td><b>$page</b>&nbsp;&nbsp;</td>
<td>page to remove</td>
</tr>
</table>
</div><br />
<div class="top">[ <a href="#top">Top</a> ]</div>
</div>
<hr />
<a name="methodEllipse"></a>
<h3>method Ellipse <span class="smalllinenumber">[line 7772]</span></h3>
@ -6900,7 +6943,7 @@ $afinish:)</code>
</div>
<hr />
<a name="methodempty_string"></a>
<h3>method empty_string <span class="smalllinenumber">[line 13562]</span></h3>
<h3>method empty_string <span class="smalllinenumber">[line 13699]</span></h3>
<div class="function">
<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">
@ -10131,7 +10174,7 @@ $y = ''])</code>
</div>
<hr />
<a name="methodmovePage"></a>
<h3>method movePage <span class="smalllinenumber">[line 13219]</span></h3>
<h3>method movePage <span class="smalllinenumber">[line 13218]</span></h3>
<div class="function">
<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">
@ -10142,7 +10185,7 @@ $topage)</code>
</td></tr></table>
</td></tr></table><br />
Move a page to a previous position.<br /><br /><p>Use this method just before Output().</p><br /><br /><br />
Move a page to a previous position.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
@ -10305,7 +10348,7 @@ $maxh = 0])</code>
</div>
<hr />
<a name="methodobjclone"></a>
<h3>method objclone <span class="smalllinenumber">[line 13551]</span></h3>
<h3>method objclone <span class="smalllinenumber">[line 13688]</span></h3>
<div class="function">
<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">
@ -11325,7 +11368,7 @@ $length)</code>
</div>
<hr />
<a name="methodrollbackTransaction"></a>
<h3>method rollbackTransaction <span class="smalllinenumber">[line 13528]</span></h3>
<h3>method rollbackTransaction <span class="smalllinenumber">[line 13665]</span></h3>
<div class="function">
<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">
@ -15331,7 +15374,7 @@ $page = ''])</code>
</div>
<hr />
<a name="methodstartTransaction"></a>
<h3>method startTransaction <span class="smalllinenumber">[line 13501]</span></h3>
<h3>method startTransaction <span class="smalllinenumber">[line 13638]</span></h3>
<div class="function">
<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">
@ -18903,7 +18946,7 @@ $file)</code>
<div class="credit">
<hr />
Documentation generated on Tue, 21 Apr 2009 12:11:54 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 23 Apr 2009 10:53:12 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -1368,7 +1368,7 @@ $type)</code>
<div class="credit">
<hr />
Documentation generated on Tue, 21 Apr 2009 12:11:53 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 23 Apr 2009 10:53:11 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -96,7 +96,7 @@ PHP class to creates array representations for common 1D barcodes to be used wit
<div class="credit">
<hr />
Documentation generated on Tue, 21 Apr 2009 12:11:53 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 23 Apr 2009 10:53:11 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -507,7 +507,7 @@ Configuration file for TCPDF.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Tue, 21 Apr 2009 12:11:59 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 23 Apr 2009 10:53:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -88,7 +88,7 @@ Array of WEB safe colors.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Tue, 21 Apr 2009 12:11:54 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 23 Apr 2009 10:53:12 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</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>
</tr>
<tr>
<td><b>version:</b>&nbsp;&nbsp;</td><td>4.6.003</td>
<td><b>version:</b>&nbsp;&nbsp;</td><td>4.6.004</td>
</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>
@ -104,7 +104,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 4.6.003 (http://www.tcpdf.org)'</code>
<code>PDF_PRODUCER = 'TCPDF 4.6.004 (http://www.tcpdf.org)'</code>
</td></tr></table>
</td></tr></table>
@ -115,7 +115,7 @@ unicode data<br /><br /></div>
<div class="credit">
<hr />
Documentation generated on Tue, 21 Apr 2009 12:11:54 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 23 Apr 2009 10:53:12 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -237,7 +237,7 @@ Unicode Include file for TCPDF.<br /><br /><br /><br />
<div class="credit">
<hr />
Documentation generated on Tue, 21 Apr 2009 12:11:59 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 23 Apr 2009 10:53:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -245,6 +245,8 @@
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$DrawColor">TCPDF::$DrawColor</a></dd>
<dt><b>dec_to_hex</b></dt>
<dd>in file barcodes.php, method <a href="com-tecnick-tcpdf/TCPDFBarcode.html#methoddec_to_hex">TCPDFBarcode::dec_to_hex()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Convert large integer number to hexadecimal representation.</dd>
<dt><b>deletePage</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methoddeletePage">TCPDF::deletePage()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Remove the specified page.</dd>
</dl>
</div>
<a href="elementindex.html#top">top</a><br>
@ -1350,7 +1352,7 @@
<a href="elementindex.html#top">top</a><br>
<div class="credit">
<hr />
Documentation generated on Tue, 21 Apr 2009 12:11:53 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 23 Apr 2009 10:53:11 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -394,6 +394,8 @@
<dd>in file tcpdf.php, variable <a href="com-tecnick-tcpdf/TCPDF.html#var$DrawColor">TCPDF::$DrawColor</a></dd>
<dt><b>dec_to_hex</b></dt>
<dd>in file barcodes.php, method <a href="com-tecnick-tcpdf/TCPDFBarcode.html#methoddec_to_hex">TCPDFBarcode::dec_to_hex()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Convert large integer number to hexadecimal representation.</dd>
<dt><b>deletePage</b></dt>
<dd>in file tcpdf.php, method <a href="com-tecnick-tcpdf/TCPDF.html#methoddeletePage">TCPDF::deletePage()</a><br>&nbsp;&nbsp;&nbsp;&nbsp;Remove the specified page.</dd>
</dl>
</div>
<a href="elementindex_com-tecnick-tcpdf.html#top">top</a><br>
@ -1373,7 +1375,7 @@
<a href="elementindex_com-tecnick-tcpdf.html#top">top</a><br>
<div class="credit">
<hr />
Documentation generated on Tue, 21 Apr 2009 12:11:53 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 23 Apr 2009 10:53:11 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</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 Tue, 21 Apr 2009 12:11:59 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 23 Apr 2009 10:53:17 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -58,7 +58,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.1</a><br />
<div class="credit">
<hr />
Documentation generated on Tue, 21 Apr 2009 12:11:53 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 23 Apr 2009 10:53:11 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -58,7 +58,7 @@
This documentation was generated by <a href="http://www.phpdoc.org">phpDocumentor v1.4.1</a><br />
<div class="credit">
<hr />
Documentation generated on Tue, 21 Apr 2009 12:11:53 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
Documentation generated on Thu, 23 Apr 2009 10:53:11 +0200 by <a href="http://www.phpdoc.org">phpDocumentor 1.4.1</a>
</div>
</td></tr></table>
</td>

View File

@ -2,10 +2,10 @@
//============================================================+
// File name : example_044.php
// Begin : 2009-01-02
// Last Update : 2009-03-18
// Last Update : 2009-04-23
//
// Description : Example 044 for TCPDF class
// Move page
// Move and delete pages
//
// Author: Nicola Asuni
//
@ -22,7 +22,7 @@
/**
* Creates an example PDF TEST document using TCPDF
* @package com.tecnick.tcpdf
* @abstract TCPDF - Example: Move page
* @abstract TCPDF - Example: Move and delete pages
* @author Nicola Asuni
* @copyright 2004-2008 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://tcpdf.org
@ -83,7 +83,10 @@ $pdf->AddPage();
$pdf->Cell(0, 10, 'PAGE D', 0, 1, 'L');
$pdf->AddPage();
$pdf->Cell(0, 10, 'PAGE E', 0, 1, 'L');
$pdf->Cell(0, 10, 'PAGE E', 0, 1, 'L');
$pdf->AddPage();
$pdf->Cell(0, 10, 'PAGE E-2', 0, 1, 'L');
$pdf->AddPage();
$pdf->Cell(0, 10, 'PAGE F', 0, 1, 'L');
@ -94,8 +97,16 @@ $pdf->Cell(0, 10, 'PAGE C', 0, 1, 'L');
$pdf->AddPage();
$pdf->Cell(0, 10, 'PAGE G', 0, 1, 'L');
// Move page 6 to page 3
$pdf->movePage(6, 3);
// Move page 7 to page 3
$pdf->movePage(7, 3);
// Delete page 6
$pdf->deletePage(6);
$pdf->AddPage();
$pdf->Cell(0, 10, 'PAGE H', 0, 1, 'L');
// NOTE: to insert a page to a previous position, you can add a new page to the end of document and then move it using movePage().
// ---------------------------------------------------------

179
tcpdf.php
View File

@ -2,9 +2,9 @@
//============================================================+
// File name : tcpdf.php
// Begin : 2002-08-03
// Last Update : 2009-04-21
// Last Update : 2009-04-23
// Author : Nicola Asuni - info@tecnick.com - http://www.tcpdf.org
// Version : 4.6.003
// Version : 4.6.004
// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
// ----------------------------------------------------------------------------
// Copyright (C) 2002-2009 Nicola Asuni - Tecnick.com S.r.l.
@ -122,7 +122,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
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
* @version 4.6.003
* @version 4.6.004
*/
/**
@ -146,14 +146,14 @@ if (!class_exists('TCPDF', false)) {
/**
* define default PDF document producer
*/
define('PDF_PRODUCER', 'TCPDF 4.6.003 (http://www.tcpdf.org)');
define('PDF_PRODUCER', 'TCPDF 4.6.004 (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 4.6.003
* @version 4.6.004
* @author Nicola Asuni - info@tecnick.com
* @link http://www.tcpdf.org
* @license http://www.gnu.org/copyleft/lesser.html LGPL
@ -13209,7 +13209,6 @@ if (!class_exists('TCPDF', false)) {
/**
* Move a page to a previous position.
* Use this method just before Output().
* @param int $frompage number of the source page
* @param int $topage number of the destination page (must be less than $frompage)
* @return true in case of success, false in case of error.
@ -13244,34 +13243,35 @@ if (!class_exists('TCPDF', false)) {
if (isset($this->newpagegroup[$frompage])) {
$tmpnewpagegroup = $this->newpagegroup[$frompage];
}
for ($i = $frompage; $i > $topage; $i--) {
for ($i = $frompage; $i > $topage; --$i) {
$j = $i - 1;
// shift pages down
$this->pages[$i] = $this->pages[($i - 1)];
$this->pagedim[$i] = $this->pagedim[($i - 1)];
$this->pagelen[$i] = $this->pagelen[($i - 1)];
$this->intmrk[$i] = $this->intmrk[($i - 1)];
if (isset($this->footerpos[($i - 1)])) {
$this->footerpos[$i] = $this->footerpos[($i - 1)];
$this->pages[$i] = $this->pages[$j];
$this->pagedim[$i] = $this->pagedim[$j];
$this->pagelen[$i] = $this->pagelen[$j];
$this->intmrk[$i] = $this->intmrk[$j];
if (isset($this->footerpos[$j])) {
$this->footerpos[$i] = $this->footerpos[$j];
} elseif (isset($this->footerpos[$i])) {
unset($this->footerpos[$i]);
}
if (isset($this->footerlen[($i - 1)])) {
$this->footerlen[$i] = $this->footerlen[($i - 1)];
if (isset($this->footerlen[$j])) {
$this->footerlen[$i] = $this->footerlen[$j];
} elseif (isset($this->footerlen[$i])) {
unset($this->footerlen[$i]);
}
if (isset($this->transfmrk[($i - 1)])) {
$this->transfmrk[$i] = $this->transfmrk[($i - 1)];
if (isset($this->transfmrk[$j])) {
$this->transfmrk[$i] = $this->transfmrk[$j];
} elseif (isset($this->transfmrk[$i])) {
unset($this->transfmrk[$i]);
}
if (isset($this->PageAnnots[($i - 1)])) {
$this->PageAnnots[$i] = $this->PageAnnots[($i - 1)];
if (isset($this->PageAnnots[$j])) {
$this->PageAnnots[$i] = $this->PageAnnots[$j];
} elseif (isset($this->PageAnnots[$i])) {
unset($this->PageAnnots[$i]);
}
if (isset($this->newpagegroup[($i - 1)])) {
$this->newpagegroup[$i] = $this->newpagegroup[($i - 1)];
if (isset($this->newpagegroup[$j])) {
$this->newpagegroup[$i] = $this->newpagegroup[$j];
} elseif (isset($this->newpagegroup[$i])) {
unset($this->newpagegroup[$i]);
}
@ -13345,6 +13345,143 @@ if (!class_exists('TCPDF', false)) {
return true;
}
/**
* Remove the specified page.
* @param int $page page to remove
* @return true in case of success, false in case of error.
* @access public
* @since 4.6.004 (2009-04-23)
*/
public function deletePage($page) {
if ($page > $this->numpages) {
return false;
}
// delete current page
unset($this->pages[$page]);
unset($this->pagedim[$page]);
unset($this->pagelen[$page]);
unset($this->intmrk[$page]);
if (isset($this->footerpos[$page])) {
unset($this->footerpos[$page]);
}
if (isset($this->footerlen[$page])) {
unset($this->footerlen[$page]);
}
if (isset($this->transfmrk[$page])) {
unset($this->transfmrk[$page]);
}
if (isset($this->PageAnnots[$page])) {
unset($this->PageAnnots[$page]);
}
if (isset($this->newpagegroup[$page])) {
unset($this->newpagegroup[$page]);
}
if (isset($this->pageopen[$page])) {
unset($this->pageopen[$page]);
}
// update remaining pages
for ($i = $page; $i < $this->numpages; ++$i) {
$j = $i + 1;
// shift pages
$this->pages[$i] = $this->pages[$j];
$this->pagedim[$i] = $this->pagedim[$j];
$this->pagelen[$i] = $this->pagelen[$j];
$this->intmrk[$i] = $this->intmrk[$j];
if (isset($this->footerpos[$j])) {
$this->footerpos[$i] = $this->footerpos[$j];
} elseif (isset($this->footerpos[$i])) {
unset($this->footerpos[$i]);
}
if (isset($this->footerlen[$j])) {
$this->footerlen[$i] = $this->footerlen[$j];
} elseif (isset($this->footerlen[$i])) {
unset($this->footerlen[$i]);
}
if (isset($this->transfmrk[$j])) {
$this->transfmrk[$i] = $this->transfmrk[$j];
} elseif (isset($this->transfmrk[$i])) {
unset($this->transfmrk[$i]);
}
if (isset($this->PageAnnots[$j])) {
$this->PageAnnots[$i] = $this->PageAnnots[$j];
} elseif (isset($this->PageAnnots[$i])) {
unset($this->PageAnnots[$i]);
}
if (isset($this->newpagegroup[$j])) {
$this->newpagegroup[$i] = $this->newpagegroup[$j];
} elseif (isset($this->newpagegroup[$i])) {
unset($this->newpagegroup[$i]);
}
if (isset($this->pageopen[$j])) {
$this->pageopen[$i] = $this->pageopen[$j];
} elseif (isset($this->pageopen[$i])) {
unset($this->pageopen[$i]);
}
}
// remove last page
unset($this->pages[$this->numpages]);
unset($this->pagedim[$this->numpages]);
unset($this->pagelen[$this->numpages]);
unset($this->intmrk[$this->numpages]);
if (isset($this->footerpos[$this->numpages])) {
unset($this->footerpos[$this->numpages]);
}
if (isset($this->footerlen[$this->numpages])) {
unset($this->footerlen[$this->numpages]);
}
if (isset($this->transfmrk[$this->numpages])) {
unset($this->transfmrk[$this->numpages]);
}
if (isset($this->PageAnnots[$this->numpages])) {
unset($this->PageAnnots[$this->numpages]);
}
if (isset($this->newpagegroup[$this->numpages])) {
unset($this->newpagegroup[$this->numpages]);
}
if (isset($this->pageopen[$this->numpages])) {
unset($this->pageopen[$this->numpages]);
}
--$this->numpages;
$this->page = $this->numpages;
// adjust outlines
$tmpoutlines = $this->outlines;
foreach ($tmpoutlines as $key => $outline) {
if ($outline['p'] > $page) {
$this->outlines[$key]['p'] = $outline['p'] - 1;
} elseif ($outline['p'] == $page) {
unset($this->outlines[$key]);
}
}
// adjust links
$tmplinks = $this->links;
foreach ($tmplinks as $key => $link) {
if ($link[0] > $page) {
$this->links[$key][0] = $link[0] - 1;
} elseif ($link[0] == $page) {
unset($this->links[$key]);
}
}
// adjust javascript
$tmpjavascript = $this->javascript;
global $jpage;
$jpage = $page;
$this->javascript = preg_replace_callback('/this\.addField\(\'([^\']*)\',\'([^\']*)\',([0-9]+)/',
create_function('$matches', 'global $jpage;
$pagenum = intval($matches[3]) + 1;
if ($pagenum >= $jpage) {
$newpage = ($pagenum - 1);
} elseif ($pagenum == $jpage) {
$newpage = 1;
} else {
$newpage = $pagenum;
}
--$newpage;
return "this.addField(\'".$matches[1]."\',\'".$matches[2]."\',".$newpage."";'), $tmpjavascript);
// return to last page
$this->lastPage(true);
return true;
}
/**
* Output a Table of Content Index (TOC).
* You can override this method to achieve different styles.