From b52780fe62a3f2e9958c797d2c3ce00b6256f841 Mon Sep 17 00:00:00 2001 From: nicolaasuni Date: Fri, 15 Apr 2011 11:24:02 +0200 Subject: [PATCH] 5.9.068 --- CHANGELOG.TXT | 4 ++ README.TXT | 4 +- config/tcpdf_config.php | 8 +-- config/tcpdf_config_alt.php | 8 +-- examples/example_015.php | 20 +++---- examples/example_045.php | 18 +++--- examples/example_059.php | 19 ++++--- tcpdf.php | 108 ++++++++++++++++++++++++------------ 8 files changed, 117 insertions(+), 72 deletions(-) diff --git a/CHANGELOG.TXT b/CHANGELOG.TXT index e04c40f..d43a3aa 100755 --- a/CHANGELOG.TXT +++ b/CHANGELOG.TXT @@ -1,3 +1,7 @@ +5.9.068 (2011-04-15) + - Bookmark, addTOC and addHTMLTOC methods were improved to include font style and color (Examples 15, 49 and 59 were updated). + - Default $_SERVER['DOCUMENT_ROOT'] value on tcpdf_config.php file was changed. + 5.9.067 (2011-04-10) - Performances were drastically improved (PDF documents are now created more quickly). diff --git a/README.TXT b/README.TXT index b1c19e9..f1afe2e 100755 --- a/README.TXT +++ b/README.TXT @@ -8,8 +8,8 @@ http://sourceforge.net/donate/index.php?group_id=128076 ------------------------------------------------------------ Name: TCPDF -Version: 5.9.067 -Release date: 2011-04-10 +Version: 5.9.068 +Release date: 2011-04-15 Author: Nicola Asuni Copyright (c) 2002-2011: diff --git a/config/tcpdf_config.php b/config/tcpdf_config.php index bb9a1a8..811145f 100755 --- a/config/tcpdf_config.php +++ b/config/tcpdf_config.php @@ -2,7 +2,7 @@ //============================================================+ // File name : tcpdf_config.php // Begin : 2004-06-11 -// Last Update : 2010-12-16 +// Last Update : 2011-04-15 // // Description : Configuration file for TCPDF. // @@ -36,9 +36,9 @@ if (!defined('K_TCPDF_EXTERNAL_CONFIG')) { $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); } elseif(isset($_SERVER['PATH_TRANSLATED'])) { $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))); - } else { - // define here your DOCUMENT_ROOT path if the previous fails - $_SERVER['DOCUMENT_ROOT'] = '/var/www'; + } else { + // define here your DOCUMENT_ROOT path if the previous fails (e.g. '/var/www') + $_SERVER['DOCUMENT_ROOT'] = '/'; } } diff --git a/config/tcpdf_config_alt.php b/config/tcpdf_config_alt.php index 73394a9..2ef54df 100755 --- a/config/tcpdf_config_alt.php +++ b/config/tcpdf_config_alt.php @@ -2,7 +2,7 @@ //============================================================+ // File name : tcpdf_config.php // Begin : 2004-06-11 -// Last Update : 2010-12-16 +// Last Update : 2011-04-15 // // Description : Alternative configuration file for TCPDF. // @@ -32,9 +32,9 @@ if ((!isset($_SERVER['DOCUMENT_ROOT'])) OR (empty($_SERVER['DOCUMENT_ROOT']))) { $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr($_SERVER['SCRIPT_FILENAME'], 0, 0-strlen($_SERVER['PHP_SELF']))); } elseif(isset($_SERVER['PATH_TRANSLATED'])) { $_SERVER['DOCUMENT_ROOT'] = str_replace( '\\', '/', substr(str_replace('\\\\', '\\', $_SERVER['PATH_TRANSLATED']), 0, 0-strlen($_SERVER['PHP_SELF']))); - } else { - // define here your DOCUMENT_ROOT path if the previous fails - $_SERVER['DOCUMENT_ROOT'] = '/var/www'; + } else { + // define here your DOCUMENT_ROOT path if the previous fails (e.g. '/var/www') + $_SERVER['DOCUMENT_ROOT'] = '/'; } } diff --git a/examples/example_015.php b/examples/example_015.php index 1c8ee4b..58c9424 100755 --- a/examples/example_015.php +++ b/examples/example_015.php @@ -2,7 +2,7 @@ //============================================================+ // File name : example_015.php // Begin : 2008-03-04 -// Last Update : 2010-08-08 +// Last Update : 2011-04-15 // // Description : Example 015 for TCPDF class // Bookmarks (Table of Content) @@ -66,7 +66,7 @@ $pdf->setLanguageArray($l); // --------------------------------------------------------- -// Bookmark($txt, $level=0, $y=-1, $page='') +// Bookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0,0,0)) // set font $pdf->SetFont('times', 'B', 20); @@ -75,7 +75,7 @@ $pdf->SetFont('times', 'B', 20); $pdf->AddPage(); // set a bookmark for the current position -$pdf->Bookmark('Chapter 1', 0, 0); +$pdf->Bookmark('Chapter 1', 0, 0, '', 'B', array(0,64,128)); // print a line using Cell() $pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L'); @@ -88,27 +88,27 @@ $pdf->SetFont('times', 'B', 20); // add other pages and bookmarks $pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.1', 1, 0); +$pdf->Bookmark('Paragraph 1.1', 1, 0, '', '', array(0,0,0)); $pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L'); $pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.2', 1, 0); +$pdf->Bookmark('Paragraph 1.2', 1, 0, '', '', array(0,0,0)); $pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L'); $pdf->AddPage(); -$pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0); +$pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0, '', 'I', array(0,0,0)); $pdf->Cell(0, 10, 'Sub-Paragraph 1.2.1', 0, 1, 'L'); $pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.3', 1, 0); +$pdf->Bookmark('Paragraph 1.3', 1, 0, '', '', array(0,0,0)); $pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L'); $pdf->AddPage(); -$pdf->Bookmark('Chapter 2', 0, 0); +$pdf->Bookmark('Chapter 2', 0, 0, '', 'BI', array(128,0,0)); $pdf->Cell(0, 10, 'Chapter 2', 0, 1, 'L'); $pdf->AddPage(); -$pdf->Bookmark('Chapter 3', 0, 0); +$pdf->Bookmark('Chapter 3', 0, 0, '', 'B', array(0,64,128)); $pdf->Cell(0, 10, 'Chapter 3', 0, 1, 'L'); // --------------------------------------------------------- @@ -117,5 +117,5 @@ $pdf->Cell(0, 10, 'Chapter 3', 0, 1, 'L'); $pdf->Output('example_015.pdf', 'I'); //============================================================+ -// END OF FILE +// END OF FILE //============================================================+ diff --git a/examples/example_045.php b/examples/example_045.php index 357a134..d2b260a 100755 --- a/examples/example_045.php +++ b/examples/example_045.php @@ -2,7 +2,7 @@ //============================================================+ // File name : example_045.php // Begin : 2008-03-04 -// Last Update : 2010-08-08 +// Last Update : 2011-04-15 // // Description : Example 045 for TCPDF class // Bookmarks and Table of Content @@ -73,31 +73,31 @@ $pdf->SetFont('times', 'B', 20); $pdf->AddPage(); // set a bookmark for the current position -$pdf->Bookmark('Chapter 1', 0, 0); +$pdf->Bookmark('Chapter 1', 0, 0, '', 'B', array(0,64,128)); // print a line using Cell() $pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L'); $pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.1', 1, 0); +$pdf->Bookmark('Paragraph 1.1', 1, 0, '', '', array(128,0,0)); $pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L'); $pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.2', 1, 0); +$pdf->Bookmark('Paragraph 1.2', 1, 0, '', '', array(128,0,0)); $pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L'); $pdf->AddPage(); -$pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0); +$pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0, '', 'I', array(0,128,0)); $pdf->Cell(0, 10, 'Sub-Paragraph 1.2.1', 0, 1, 'L'); $pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.3', 1, 0); +$pdf->Bookmark('Paragraph 1.3', 1, 0, '', '', array(128,0,0)); $pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L'); // add some pages and bookmarks for ($i = 2; $i < 12; $i++) { $pdf->AddPage(); - $pdf->Bookmark('Chapter '.$i, 0, 0); + $pdf->Bookmark('Chapter '.$i, 0, 0, '', 'B', array(0,64,128)); $pdf->Cell(0, 10, 'Chapter '.$i, 0, 1, 'L'); } @@ -115,7 +115,7 @@ $pdf->SetFont('dejavusans', '', 12); // add a simple Table Of Content at first page // (check the example n. 59 for the HTML version) -$pdf->addTOC(1, 'courier', '.', 'INDEX'); +$pdf->addTOC(1, 'courier', '.', 'INDEX', 'B', array(128,0,0)); // end of TOC page $pdf->endTOCPage(); @@ -126,5 +126,5 @@ $pdf->endTOCPage(); $pdf->Output('example_045.pdf', 'I'); //============================================================+ -// END OF FILE +// END OF FILE //============================================================+ diff --git a/examples/example_059.php b/examples/example_059.php index 0b07dee..3553504 100644 --- a/examples/example_059.php +++ b/examples/example_059.php @@ -2,7 +2,7 @@ //============================================================+ // File name : example_059.php // Begin : 2010-05-06 -// Last Update : 2010-09-13 +// Last Update : 2011-04-15 // // Description : Example 059 for TCPDF class // Table Of Content using HTML templates. @@ -110,30 +110,31 @@ $pdf->SetFont('helvetica', '', 10); $pdf->AddPage(); // set a bookmark for the current position -$pdf->Bookmark('Chapter 1', 0, 0); +$pdf->Bookmark('Chapter 1', 0, 0, '', 'B', array(0,64,128)); // print a line using Cell() $pdf->Cell(0, 10, 'Chapter 1', 0, 1, 'L'); $pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.1', 1, 0); +$pdf->Bookmark('Paragraph 1.1', 1, 0, '', '', array(128,0,0)); $pdf->Cell(0, 10, 'Paragraph 1.1', 0, 1, 'L'); $pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.2', 1, 0); +$pdf->Bookmark('Paragraph 1.2', 1, 0, '', '', array(128,0,0)); $pdf->Cell(0, 10, 'Paragraph 1.2', 0, 1, 'L'); $pdf->AddPage(); -$pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0); +$pdf->Bookmark('Sub-Paragraph 1.2.1', 2, 0, '', 'I', array(0,128,0)); $pdf->Cell(0, 10, 'Sub-Paragraph 1.2.1', 0, 1, 'L'); $pdf->AddPage(); -$pdf->Bookmark('Paragraph 1.3', 1, 0); +$pdf->Bookmark('Paragraph 1.3', 1, 0, '', '', array(128,0,0)); $pdf->Cell(0, 10, 'Paragraph 1.3', 0, 1, 'L'); -for ($i = 2; $i < 12; ++$i) { +// add some pages and bookmarks +for ($i = 2; $i < 12; $i++) { $pdf->AddPage(); - $pdf->Bookmark('Chapter '.$i, 0, 0); + $pdf->Bookmark('Chapter '.$i, 0, 0, '', 'B', array(0,64,128)); $pdf->Cell(0, 10, 'Chapter '.$i, 0, 1, 'L'); } @@ -172,7 +173,7 @@ $bookmark_templates[2] = ' // add table of content at page 1 // (check the example n. 45 for a text-only TOC -$pdf->addHTMLTOC($page=1, $toc_name='INDEX', $bookmark_templates, $correct_align=true); +$pdf->addHTMLTOC(1, 'INDEX', $bookmark_templates, true, 'B', array(128,0,0)); // end of TOC page $pdf->endTOCPage(); diff --git a/tcpdf.php b/tcpdf.php index 18b8c51..d9d7642 100755 --- a/tcpdf.php +++ b/tcpdf.php @@ -1,9 +1,9 @@ * @package com.tecnick.tcpdf * @author Nicola Asuni - * @version 5.9.067 + * @version 5.9.068 */ // Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file. @@ -146,7 +146,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.
* @package com.tecnick.tcpdf * @brief PHP class for generating PDF documents without requiring external extensions. - * @version 5.9.067 + * @version 5.9.068 * @author Nicola Asuni - info@tecnick.com */ class TCPDF { @@ -157,7 +157,7 @@ class TCPDF { * Current TCPDF version. * @private */ - private $tcpdf_version = '5.9.067'; + private $tcpdf_version = '5.9.068'; // Protected properties @@ -4819,24 +4819,29 @@ class TCPDF { $fontdir .= '/'; } } + $missing_style = false; // true when the font style variation is missing // search and include font file if ($this->empty_string($fontfile) OR (!file_exists($fontfile))) { // build a standard filenames for specified font - $fontfile1 = str_replace(' ', '', $family).strtolower($style).'.php'; - $fontfile2 = str_replace(' ', '', $family).'.php'; + $tmp_fontfile = str_replace(' ', '', $family).strtolower($style).'.php'; // search files on various directories - if (($fontdir !== false) AND file_exists($fontdir.$fontfile1)) { - $fontfile = $fontdir.$fontfile1; - } elseif (file_exists($this->_getfontpath().$fontfile1)) { - $fontfile = $this->_getfontpath().$fontfile1; - } elseif (file_exists($fontfile1)) { - $fontfile = $fontfile1; - } elseif (($fontdir !== false) AND file_exists($fontdir.$fontfile2)) { - $fontfile = $fontdir.$fontfile2; - } elseif (file_exists($this->_getfontpath().$fontfile2)) { - $fontfile = $this->_getfontpath().$fontfile2; - } else { - $fontfile = $fontfile2; + if (($fontdir !== false) AND file_exists($fontdir.$tmp_fontfile)) { + $fontfile = $fontdir.$tmp_fontfile; + } elseif (file_exists($this->_getfontpath().$tmp_fontfile)) { + $fontfile = $this->_getfontpath().$tmp_fontfile; + } elseif (file_exists($tmp_fontfile)) { + $fontfile = $tmp_fontfile; + } elseif (!$this->empty_string($style)) { + $missing_style = true; + // try to remove the style part + $tmp_fontfile = str_replace(' ', '', $family).'.php'; + if (($fontdir !== false) AND file_exists($fontdir.$tmp_fontfile)) { + $fontfile = $fontdir.$tmp_fontfile; + } elseif (file_exists($this->_getfontpath().$tmp_fontfile)) { + $fontfile = $this->_getfontpath().$tmp_fontfile; + } else { + $fontfile = $tmp_fontfile; + } } } // include font file @@ -4857,7 +4862,7 @@ class TCPDF { $enc = ''; } if (!isset($cidinfo) OR $this->empty_string($cidinfo)) { - $cidinfo = array('Registry'=>'Adobe','Ordering'=>'Identity','Supplement'=>0); + $cidinfo = array('Registry'=>'Adobe', 'Ordering'=>'Identity', 'Supplement'=>0); $cidinfo['uni2cid'] = array(); } if (!isset($ctg) OR $this->empty_string($ctg)) { @@ -4886,10 +4891,11 @@ class TCPDF { } } ++$this->numfonts; - if ($type == 'cidfont0') { - // register CID font (all styles at once) + // create artificial font style variations if missing (only works with non-embedded fonts) + if ($missing_style) { + // style variations $styles = array('' => '', 'B' => ',Bold', 'I' => ',Italic', 'BI' => ',BoldItalic'); - $sname = $name.$styles[$bistyle]; + $name .= $styles[$bistyle]; // artificial bold if (strpos($bistyle, 'B') !== false) { if (isset($desc['StemV'])) { @@ -4905,15 +4911,21 @@ class TCPDF { } else { $desc['ItalicAngle'] = -11; } + if (isset($desc['Flags'])) { + $desc['Flags'] |= 128; //bit 7 + } else { + $desc['Flags'] = 128; + } } - } elseif ($type == 'core') { + } + if ($type == 'core') { $name = $this->CoreFonts[$fontkey]; $subset = false; } elseif (($type == 'TrueType') OR ($type == 'Type1')) { $subset = false; } elseif ($type == 'TrueTypeUnicode') { $enc = 'Identity-H'; - } else { + } elseif ($type != 'cidfont0') { $this->Error('Unknow font type: '.$type.''); } // initialize subsetchars to contain default ASCII values (0-255) @@ -14302,11 +14314,13 @@ class TCPDF { * @param $level (int) bookmark level (minimum value is 0). * @param $y (float) Y position in user units of the bookmark on the selected page (default = -1 = current position; 0 = page start;). * @param $page (int) target page number (leave empty for current page). + * @param $style (string) Font style: B = Bold, I = Italic, BI = Bold + Italic. + * @param $color (array) RGB color array (values from 0 to 255). * @public * @author Olivier Plathey, Nicola Asuni * @since 2.1.002 (2008-02-12) */ - public function Bookmark($txt, $level=0, $y=-1, $page='') { + public function Bookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0,0,0)) { if ($level < 0) { $level = 0; } @@ -14328,7 +14342,7 @@ class TCPDF { return; } } - $this->outlines[] = array('t' => $txt, 'l' => $level, 'y' => $y, 'p' => $page); + $this->outlines[] = array('t' => $txt, 'l' => $level, 'y' => $y, 'p' => $page, 's' => strtoupper($style), 'c' => $color); } /** @@ -14402,7 +14416,29 @@ class TCPDF { $out .= ' /Last '.($n + $o['last']).' 0 R'; } $out .= ' '.sprintf('/Dest [%u 0 R /XYZ 0 %.2F null]', $this->page_obj_id[($o['p'])], ($this->pagedim[$o['p']]['h'] - ($o['y'] * $this->k))); - $out .= ' /Count 0 >>'; + // set font style + $style = 0; + if (!empty($o['s'])) { + // bold + if (strpos($o['s'], 'B') !== false) { + $style |= 2; + } + // oblique + if (strpos($o['s'], 'I') !== false) { + $style |= 1; + } + } + $out .= sprintf(' /F %d', $style); + // set bookmark color + if (isset($o['c']) AND is_array($o['c']) AND (count($o['c']) == 3)) { + $color = array_values($o['c']); + $out .= sprintf(' /C [%.3F %.3F %.3F]', ($color[0] / 255), ($color[1] / 255), ($color[2] / 255)); + } else { + // black + $out .= ' /C [0.0 0.0 0.0]'; + } + $out .= ' /Count 0'; // normally closed item + $out .= ' >>'; $out .= "\n".'endobj'; $this->_out($out); } @@ -20865,7 +20901,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: case 'img': { if (isset($tag['attribute']['src'])) { // replace relative path with real server path - if (($tag['attribute']['src'][0] == '/') AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { + if (($tag['attribute']['src'][0] == '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { $findroot = strpos($tag['attribute']['src'], $_SERVER['DOCUMENT_ROOT']); if (($findroot === false) OR ($findroot > 1)) { $tag['attribute']['src'] = $_SERVER['DOCUMENT_ROOT'].$tag['attribute']['src']; @@ -23326,7 +23362,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $tmpoutlines = $this->outlines; foreach ($tmpoutlines as $key => $outline) { if ($outline['p'] == $page) { - $this->outlines[] = array('t' => $outline['t'], 'l' => $outline['l'], 'y' => $outline['y'], 'p' => $this->page); + $this->outlines[] = array('t' => $outline['t'], 'l' => $outline['l'], 'y' => $outline['y'], 'p' => $this->page, 's' => $outline['s'], 'c' => $outline['c']); } } // copy links @@ -23350,12 +23386,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @param $numbersfont (string) set the font for page numbers (please use monospaced font for better alignment). * @param $filler (string) string used to fill the space between text and page number. * @param $toc_name (string) name to use for TOC bookmark. + * @param $style (string) Font style for title: B = Bold, I = Italic, BI = Bold + Italic. + * @param $color (array) RGB color array for title (values from 0 to 255). * @public * @author Nicola Asuni * @since 4.5.000 (2009-01-02) * @see addTOCPage(), endTOCPage(), addHTMLTOC() */ - public function addTOC($page='', $numbersfont='', $filler='.', $toc_name='TOC') { + public function addTOC($page='', $numbersfont='', $filler='.', $toc_name='TOC', $style='', $color=array(0,0,0)) { $fontsize = $this->FontSizePt; $fontfamily = $this->FontFamily; $fontstyle = $this->FontStyle; @@ -23508,7 +23546,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->setPageBuffer($p, $temppage); } // move pages - $this->Bookmark($toc_name, 0, 0, $page_first); + $this->Bookmark($toc_name, 0, 0, $page_first, $style, $color); for ($i = 0; $i < $numpages; ++$i) { $this->movePage($page_last, $page); } @@ -23523,12 +23561,14 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: * @param $toc_name (string) name to use for TOC bookmark. * @param $templates (array) array of html templates. Use: "#TOC_DESCRIPTION#" for bookmark title, "#TOC_PAGE_NUMBER#" for page number. * @param $correct_align (boolean) if true correct the number alignment (numbers must be in monospaced font like courier and right aligned on LTR, or left aligned on RTL) + * @param $style (string) Font style for title: B = Bold, I = Italic, BI = Bold + Italic. + * @param $color (array) RGB color array for title (values from 0 to 255). * @public * @author Nicola Asuni * @since 5.0.001 (2010-05-06) * @see addTOCPage(), endTOCPage(), addTOC() */ - public function addHTMLTOC($page='', $toc_name='TOC', $templates=array(), $correct_align=true) { + public function addHTMLTOC($page='', $toc_name='TOC', $templates=array(), $correct_align=true, $style='', $color=array(0,0,0)) { $prev_htmlLinkColorArray = $this->htmlLinkColorArray; $prev_htmlLinkFontStyle = $this->htmlLinkFontStyle; // set new style for link @@ -23623,7 +23663,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $this->setPageBuffer($p, $temppage); } // move pages - $this->Bookmark($toc_name, 0, 0, $page_first); + $this->Bookmark($toc_name, 0, 0, $page_first, $style, $color); for ($i = 0; $i < $numpages; ++$i) { $this->movePage($page_last, $page); }