📄 tcpdf.php
字号:
<?php//============================================================+// File name : tcpdf.php// Begin : 2002-08-03// Last Update : 2008-03-07// Author : Nicola Asuni// Version : 2.5.000_PHP4// License : GNU LGPL (http://www.gnu.org/copyleft/lesser.html)//// Description : This is a PHP5 class for generating PDF files// on-the-fly 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).//// Main features:// - supports all ISO page formats;// - supports UTF-8 Unicode and Right-To-Left languages;// - supports document encryption;// - includes methods to publish some xhtml code;// - includes graphic and transformation methods;// - includes bookmarks;// - includes Javascript and forms support;// - includes a method to print various barcode formats using an improved version of "Generic Barcode Render Class" by Karim Mribti (http://www.mribti.com/barcode/) (require GD library: http://www.boutell.com/gd/)// - supports TrueTypeUnicode, TrueType, Type1 and encoding;// - supports custom page formats, margins and units of measure;// - includes methods for page header and footer management;// - supports automatic page break;// - supports automatic page numbering;// - supports automatic line break and text justification;// - supports JPEG, PNG anf GIF images;// - supports colors;// - supports links;// - support page compression (require zlib extension: http://www.gzip.org/zlib/);// - the source code is full documented in PhpDocumentor Style (http://www.phpdoc.org).//// -----------------------------------------------------------// 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锟絥tert for JavaScript support.// Denis Van Nuffelen for Dynamic Form.// Jacek Czekaj for multibyte justification// Anthony Ferrara for the reintroduction of legacy image methods.// Anyone that has reported a bug or sent a suggestion.//============================================================+/** * This is a PHP5 class for generating PDF files on-the-fly without requiring external extensions.<br> * TCPDF project (http://tcpdf.sourceforge.net) has been originally derived from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org).<br> * <h3>TCPDF main features are:</h3> * <ul> * <li>supports all ISO page formats;</li> * <li>supports UTF-8 Unicode and Right-To-Left languages;</li> * <li>supports document encryption;</li> * <li>includes methods to publish some xhtml code, supporting the following elements: h1, h2, h3, h4, h5, h6, b, u, i, a, img, p, br, strong, em, font, blockquote, li, ul, ol, hr, td, th, tr, table, sup, sub, small;</li> * <li>includes a method to print various barcode formats using an improved version of "Generic Barcode Render Class" by Karim Mribti (<a href="http://www.mribti.com/barcode/" target="_blank" title="Generic Barcode Render Class by Karim Mribti">http://www.mribti.com/barcode/</a>) (require GD library: <a href="http://www.boutell.com/gd/" target="_blank" title="GD library">http://www.boutell.com/gd/</a>)</li> * <li>supports TrueTypeUnicode, TrueType, Type1 and encoding; </li> * <li>supports custom page formats, margins and units of measure;</li> * <li>includes methods for page header and footer management;</li> * <li>supports automatic page break;</li> * <li>supports automatic page numbering;</li> * <li>supports automatic line break and text justification;</li> * <li>supports JPEG, PNG anf GIF images;</li> * <li>supports colors;</li> * <li>supports links;</li> * <li>support page compression (require zlib extension: <a href="http://www.gzip.org/zlib/" target="_blank" title="zlib">http://www.gzip.org/zlib/</a>);</li> * <li>the source code is full documented in PhpDocumentor Style (<a href="http://www.phpdoc.org" target="_blank" title="phpDocumentor">http://www.phpdoc.org</a>).</li> * </ul> * Tools to encode your unicode fonts are on fonts/ttf2ufm directory.</p> * @name TCPDF * @package com.tecnick.tcpdf * @abstract Class for generating PDF files on-the-fly without requiring external extensions. * @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://www.tcpdf.org * @license http://www.gnu.org/copyleft/lesser.html LGPL * @version 2.5.000_PHP4 *//** * include configuration file */require_once(dirname(__FILE__).'/config/tcpdf_config.php');if(!class_exists('TCPDF')) { /** * define default PDF document producer */ define('PDF_PRODUCER','TCPDF 2.5.000_PHP4 (http://www.tcpdf.org)'); /** * This is a PHP5 class for generating PDF files on-the-fly without requiring external extensions.<br> * TCPDF project (http://tcpdf.sourceforge.net) has been originally derived from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org).<br> * To add your own TTF fonts please read /fonts/README.TXT * @name TCPDF * @package com.tecnick.tcpdf * @version 2.5.000_PHP4 * @author Nicola Asuni * @link http://www.tcpdf.org * @license http://www.gnu.org/copyleft/lesser.html LGPL */ class TCPDF { // Private or Protected properties /** * @var current page number * @access protected */ var $page; /** * @var current object number * @access protected */ var $n; /** * @var array of object offsets * @access protected */ var $offsets; /** * @var buffer holding in-memory PDF * @access protected */ var $buffer; /** * @var array containing pages * @access protected */ var $pages; /** * @var current document state * @access protected */ var $state; /** * @var compression flag * @access protected */ var $compress; /** * @var default page orientation (P = Portrait, L = Landscape) * @access protected */ var $DefOrientation; /** * @var current page orientation (P = Portrait, L = Landscape) * @access protected */ var $CurOrientation; /** * @var array indicating page orientation changes * @access protected */ var $OrientationChanges; /** * @var scale factor (number of points in user unit) * @access protected */ var $k; /** * @var width of page format in points * @access protected */ var $fwPt; /** * @var height of page format in points * @access protected */ var $fhPt; /** * @var width of page format in user unit * @access protected */ var $fw; /** * @var height of page format in user unit * @access protected */ var $fh; /** * @var current width of page in points * @access protected */ var $wPt; /** * @var current height of page in points * @access protected */ var $hPt; /** * @var current width of page in user unit * @access protected */ var $w; /** * @var current height of page in user unit * @access protected */ var $h; /** * @var left margin * @access protected */ var $lMargin; /** * @var top margin * @access protected */ var $tMargin; /** * @var right margin * @access protected */ var $rMargin; /** * @var page break margin * @access protected */ var $bMargin; /** * @var cell internal padding * @access protected */ var $cMargin; /** * @var current horizontal position in user unit for cell positioning * @access protected */ var $x; /** * @var current vertical position in user unit for cell positioning * @access protected */ var $y; /** * @var height of last cell printed * @access protected */ var $lasth; /** * @var line width in user unit * @access protected */ var $LineWidth; /** * @var array of standard font names * @access protected */ var $CoreFonts; /** * @var array of used fonts * @access protected */ var $fonts; /** * @var array of font files * @access protected */ var $FontFiles; /** * @var array of encoding differences * @access protected */ var $diffs; /** * @var array of used images * @access protected */ var $images; /** * @var array of links in pages * @access protected */ var $PageLinks; /** * @var array of internal links * @access protected */ var $links; /** * @var current font family * @access protected */ var $FontFamily; /** * @var current font style * @access protected */ var $FontStyle; /** * @var underlining flag * @access protected */ var $underline; /** * @var current font info * @access protected */ var $CurrentFont; /** * @var current font size in points * @access protected */ var $FontSizePt; /** * @var current font size in user unit * @access protected */ var $FontSize; /** * @var commands for drawing color * @access protected */ var $DrawColor; /** * @var commands for filling color * @access protected */ var $FillColor; /** * @var commands for text color * @access protected */ var $TextColor; /** * @var indicates whether fill and text colors are different * @access protected */ var $ColorFlag; /** * @var word spacing * @access protected */ var $ws; /** * @var automatic page breaking * @access protected */ var $AutoPageBreak; /** * @var threshold used to trigger page breaks * @access protected */ var $PageBreakTrigger; /** * @var flag set when processing footer * @access protected */ var $InFooter; /** * @var zoom display mode * @access protected */ var $ZoomMode; /** * @var layout display mode * @access protected */ var $LayoutMode; /** * @var title * @access protected */ var $title; /** * @var subject * @access protected */ var $subject; /** * @var author * @access protected */ var $author; /** * @var keywords * @access protected */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -