/include/tcpdf/tcpdf.php
PHP | 13689 lines | 8693 code | 529 blank | 4467 comment | 2017 complexity | 5910187df5ca596767e5a384279c3f0b MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, LGPL-2.1, BSD-3-Clause, AGPL-3.0
Large files files are truncated, but you can click here to view the full file
- <?php
- /*
- Modification information for LGPL compliance
- Mon May 30 16:16:13 2011 +0300 - alex-vlasov - Bug 41216 - currency is displayed on 2 lines instead of one when printing a quote to PDF
- r57813 - 2010-08-19 10:34:44 -0700 (Thu, 19 Aug 2010) - kjing - Author: John Mertic <jmertic@sugarcrm.com>
- Bug 39085 - When loading the opposite search panel via ajax on the ListViews, call the index action instead of the ListView action to avoid touching pre-MVC code by accident.
- r56990 - 2010-06-16 13:05:36 -0700 (Wed, 16 Jun 2010) - kjing - snapshot "Mango" svn branch to a new one for GitHub sync
- r56989 - 2010-06-16 13:01:33 -0700 (Wed, 16 Jun 2010) - kjing - defunt "Mango" svn dev branch before github cutover
- r55980 - 2010-04-19 13:31:28 -0700 (Mon, 19 Apr 2010) - kjing - create Mango (6.1) based on windex
- r53409 - 2010-01-03 19:31:15 -0800 (Sun, 03 Jan 2010) - roger - merge -r50376:HEAD from fuji_newtag_tmp
- r51719 - 2009-10-22 10:18:00 -0700 (Thu, 22 Oct 2009) - mitani - Converted to Build 3 tags and updated the build system
- r51634 - 2009-10-19 13:32:22 -0700 (Mon, 19 Oct 2009) - mitani - Windex is the branch for Sugar Sales 1.0 development
- r51443 - 2009-10-12 13:34:36 -0700 (Mon, 12 Oct 2009) - jmertic - Bug 33332 - Made application PHP 5.3 compliant with E_DEPRECATED warnings on by:
- - Changing all ereg function to either preg or simple string based ones
- - No more references to magic quotes.
- - Change all the session_unregister() functions to just unset() the correct session variable instead.
- r50375 - 2009-08-24 18:07:43 -0700 (Mon, 24 Aug 2009) - dwong - branch kobe2 from tokyo r50372
- r47904 - 2009-06-02 11:54:10 -0700 (Tue, 02 Jun 2009) - jenny - Adding changes that were made to the earlier version of this file to support jpg images.
- r47900 - 2009-06-02 11:26:55 -0700 (Tue, 02 Jun 2009) - jenny - Updating with changes from bsoufflet.
- r46662 - 2009-04-29 10:48:07 -0700 (Wed, 29 Apr 2009) - jenny - Invoking native jpg image support which isnt' automatically there.
- r46617 - 2009-04-28 16:08:45 -0700 (Tue, 28 Apr 2009) - jenny - Fixing a bug in TCPDF that checks to see if the GD library is installed.
- r46451 - 2009-04-23 16:57:40 -0700 (Thu, 23 Apr 2009) - jenny - tcpdf initial checkin.
- */
- //============================================================+
- // File name : tcpdf.php
- // Begin : 2002-08-03
- // Last Update : 2009-05-28
- // Author : Nicola Asuni - info@tecnick.com - http://www.tcpdf.org
- // Version : 4.6.013
- // License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)
- // ----------------------------------------------------------------------------
- // Copyright (C) 2002-2009 Nicola Asuni - Tecnick.com S.r.l.
- //
- // This program is free software: you can redistribute it and/or modify
- // it under the terms of the GNU Lesser General Public License as published by
- // the Free Software Foundation, either version 2.1 of the License, or
- // (at your option) any later version.
- //
- // This program is distributed in the hope that it will be useful,
- // but WITHOUT ANY WARRANTY; without even the implied warranty of
- // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- // GNU Lesser General Public License for more details.
- //
- // You should have received a copy of the GNU Lesser General Public License
- // along with this program. If not, see <http://www.gnu.org/licenses/>.
- //
- // See LICENSE.TXT file for more information.
- // ----------------------------------------------------------------------------
- //
- // Description : This is a PHP class for generating PDF documents without
- // requiring external extensions.
- //
- // NOTE:
- // This class was originally derived in 2002 from the Public
- // Domain FPDF class by Olivier Plathey (http://www.fpdf.org),
- // but now is almost entirely rewritten.
- //
- // Main features:
- // * no external libraries are required for the basic functions;
- // * supports all ISO page formats;
- // * supports custom page formats, margins and units of measure;
- // * supports UTF-8 Unicode and Right-To-Left languages;
- // * supports TrueTypeUnicode, OpenTypeUnicode, TrueType, OpenType, Type1 and CID-0 fonts;
- // * supports document encryption;
- // * includes methods to publish some XHTML code;
- // * includes graphic (geometric) and transformation methods;
- // * 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 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;
- // * supports automatic line break and text justification;
- // * supports JPEG and PNG images natively, all images supported by GD (GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM) and all images supported via ImagMagick (http://www.imagemagick.org/www/formats.html)
- // * supports stroke and clipping mode for text;
- // * supports clipping masks;
- // * supports Grayscale, RGB, CMYK, Spot Colors and Transparencies;
- // * supports several annotations, including links, text and file attachments;
- // * supports page compression (requires zlib extension);
- // * supports text hyphenation.
- // * supports transactions to UNDO commands.
- //
- // -----------------------------------------------------------
- // THANKS TO:
- //
- // Olivier Plathey (http://www.fpdf.org) for original FPDF.
- // Efthimios Mavrogeorgiadis (emavro@yahoo.com) for suggestions on RTL language support.
- // Klemen Vodopivec (http://www.fpdf.de/downloads/addons/37/) for Encryption algorithm.
- // Warren Sherliker (wsherliker@gmail.com) for better image handling.
- // dullus for text Justification.
- // Bob Vincent (pillarsdotnet@users.sourceforge.net) for <li> value attribute.
- // Patrick Benny for text stretch suggestion on Cell().
- // Johannes G�ntert for JavaScript support.
- // Denis Van Nuffelen for Dynamic Form.
- // Jacek Czekaj for multibyte justification
- // Anthony Ferrara for the reintroduction of legacy image methods.
- // Sourceforge user 1707880 (hucste) for line-trough mode.
- // Larry Stanbery for page groups.
- // Martin Hall-May for transparency.
- // Aaron C. Spike for Polycurve method.
- // Mohamad Ali Golkar, Saleh AlMatrafe, Charles Abbott for Arabic and Persian support.
- // Moritz Wagner and Andreas Wurmser for graphic functions.
- // Andrew Whitehead for core fonts support.
- // Esteban Jo�l Mar�n for OpenType font conversion.
- // Teus Hagen for several suggestions and fixes.
- // Yukihiro Nakadaira for CID-0 CJK fonts fixes.
- // Kosmas Papachristos for some CSS improvements.
- // Marcel Partap for some fixes.
- // Won Kyu Park for several suggestions, fixes and patches.
- // Anyone that has reported a bug or sent a suggestion.
- //============================================================+
- /**
- * This is a PHP class for generating PDF documents without requiring external extensions.<br>
- * TCPDF project (http://www.tcpdf.org) was originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.<br>
- * <h3>TCPDF main features are:</h3>
- * <ul>
- * <li>no external libraries are required for the basic functions;</li>
- * <li>supports all ISO page formats;</li>
- * <li>supports custom page formats, margins and units of measure;</li>
- * <li>supports UTF-8 Unicode and Right-To-Left languages;</li>
- * <li>supports TrueTypeUnicode, OpenTypeUnicode, TrueType, OpenType, Type1 and CID-0 fonts;</li>
- * <li>supports document encryption;</li>
- * <li>includes methods to publish some XHTML code;</li>
- * <li>includes graphic (geometric) and transformation methods;</li>
- * <li>includes Javascript and forms support;</li>
- * <li>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;</li>
- * <li>includes methods to set Bookmarks and print a Table of Content;</li>
- * <li>includes methods to move and delete pages;</li>
- * <li>includes methods for automatic page header and footer management;</li>
- * <li>supports automatic page break;</li>
- * <li>supports automatic page numbering and page groups;</li>
- * <li>supports automatic line break and text justification;</li>
- * <li>supports JPEG and PNG images natively, all images supported by GD (GD, GD2, GD2PART, GIF, JPEG, PNG, BMP, XBM, XPM) and all images supported via ImagMagick (http://www.imagemagick.org/www/formats.html)</li>
- * <li>supports stroke and clipping mode for text;</li>
- * <li>supports clipping masks;</li>
- * <li>supports Grayscale, RGB, CMYK, Spot Colors and Transparencies;</li>
- * <li>supports several annotations, including links, text and file attachments;</li>
- * <li>supports page compression (requires zlib extension);</li>
- * <li>supports text hyphenation.</li>
- * <li>supports transactions to UNDO commands.</li>
- * </ul>
- * Tools to encode your unicode fonts are on fonts/utils directory.</p>
- * @package com.tecnick.tcpdf
- * @abstract Class for generating PDF files on-the-fly without requiring external extensions.
- * @author Nicola Asuni
- * @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.013
- */
- /**
- * main configuration file
- */
- require_once(dirname(__FILE__).'/config/tcpdf_config.php');
- // includes some support files
- /**
- * unicode data
- */
- require_once(dirname(__FILE__).'/unicode_data.php');
- /**
- * html colors table
- */
- require_once(dirname(__FILE__).'/htmlcolors.php');
- if (!class_exists('TCPDF', false)) {
- /**
- * define default PDF document producer
- */
- define('PDF_PRODUCER', 'TCPDF 4.6.013 (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.013
- * @author Nicola Asuni - info@tecnick.com
- * @link http://www.tcpdf.org
- * @license http://www.gnu.org/copyleft/lesser.html LGPL
- */
- class TCPDF {
-
- // protected or Protected properties
- /**
- * @var current page number
- * @access protected
- */
- protected $page;
-
- /**
- * @var current object number
- * @access protected
- */
- protected $n;
- /**
- * @var array of object offsets
- * @access protected
- */
- protected $offsets;
- /**
- * @var buffer holding in-memory PDF
- * @access protected
- */
- protected $buffer;
- /**
- * @var array containing pages
- * @access protected
- */
- protected $pages = array();
- /**
- * @var current document state
- * @access protected
- */
- protected $state;
- /**
- * @var compression flag
- * @access protected
- */
- protected $compress;
-
- /**
- * @var current page orientation (P = Portrait, L = Landscape)
- * @access protected
- */
- protected $CurOrientation;
- /**
- * @var array that stores page dimensions and graphic status.<ul><li>$this->pagedim[$this->page]['w'] => page_width_in_points</li><li>$this->pagedim[$this->page]['h'] => height in points</li><li>$this->pagedim[$this->page]['wk'] => page_width_in_points</li><li>$this->pagedim[$this->page]['hk'] => height</li><li>$this->pagedim[$this->page]['tm'] => top_margin</li><li>$this->pagedim[$this->page]['bm'] => bottom_margin</li><li>$this->pagedim[$this->page]['lm'] => left_margin</li><li>$this->pagedim[$this->page]['rm'] => right_margin</li><li>$this->pagedim[$this->page]['pb'] => auto_page_break</li><li>$this->pagedim[$this->page]['or'] => page_orientation</li><li>$this->pagedim[$this->page]['olm'] => original_left_margin</li><li>$this->pagedim[$this->page]['orm'] => original_right_margin</li></ul>
- * @access protected
- */
- protected $pagedim = array();
- /**
- * @var scale factor (number of points in user unit)
- * @access protected
- */
- protected $k;
- /**
- * @var width of page format in points
- * @access protected
- */
- protected $fwPt;
- /**
- * @var height of page format in points
- * @access protected
- */
- protected $fhPt;
- /**
- * @var current width of page in points
- * @access protected
- */
- protected $wPt;
- /**
- * @var current height of page in points
- * @access protected
- */
- protected $hPt;
- /**
- * @var current width of page in user unit
- * @access protected
- */
- protected $w;
- /**
- * @var current height of page in user unit
- * @access protected
- */
- protected $h;
- /**
- * @var left margin
- * @access protected
- */
- protected $lMargin;
- /**
- * @var top margin
- * @access protected
- */
- protected $tMargin;
- /**
- * @var right margin
- * @access protected
- */
- protected $rMargin;
- /**
- * @var page break margin
- * @access protected
- */
- protected $bMargin;
- /**
- * @var cell internal padding
- * @access protected
- */
- //protected
- public $cMargin;
-
- /**
- * @var cell internal padding (previous value)
- * @access protected
- */
- protected $oldcMargin;
- /**
- * @var current horizontal position in user unit for cell positioning
- * @access protected
- */
- protected $x;
- /**
- * @var current vertical position in user unit for cell positioning
- * @access protected
- */
- protected $y;
- /**
- * @var height of last cell printed
- * @access protected
- */
- protected $lasth;
- /**
- * @var line width in user unit
- * @access protected
- */
- protected $LineWidth;
- /**
- * @var array of standard font names
- * @access protected
- */
- protected $CoreFonts;
- /**
- * @var array of used fonts
- * @access protected
- */
- protected $fonts = array();
- /**
- * @var array of font files
- * @access protected
- */
- protected $FontFiles = array();
- /**
- * @var array of encoding differences
- * @access protected
- */
- protected $diffs = array();
- /**
- * @var array of used images
- * @access protected
- */
- protected $images = array();
- /**
- * @var array of Annotations in pages
- * @access protected
- */
- protected $PageAnnots = array();
- /**
- * @var array of internal links
- * @access protected
- */
- protected $links = array();
- /**
- * @var current font family
- * @access protected
- */
- protected $FontFamily;
- /**
- * @var current font style
- * @access protected
- */
- protected $FontStyle;
-
- /**
- * @var current font ascent (distance between font top and baseline)
- * @access protected
- * @since 2.8.000 (2007-03-29)
- */
- protected $FontAscent;
-
- /**
- * @var current font descent (distance between font bottom and baseline)
- * @access protected
- * @since 2.8.000 (2007-03-29)
- */
- protected $FontDescent;
- /**
- * @var underlining flag
- * @access protected
- */
- protected $underline;
- /**
- * @var current font info
- * @access protected
- */
- protected $CurrentFont;
- /**
- * @var current font size in points
- * @access protected
- */
- protected $FontSizePt;
- /**
- * @var current font size in user unit
- * @access protected
- */
- protected $FontSize;
- /**
- * @var commands for drawing color
- * @access protected
- */
- protected $DrawColor;
- /**
- * @var commands for filling color
- * @access protected
- */
- protected $FillColor;
- /**
- * @var commands for text color
- * @access protected
- */
- protected $TextColor;
- /**
- * @var indicates whether fill and text colors are different
- * @access protected
- */
- protected $ColorFlag;
- /**
- * @var automatic page breaking
- * @access protected
- */
- protected $AutoPageBreak;
- /**
- * @var threshold used to trigger page breaks
- * @access protected
- */
- protected $PageBreakTrigger;
- /**
- * @var flag set when processing footer
- * @access protected
- */
- protected $InFooter = false;
- /**
- * @var zoom display mode
- * @access protected
- */
- protected $ZoomMode;
- /**
- * @var layout display mode
- * @access protected
- */
- protected $LayoutMode;
- /**
- * @var title
- * @access protected
- */
- protected $title = '';
- /**
- * @var subject
- * @access protected
- */
- protected $subject = '';
- /**
- * @var author
- * @access protected
- */
- protected $author = '';
- /**
- * @var keywords
- * @access protected
- */
- protected $keywords = '';
- /**
- * @var creator
- * @access protected
- */
- protected $creator = '';
- /**
- * @var alias for total number of pages
- * @access protected
- */
- protected $AliasNbPages = '{nb}';
-
- /**
- * @var alias for page number
- * @access protected
- */
- protected $AliasNumPage = '{pnb}';
-
- /**
- * @var right-bottom corner X coordinate of inserted image
- * @since 2002-07-31
- * @author Nicola Asuni
- * @access protected
- */
- protected $img_rb_x;
- /**
- * @var right-bottom corner Y coordinate of inserted image
- * @since 2002-07-31
- * @author Nicola Asuni
- * @access protected
- */
- protected $img_rb_y;
- /**
- * @var adjusting factor to convert pixels to user units.
- * @since 2004-06-14
- * @author Nicola Asuni
- * @access protected
- */
- protected $imgscale = 1;
- /**
- * @var boolean set to true when the input text is unicode (require unicode fonts)
- * @since 2005-01-02
- * @author Nicola Asuni
- * @access protected
- */
- protected $isunicode = false;
- /**
- * @var PDF version
- * @since 1.5.3
- * @access protected
- */
- protected $PDFVersion = '1.7';
-
-
- // ----------------------
-
- /**
- * @var Minimum distance between header and top page margin.
- * @access protected
- */
- protected $header_margin;
-
- /**
- * @var Minimum distance between footer and bottom page margin.
- * @access protected
- */
- protected $footer_margin;
-
- /**
- * @var original left margin value
- * @access protected
- * @since 1.53.0.TC013
- */
- protected $original_lMargin;
-
- /**
- * @var original right margin value
- * @access protected
- * @since 1.53.0.TC013
- */
- protected $original_rMargin;
-
- /**
- * @var Header font.
- * @access protected
- */
- protected $header_font;
-
- /**
- * @var Footer font.
- * @access protected
- */
- protected $footer_font;
-
- /**
- * @var Language templates.
- * @access protected
- */
- protected $l;
-
- /**
- * @var Barcode to print on page footer (only if set).
- * @access protected
- */
- protected $barcode = false;
-
- /**
- * @var If true prints header
- * @access protected
- */
- protected $print_header = true;
-
- /**
- * @var If true prints footer.
- * @access protected
- */
- protected $print_footer = true;
-
- /**
- * @var Header image logo.
- * @access protected
- */
- protected $header_logo = '';
-
- /**
- * @var Header image logo width in mm.
- * @access protected
- */
- protected $header_logo_width = 30;
-
- /**
- * @var String to print as title on document header.
- * @access protected
- */
- protected $header_title = '';
-
- /**
- * @var String to print on document header.
- * @access protected
- */
- protected $header_string = '';
-
- /**
- * @var Default number of columns for html table.
- * @access protected
- */
- protected $default_table_columns = 4;
-
-
- // variables for html parser
-
- /**
- * @var HTML PARSER: array to store current link and rendering styles.
- * @access protected
- */
- protected $HREF = array();
-
- /**
- * @var store a list of available fonts on filesystem.
- * @access protected
- */
- protected $fontlist = array();
-
- /**
- * @var current foreground color
- * @access protected
- */
- protected $fgcolor;
-
- /**
- * @var HTML PARSER: array of boolean values, true in case of ordered list (OL), false otherwise.
- * @access protected
- */
- protected $listordered = array();
-
- /**
- * @var HTML PARSER: array count list items on nested lists.
- * @access protected
- */
- protected $listcount = array();
-
- /**
- * @var HTML PARSER: current list nesting level.
- * @access protected
- */
- protected $listnum = 0;
-
- /**
- * @var HTML PARSER: indent amount for lists.
- * @access protected
- */
- protected $listindent;
-
- /**
- * @var current background color
- * @access protected
- */
- protected $bgcolor;
-
- /**
- * @var Store temporary font size in points.
- * @access protected
- */
- protected $tempfontsize = 10;
-
- /**
- * @var spacer for LI tags.
- * @access protected
- */
- protected $lispacer = '';
-
- /**
- * @var default encoding
- * @access protected
- * @since 1.53.0.TC010
- */
- protected $encoding = 'UTF-8';
-
- /**
- * @var PHP internal encoding
- * @access protected
- * @since 1.53.0.TC016
- */
- protected $internal_encoding;
-
- /**
- * @var indicates if the document language is Right-To-Left
- * @access protected
- * @since 2.0.000
- */
- protected $rtl = false;
-
- /**
- * @var used to force RTL or LTR string inversion
- * @access protected
- * @since 2.0.000
- */
- protected $tmprtl = false;
-
- // --- Variables used for document encryption:
-
- /**
- * Indicates whether document is protected
- * @access protected
- * @since 2.0.000 (2008-01-02)
- */
- protected $encrypted;
-
- /**
- * U entry in pdf document
- * @access protected
- * @since 2.0.000 (2008-01-02)
- */
- protected $Uvalue;
-
- /**
- * O entry in pdf document
- * @access protected
- * @since 2.0.000 (2008-01-02)
- */
- protected $Ovalue;
-
- /**
- * P entry in pdf document
- * @access protected
- * @since 2.0.000 (2008-01-02)
- */
- protected $Pvalue;
-
- /**
- * encryption object id
- * @access protected
- * @since 2.0.000 (2008-01-02)
- */
- protected $enc_obj_id;
-
- /**
- * last RC4 key encrypted (cached for optimisation)
- * @access protected
- * @since 2.0.000 (2008-01-02)
- */
- protected $last_rc4_key;
-
- /**
- * last RC4 computed key
- * @access protected
- * @since 2.0.000 (2008-01-02)
- */
- protected $last_rc4_key_c;
-
- /**
- * RC4 padding
- * @access protected
- */
- protected $padding = "\x28\xBF\x4E\x5E\x4E\x75\x8A\x41\x64\x00\x4E\x56\xFF\xFA\x01\x08\x2E\x2E\x00\xB6\xD0\x68\x3E\x80\x2F\x0C\xA9\xFE\x64\x53\x69\x7A";
-
- /**
- * RC4 encryption key
- * @access protected
- */
- protected $encryption_key;
-
- // --- bookmark ---
-
- /**
- * Outlines for bookmark
- * @access protected
- * @since 2.1.002 (2008-02-12)
- */
- protected $outlines = array();
-
- /**
- * Outline root for bookmark
- * @access protected
- * @since 2.1.002 (2008-02-12)
- */
- protected $OutlineRoot;
-
-
- // --- javascript and form ---
-
- /**
- * javascript code
- * @access protected
- * @since 2.1.002 (2008-02-12)
- */
- protected $javascript = '';
-
- /**
- * javascript counter
- * @access protected
- * @since 2.1.002 (2008-02-12)
- */
- protected $n_js;
- /**
- * line trough state
- * @access protected
- * @since 2.8.000 (2008-03-19)
- */
- protected $linethrough;
- // --- Variables used for User's Rights ---
- // See PDF reference chapter 8.7 Digital Signatures
- /**
- * If true enables user's rights on PDF reader
- * @access protected
- * @since 2.9.000 (2008-03-26)
- */
- protected $ur;
- /**
- * Names specifying additional document-wide usage rights for the document.
- * @access protected
- * @since 2.9.000 (2008-03-26)
- */
- protected $ur_document;
- /**
- * Names specifying additional annotation-related usage rights for the document.
- * @access protected
- * @since 2.9.000 (2008-03-26)
- */
- protected $ur_annots;
- /**
- * Names specifying additional form-field-related usage rights for the document.
- * @access protected
- * @since 2.9.000 (2008-03-26)
- */
- protected $ur_form;
- /**
- * Names specifying additional signature-related usage rights for the document.
- * @access protected
- * @since 2.9.000 (2008-03-26)
- */
- protected $ur_signature;
- /**
- * Dot Per Inch Document Resolution (do not change)
- * @access protected
- * @since 3.0.000 (2008-03-27)
- */
- protected $dpi = 72;
-
- /**
- * Array of page numbers were a new page group was started
- * @access protected
- * @since 3.0.000 (2008-03-27)
- */
- protected $newpagegroup = array();
-
- /**
- * Contains the number of pages of the groups
- * @access protected
- * @since 3.0.000 (2008-03-27)
- */
- protected $pagegroups;
-
- /**
- * Contains the alias of the current page group
- * @access protected
- * @since 3.0.000 (2008-03-27)
- */
- protected $currpagegroup;
-
- /**
- * Restrict the rendering of some elements to screen or printout.
- * @access protected
- * @since 3.0.000 (2008-03-27)
- */
- protected $visibility = 'all';
-
- /**
- * Print visibility.
- * @access protected
- * @since 3.0.000 (2008-03-27)
- */
- protected $n_ocg_print;
-
- /**
- * View visibility.
- * @access protected
- * @since 3.0.000 (2008-03-27)
- */
- protected $n_ocg_view;
-
- /**
- * Array of transparency objects and parameters.
- * @access protected
- * @since 3.0.000 (2008-03-27)
- */
- protected $extgstates;
-
- /**
- * Set the default JPEG compression quality (1-100)
- * @access protected
- * @since 3.0.000 (2008-03-27)
- */
- protected $jpeg_quality;
-
- /**
- * Default cell height ratio.
- * @access protected
- * @since 3.0.014 (2008-05-23)
- */
- protected $cell_height_ratio = K_CELL_HEIGHT_RATIO;
-
- /**
- * PDF viewer preferences.
- * @access protected
- * @since 3.1.000 (2008-06-09)
- */
- protected $viewer_preferences;
-
- /**
- * A name object specifying how the document should be displayed when opened.
- * @access protected
- * @since 3.1.000 (2008-06-09)
- */
- protected $PageMode;
-
- /**
- * Array for storing gradient information.
- * @access protected
- * @since 3.1.000 (2008-06-09)
- */
- protected $gradients = array();
-
- /**
- * Array used to store positions inside the pages buffer.
- * keys are the page numbers
- * @access protected
- * @since 3.2.000 (2008-06-26)
- */
- protected $intmrk = array();
-
- /**
- * Array used to store footer positions of each page.
- * @access protected
- * @since 3.2.000 (2008-07-01)
- */
- protected $footerpos = array();
-
-
- /**
- * Array used to store footer lenght of each page.
- * @access protected
- * @since 4.0.014 (2008-07-29)
- */
- protected $footerlen = array();
-
- /**
- * True if a newline is created.
- * @access protected
- * @since 3.2.000 (2008-07-01)
- */
- protected $newline = true;
-
- /**
- * End position of the latest inserted line
- * @access protected
- * @since 3.2.000 (2008-07-01)
- */
- protected $endlinex = 0;
-
- /**
- * PDF string for last line width
- * @access protected
- * @since 4.0.006 (2008-07-16)
- */
- protected $linestyleWidth = '';
-
- /**
- * PDF string for last line width
- * @access protected
- * @since 4.0.006 (2008-07-16)
- */
- protected $linestyleCap = '0 J';
-
- /**
- * PDF string for last line width
- * @access protected
- * @since 4.0.006 (2008-07-16)
- */
- protected $linestyleJoin = '0 j';
-
- /**
- * PDF string for last line width
- * @access protected
- * @since 4.0.006 (2008-07-16)
- */
- protected $linestyleDash = '[] 0 d';
-
- /**
- * True if marked-content sequence is open
- * @access protected
- * @since 4.0.013 (2008-07-28)
- */
- protected $openMarkedContent = false;
-
- /**
- * Count the latest inserted vertical spaces on HTML
- * @access protected
- * @since 4.0.021 (2008-08-24)
- */
- protected $htmlvspace = 0;
-
- /**
- * Array of Spot colors
- * @access protected
- * @since 4.0.024 (2008-09-12)
- */
- protected $spot_colors = array();
-
- /**
- * Symbol used for HTML unordered list items
- * @access protected
- * @since 4.0.028 (2008-09-26)
- */
- protected $lisymbol = '';
-
- /**
- * String used to mark the beginning and end of EPS image blocks
- * @access protected
- * @since 4.1.000 (2008-10-18)
- */
- protected $epsmarker = 'x#!#EPS#!#x';
-
- /**
- * Array of transformation matrix
- * @access protected
- * @since 4.2.000 (2008-10-29)
- */
- protected $transfmatrix = array();
-
- /**
- * Booklet mode for double-sided pages
- * @access protected
- * @since 4.2.000 (2008-10-29)
- */
- protected $booklet = false;
-
- /**
- * Epsilon value used for float calculations
- * @access protected
- * @since 4.2.000 (2008-10-29)
- */
- protected $feps = 0.001;
-
- /**
- * Array used for custom vertical spaces for HTML tags
- * @access protected
- * @since 4.2.001 (2008-10-30)
- */
- protected $tagvspaces = array();
-
- /**
- * @var HTML PARSER: custom indent amount for lists.
- * Negative value means disabled.
- * @access protected
- * @since 4.2.007 (2008-11-12)
- */
- protected $customlistindent = -1;
-
- /**
- * @var if true keeps the border open for the cell sides that cross the page.
- * @access protected
- * @since 4.2.010 (2008-11-14)
- */
- protected $opencell = true;
- /**
- * @var array of files to embedd
- * @access protected
- * @since 4.4.000 (2008-12-07)
- */
- protected $embeddedfiles = array();
- /**
- * @var boolean true when inside html pre tag
- * @access protected
- * @since 4.4.001 (2008-12-08)
- */
- protected $premode = false;
- /**
- * Array used to store positions of graphics transformation blocks inside the page buffer.
- * keys are the page numbers
- * @access protected
- * @since 4.4.002 (2008-12-09)
- */
- protected $transfmrk = array();
- /**
- * Default color for html links
- * @access protected
- * @since 4.4.003 (2008-12-09)
- */
- protected $htmlLinkColorArray = array(0, 0, 255);
- /**
- * Default font style to add to html links
- * @access protected
- * @since 4.4.003 (2008-12-09)
- */
- protected $htmlLinkFontStyle = 'U';
- /**
- * Counts the number of pages.
- * @access protected
- * @since 4.5.000 (2008-12-31)
- */
- protected $numpages = 0;
- /**
- * Array containing page lenghts in bytes.
- * @access protected
- * @since 4.5.000 (2008-12-31)
- */
- protected $pagelen = array();
- /**
- * Counts the number of pages.
- * @access protected
- * @since 4.5.000 (2008-12-31)
- */
- protected $numimages = 0;
- /**
- * Store the image keys.
- * @access protected
- * @since 4.5.000 (2008-12-31)
- */
- protected $imagekeys = array();
- /**
- * Lenght of the buffer in bytes.
- * @access protected
- * @since 4.5.000 (2008-12-31)
- */
- protected $bufferlen = 0;
- /**
- * If true enables disk caching.
- * @access protected
- * @since 4.5.000 (2008-12-31)
- */
- protected $diskcache = false;
- /**
- * Counts the number of fonts.
- * @access protected
- * @since 4.5.000 (2009-01-02)
- */
- protected $numfonts = 0;
- /**
- * Store the font keys.
- * @access protected
- * @since 4.5.000 (2009-01-02)
- */
- protected $fontkeys = array();
- /**
- * Store the fage status (true when opened, false when closed).
- * @access protected
- * @since 4.5.000 (2009-01-02)
- */
- protected $pageopen = array();
-
- /**
- * Default monospaced font
- * @access protected
- * @since 4.5.025 (2009-03-10)
- */
- protected $default_monospaced_font = 'courier';
- /**
- * Used to store a cloned copy of the current class object
- * @access protected
- * @since 4.5.029 (2009-03-19)
- */
- protected $objcopy;
- /**
- * Array used to store the lenghts of cache files
- * @access protected
- * @since 4.5.029 (2009-03-19)
- */
- protected $cache_file_lenght = array();
- /**
- * Table header content to be repeated on each new page
- * @access protected
- * @since 4.5.030 (2009-03-20)
- */
- protected $thead = '';
- /**
- * Distance between the top of page and end of table headers on a new page.
- * @access protected
- * @since 4.5.030 (2009-03-20)
- */
- protected $theadMargin = '';
- /**
- * Cache array for UTF8StringToArray() method.
- * @access protected
- * @since 4.5.037 (2009-04-07)
- */
- protected $cache_UTF8StringToArray = array();
- /**
- * Maximum size of cache array used for UTF8StringToArray() method.
- * @access protected
- * @since 4.5.037 (2009-04-07)
- */
- protected $cache_maxsize_UTF8StringToArray = 8;
- /**
- * Current size of cache array used for UTF8StringToArray() method.
- * @access protected
- * @since 4.5.037 (2009-04-07)
- */
- protected $cache_size_UTF8StringToArray = 0;
- /**
- * If true enables document signing
- * @access protected
- * @since 4.6.005 (2009-04-24)
- */
- protected $sign = false;
- /**
- * Signature data
- * @access protected
- * @since 4.6.005 (2009-04-24)
- */
- protected $signature_data = array();
- /**
- * Signature max lenght
- * @access protected
- * @since 4.6.005 (2009-04-24)
- */
- protected $signature_max_lenght = 5120;
- /**
- * Regular expression used to find blank characters used for word-wrapping.
- * @access protected
- * @since 4.6.006 (2009-04-28)
- */
- protected $re_spaces = '/[\s\p{Z}\p{Lo}]/';
- //------------------------------------------------------------
- // METHODS
- //------------------------------------------------------------
- /**
- * This is the class constructor.
- * It allows to set up the page format, the orientation and
- * the measure unit used in all the methods (except for the font sizes).
- * @since 1.0
- * @param string $orientation page orientation. Possible values are (case insensitive):<ul><li>P or Portrait (default)</li><li>L or Landscape</li></ul>
- * @param string $unit User measure unit. Possible values are:<ul><li>pt: point</li><li>mm: millimeter (default)</li><li>cm: centimeter</li><li>in: inch</li></ul><br />A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit.
- * @param mixed $format The format used for pages. It can be either one of the following values (case insensitive) or a custom format in the form of a two-element array containing the width and the height (expressed in the unit given by unit).<ul><li>4A0</li><li>2A0</li><li>A0</li><li>A1</li><li>A2</li><li>A3</li><li>A4 (default)</li><li>A5</li><li>A6</li><li>A7</li><li>A8</li><li>A9</li><li>A10</li><li>B0</li><li>B1</li><li>B2</li><li>B3</li><li>B4</li><li>B5</li><li>B6</li><li>B7</li><li>B8</li><li>B9</li><li>B10</li><li>C0</li><li>C1</li><li>C2</li><li>C3</li><li>C4</li><li>C5</li><li>C6</li><li>C7</li><li>C8</li><li>C9</li><li>C10</li><li>RA0</li><li>RA1</li><li>RA2</li><li>RA3</li><li>RA4</li><li>SRA0</li><li>SRA1</li><li>SRA2</li><li>SRA3</li><li>SRA4</li><li>LETTER</li><li>LEGAL</li><li>EXECUTIVE</li><li>FOLIO</li></ul>
- * @param boolean $unicode TRUE means that the input text is unicode (default = true)
- * @param boolean $diskcache if TRUE reduce the RAM memory usage by caching temporary data on filesystem (slower).
- * @param String $encoding charset encoding; default is UTF-8
- * @access public
- */
- public function __construct($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding='UTF-8', $diskcache=false) {
- /* Set internal character encoding to ASCII */
- if (function_exists('mb_internal_encoding') AND mb_internal_encoding()) {
- $this->internal_encoding = mb_internal_encoding();
- mb_internal_encoding('ASCII');
- }
- // set disk caching
- $this->diskcache = $diskcache ? true : false;
- // set language direction
- $this->rtl = $this->l['a_meta_dir']=='rtl' ? true : false;
- $this->tmprtl = false;
- //Some checks
- $this->_dochecks();
- //Initialization of properties
- $this->isunicode = $unicode;
- $this->page = 0;
- $this->transfmrk[0] = array();
- $this->pagedim = array();
- $this->n = 2;
- $this->buffer = '';
- $this->pages = array();
- $this->state = 0;
- $this->fonts = array();
- $this->FontFiles = array();
- $this->diffs = array();
- $this->images = array();
- $this->links = array();
- $this->gradients = array();
- $this->InFooter = false;
- $this->lasth = 0;
- $this->FontFamily = 'helvetica';
- $this->FontStyle = '';
- $this->FontSizePt = 12;
- $this->underline = false;
- $this->linethrough = false;
- $this->DrawColor = '0 G';
- $this->FillColor = '0 g';
- $this->TextColor = '0 g';
- $this->ColorFlag = false;
- // encryption values
- $this->encrypted = false;
- $this->last_rc4_key = '';
- $this->padding = "\x28\xBF\x4E\x5E\x4E\x75\x8A\x41\x64\x00\x4E\x56\xFF\xFA\x01\x08\x2E\x2E\x00\xB6\xD0\x68\x3E\x80\x2F\x0C\xA9\xFE\x64\x53\x69\x7A";
- //Standard Unicode fonts
- $this->CoreFonts = array(
- 'courier'=>'Courier',
- 'courierB'=>'Courier-Bold',
- 'courierI'=>'Courier-Oblique',
- 'courierBI'=>'Courier-BoldOblique',
- 'helvetica'=>'Helvetica',
- 'helveticaB'=>'Helvetica-Bold',
- 'helveticaI'=>'Helvetica-Oblique',
- 'helveticaBI'=>'Helvetica-BoldOblique',
- 'times'=>'Times-Roman',
- 'timesB'=>'Times-Bold',
- 'timesI'=>'Times-Italic',
- 'timesBI'=>'Times-BoldItalic',
- 'symbol'=>'Symbol',
- 'zapfdingbats'=>'ZapfDingbats'
- );
- //Set scale factor
- $this->setPageUnit($unit);
- // set page format and orientation
- $this->setPageFormat($format, $orientation);
- //Page margins (1 cm)
- $margin = 28.35 / $this->k;
- $this->SetMargins($margin, $margin);
- //Interior cell margin
- $this->cMargin = $margin / 10;
- //Line width (0.2 mm)
- $this->LineWidth = 0.57 / $this->k;
- $this->linestyleWidth = sprintf('%.2F w', ($this->LineWidth * $this->k));
- $this->linestyleCap = '0 J';
- $this->linestyleJoin = '0 j';
- $this->linestyleDash = '[] 0 d';
- //Automatic page break
- $this->SetAutoPageBreak(true, (2 * $margin));
- //Full width display mode
- $this->SetDisplayMode('fullwidth');
- //Compression
- $this->SetCompression(true);
- //Set default PDF version number
- $this->PDFVersion = '1.7';
- $this->encoding = $encoding;
- $this->HREF = array();
- $this->getFontsList();
- $this->fgcolor = array('R' => 0, 'G' => 0, 'B' => 0);
- $this->bgcolor = array('R' => 255, 'G' => 255, 'B' => 255);
- $this->extgstates = array();
- // user's rights
- $this->sign = false;
- $this->ur = false;
- $this->ur_document = '/FullSave';
- $this->ur_annots = '/Create/Delete/Modify/Copy/Import/Export';
- $this->ur_form = '/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate';
- $this->ur_signature = '/Modify';
- // set default JPEG quality
- $this->jpeg_quality = 75;
- // initialize some settings
- $this->utf8Bidi(array(''), '');
- // set default font
- $this->SetFont($this->FontFamily, $this->FontStyle, $this->FontSizePt);
- // check if PCRE Unicode support is enabled
- if (@preg_match('/\pL/u', 'a') == 1) {
- // PCRE unicode support is turned ON
- // \p{Z} or \p{Separator}: any kind of Unicode whitespace or invisible separator.
- // \p{Lo} or \p{Other_Letter}: a Unicode letter or ideograph that does not have lowercase and uppercase variants.
- // \p{Lo} is needed because Chinese characters are packed next to each other without spaces in between.
- $this->re_spaces = '/[\s\p{Z}\p{Lo}]/';
- } else {
- // PCRE unicode support is turned OFF
- $this->re_spaces = '/[\s]/';
- }
- }
-
- /**
- * Default destructor.
- * @access public
- * @since 1.53.0.TC016
- */
- public function __destruct() {
- // restore internal encoding
- if (isset($this->internal_encoding) AND !empty($this->internal_encoding)) {
- mb_internal_encoding($this->internal_encoding);
- }
- // unset all class variables
- $this->_destroy(true);
- }
-
- /**
- * Set the units of measure for the document.
- * @param string $unit User measure unit. Possible values are:<ul><li>pt: point</li><li>mm: millimeter (default)</li><li>cm: centimeter</li><li>in: inch</li></ul><br />A point equals 1/72 of inch, that is to say about 0.35 mm (an inch being 2.54 cm). This is a very common unit in typography; font sizes are expressed in that unit.
- * @access public
- * @since 3.0.015 (2008-06-06)
- */
- public function setPageUnit($unit) {
- //Set scale factor
- switch (strtolower($unit)) {
- // points
- case 'px':
- case 'pt': {
- $this->k = 1;
- break;
- }
- // millimeters
- case 'mm': {
- $this->k = $this->dpi / 25.4;
- break;
- }
- // centimeters
- case 'cm': {
- $this->k = $this->dpi / 2.54;
- break;
- }
- // inches
- case 'in': {
- $this->k = $this->dpi;
- break;
- }
- // unsupported unit
- default : {
- $this->Error('Incorrect unit: '.$unit);
- break;
- }
- }
- if (isset($this->CurOrientation)) {
- $this->setPageOrientation($this->CurOrientation);
- }
- }
-
- /**
- * Set the page format
- * @param mixed $format The format used for pages. It can be either one of the following values (case insensitive) or a custom format in the form of a two-element array containing the width and the height (expressed in the unit given by unit).<ul><li>4A0</li><li>2A0</li><li>A0</li><li>A1</li><li>A2</li><li>A3</li><li>A4 (default)</li><li>A5</li><li>A6</li><li>A7</li><li>A8</li><li>A9</li><li>A10</li><li>B0</li><li>B1</li><li>B2</li><li>B3</li><li>B4</li><li>B5</li><li>B6</li><li>B7</li><li>B8</li><li>B9</li><li>B10</li><li>C0</li><li>C1</li><li>C2</li><li>C3</li><li>C4</li><li>C5</li><li>C6</li><li>C7</li><li>C8</li><li>C9</li><li>C10</li><li>RA0</li><li>RA1</li><li>RA2</li><li>RA3</li><li>RA4</li><li>SRA0</li><li>SRA1</li><li>SRA2</li><li>SRA3</li><li>SRA4</li><li>LETTER</li><li>LEGAL</li><li>EXECUTIVE</li><li>FOLIO</li></ul>
- * @param string $orientation page orientation. Possible values are (case insensitive):<ul><li>P or PORTRAIT (default)</li><li>L or LANDSCAPE</li></ul>
- * @access public
- * @since 3.0.015 (2008-06-06)
- */
- public function setPageFormat($format, $orientation='P') {
- //Page format
- if (is_string($format)) {
- // Page formats (45 standard ISO paper formats and 4 american common formats).
- // Paper cordinates are calculated in this way: (inches * 72) where (1 inch = 2.54 cm)
- switch (strtoupper($format)) {
- case '4A0': {$format = array(4767.87,6740.79); break;}
- case '2A0': {$format = array(3370.39,4767.87); break;}
- case 'A0': {$format = array(2383.94,3370.39); break;}
- case 'A1': {$format = array(1683.78,2383.94); break;}
- case 'A2': {$format = array(1190.55,1683.78); break;}
- case 'A3': {$format = array(841.89,1190.55); break;}
- case 'A4': default: {$format = array(595.28,841.89); break;}
- case 'A5': {$format = array(419.53,595.28); break;}
- case 'A6': {$format = array(297.64,419.53); break;}
- case 'A7': {$format = array(209.76,297.64); break;}
- case 'A8': {$format = array(147.40,209.76); break;}
- case 'A9': {$format = array(104.88,147.40); break;}
- case 'A10': {$format = array(73.70,104.88); break;}
- case 'B0': {$format = array(2834.65,4008.19); break;}
- case 'B1': {$format = array(2004.09,2834.65); break;}
- case 'B2': {$format = array(1417.32,2004.09); break;}
- case 'B3': {$format = array(1000.63,1417.32); break;}
- case 'B4': {$format = array(708.66,1000.63); break;}
- case 'B5': {$format = array(498.90,708.66); break;}
- case 'B6': {$format = array(354.33,498.90); break;}
- case 'B7': {$format = array(249.45,354.33); break;}
- case 'B8': {$format = array(175.75,249.45); break;}
- case 'B9': {$format = array(124.72,175.75); break;}
- case 'B10': {$format = array(87.87,124.72); break;}
- case 'C0': {$format = array(2599.37,3676.54); break;}
- case 'C1': {$format = array(1836.85,2599.37); break;}
- case 'C2': {$format = array(1298.27,1836.85); break;}
- case 'C3': {$format = array(918.43,1298.27); break;}
- case 'C4': {$format = array(649.13,918.43); break;}
- case 'C5': {$format = array(459.21,649.13); break;}
- case 'C6': {$format = array(323.15,459.21); break;}
- case 'C7': {$format = array(229.61,323.15); break;}
- case 'C8': {$format = array(161.57,229.61); break;}
- case 'C9': {$format = array(113.39,161.57); break;}
- case 'C10': {$format = array(79.37,113.39); break;}
- case 'RA0': {$format = array(2437.80,3458.27); break;}
- case 'RA1': {$format = array(1729.13,2437.80); break;}
- case 'RA2': {$format = array(1218.90,1729.13); break;}
- case 'RA3': {$format = array(864.57,1218.90); break;}
- case 'RA4': {$format = array(609.45,864.57); break;}
- case 'SRA0': {$format = array(2551.18,3628.35); break;}
- case 'SRA1': {$format = array(1814.17,2551.18); break;}
- case 'SRA2': {$format = array(1275.59,1814.17); break;}
- case 'SRA3': {$format = array(907.09,1275.59); break;}
- case 'SRA4': {$format = array(637.80,907.09); break;}
- case 'LETTER': {$format = array(612.00,792.00); break;}
- case 'LEGAL': {$format = array(612.00,1008.00); break;}
- case 'EXECUTIVE': {$format = array(521.86,756.00); break;}
- case 'FOLIO': {$format = array(612.00,936.00); break;}
- }
- $this->fwPt = $format[0];
- $this->fhPt = $format[1];
- } else {
- $this->fwPt = $format[0] * $this->k;
- $this->fhPt = $format[1] * $this->k;
- }
- $this->setPageOrientation($orientation);
- }
-
- /**
- * Set page orientation.
- * @param string $orientation page orientation. Possible values are (case insensitive):<ul><li>P or PORTRAIT (default)</li><li>L or LANDSCAPE</li></ul>
- * @param boolean $autopagebreak Boolean indicating if auto-page-break mode should be on or off.
- * @param float $bottommargin bottom margin of the page.
- * @access public
- * @since 3.0.015 (2008-06-06)
- */
- public function setPageOrientation($orientation, $autopagebreak='', $bottommargin='') {
- $orientation = strtoupper($orientation);
- if (($orientation == 'P') OR ($orientation == 'PORTRAIT')) {
- $this->CurOrientation = 'P';
- $this->wPt = $this->fwPt;
- $this->hPt = $this->fhPt;
- } elseif (($orientation == 'L') OR ($orientation == 'LANDSCAPE')) {
- $this->CurOrientation = 'L';
- $this->wPt = $this->fhPt;
- $this->hPt = $this->fwPt;
- } else {
- $this->Error('Incorrect orientation: '.$orientation);
- }
- $this->w = $this->wPt / $this->k;
- $this->h = $this->hPt / $this->k;
- if ($this->empty_string($autopagebreak)) {
- if (isset($this->AutoPageBreak)) {
- $autopagebreak = $this->AutoPageBreak;
- } else {
- $autopagebreak = true;
- }
- }
- if ($this->empty_string($bottommargin)) {
- if (isset($this->bMargin)) {
- $bottommargin = $this->bMargin;
- } else {
- // default value = 2 cm
- $bottommargin = 2 * 28.35 / $this->k;
- }
- }
- $this->SetAutoPageBreak($autopagebreak, $bottommargin);
- // store page dimensions
- $this->pagedim[$this->page] = array('w' => $this->wPt, 'h' => $this->hPt, 'wk' => $this->w, 'hk' => $this->h, 'tm' => $this->tMargin, 'bm' => $bottommargin, 'lm' => $this->lMargin, 'rm' => $this->rMargin, 'pb' => $autopagebreak, 'or' => $this->CurOrientation, 'olm' => $this->original_lMargin, 'orm' => $this->original_rMargin);
- }
-
- /**
- * Enable or disable Right-To-Left language mode
- * @param Boolean $enable if true enable Right-To-Left language mode.
- * @access public
- * @since 2.0.000 (2008-01-03)
- */
- public function setRTL($enable) {
- $this->rtl = $enable ? true : false;
- $this->tmprtl = false;
- }
-
- /**
- * Return the RTL status
- * @return boolean
- * @access public
- * @since 4.0.012 (2008-07-24)
- */
- public function getRTL() {
- return $this->rtl;
- }
-
- /**
- * Force temporary RTL language direction
- * @param mixed $mode can be false, 'L' for LTR or 'R' for RTL
- * @access public
- * @since 2.1.000 (2008-01-09)
- */
- public function setTempRTL($mode) {
- switch ($mode) {
- case false:
- case 'L':
- case 'R': {
- $this->tmprtl = $mode;
- }
- }
- }
-
- /**
- * Set the last cell height.
- * @param float $h cell height.
- * @author Nicola Asuni
- * @access public
- * @since 1.53.0.TC034
- */
- public function setLastH($h) {
- $this->lasth = $h;
- }
-
- /**
- * Get the last cell height.
- * @return last cell height
- * @access public
- * @since 4.0.017 (2008-08-05)
- */
- public function getLastH() {
- return $this->lasth;
- }
-
- /**
- * Set the adjusting factor to convert pixels to user units.
- * @param float $scale adjusting factor to convert pixels to user units.
- * @author Nicola Asuni
- * @access public
- * @since 1.5.2
- */
- public function setImageScale($scale) {
- $this->imgscale = $scale;
- }
- /**
- * Returns the adjusting factor to convert pixels to user units.
- * @return float adjusting factor to convert pixels to user units.
- * @author Nicola Asuni
- * @access public
- * @since 1.5.2
- */
- public function getImageScale() {
- return $this->imgscale;
- }
-
- /**
- * Returns an array of page dimensions:
- * <ul><li>$this->pagedim[$this->page]['w'] => page_width_in_points</li><li>$this->pagedim[$this->page]['h'] => height in points</li><li>$this->pagedim[$this->page]['wk'] => page_width_in_points</li><li>$this->pagedim[$this->page]['hk'] => height</li><li>$this->pagedim[$this->page]['tm'] => top_margin</li><li>$this->pagedim[$this->page]['bm'] => bottom_margin</li><li>$this->pagedim[$this->page]['lm'] => left_margin</li><li>$this->pagedim[$this->page]['rm'] => right_margin</li><li>$this->pagedim[$this->page]['pb'] => auto_page_break</li><li>$this->pagedim[$this->page]['or'] => page_orientation</li><li>$this->pagedim[$this->page]['olm'] => original_left_margin</li><li>$this->pagedim[$this->page][…
Large files files are truncated, but you can click here to view the full file