PageRenderTime 73ms CodeModel.GetById 32ms RepoModel.GetById 0ms app.codeStats 2ms

/phpmyadmin/libraries/tcpdf/tcpdf.php

https://bitbucket.org/kylestlb/cse360site
PHP | 11454 lines | 7006 code | 436 blank | 4012 comment | 1361 complexity | a8d65bd5f1e854e90fc7d70345f00527 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, LGPL-3.0

Large files files are truncated, but you can click here to view the full file

  1. <?php
  2. //============================================================+
  3. // File name : tcpdf.php
  4. // Version : 5.9.039
  5. // Begin : 2002-08-03
  6. // Last Update : 2011-01-12
  7. // Author : Nicola Asuni - Tecnick.com S.r.l - Via Della Pace, 11 - 09044 - Quartucciu (CA) - ITALY - www.tecnick.com - info@tecnick.com
  8. // License : http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT GNU-LGPLv3 + YOU CAN'T REMOVE ANY TCPDF COPYRIGHT NOTICE OR LINK FROM THE GENERATED PDF DOCUMENTS.
  9. // -------------------------------------------------------------------
  10. // Copyright (C) 2002-2011 Nicola Asuni - Tecnick.com S.r.l.
  11. //
  12. // This file is part of TCPDF software library.
  13. //
  14. // TCPDF is free software: you can redistribute it and/or modify it
  15. // under the terms of the GNU Lesser General Public License as
  16. // published by the Free Software Foundation, either version 3 of the
  17. // License, or (at your option) any later version. Additionally,
  18. // YOU CAN'T REMOVE ANY TCPDF COPYRIGHT NOTICE OR LINK FROM THE
  19. // GENERATED PDF DOCUMENTS.
  20. //
  21. // TCPDF is distributed in the hope that it will be useful, but
  22. // WITHOUT ANY WARRANTY; without even the implied warranty of
  23. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  24. // See the GNU Lesser General Public License for more details.
  25. //
  26. // You should have received a copy of the License
  27. // along with TCPDF. If not, see
  28. // <http://www.tecnick.com/pagefiles/tcpdf/LICENSE.TXT>.
  29. //
  30. // See LICENSE.TXT file for more information.
  31. // -------------------------------------------------------------------
  32. //
  33. // Description : This is a PHP class for generating PDF documents without
  34. // requiring external extensions.
  35. //
  36. // NOTE:
  37. // This class was originally derived in 2002 from the Public
  38. // Domain FPDF class by Olivier Plathey (http://www.fpdf.org),
  39. // but now is almost entirely rewritten and contains thousands of
  40. // new lines of code and hundreds new features.
  41. //
  42. // Main features:
  43. // * no external libraries are required for the basic functions;
  44. // * all standard page formats, custom page formats, custom margins and units of measure;
  45. // * UTF-8 Unicode and Right-To-Left languages;
  46. // * TrueTypeUnicode, OpenTypeUnicode, TrueType, OpenType, Type1 and CID-0 fonts;
  47. // * font subsetting;
  48. // * methods to publish some XHTML + CSS code, Javascript and Forms;
  49. // * images, graphic (geometric figures) and transformation methods;
  50. // * supports JPEG, PNG and SVG 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)
  51. // * 1D and 2D barcodes: 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, QR-Code, PDF417;
  52. // * Grayscale, RGB, CMYK, Spot Colors and Transparencies;
  53. // * automatic page header and footer management;
  54. // * document encryption up to 256 bit and digital signature certifications;
  55. // * transactions to UNDO commands;
  56. // * PDF annotations, including links, text and file attachments;
  57. // * text rendering modes (fill, stroke and clipping);
  58. // * multiple columns mode;
  59. // * no-write page regions;
  60. // * bookmarks and table of content;
  61. // * text hyphenation;
  62. // * text stretching and spacing (tracking/kerning);
  63. // * automatic page break, line break and text alignments including justification;
  64. // * automatic page numbering and page groups;
  65. // * move and delete pages;
  66. // * page compression (requires php-zlib extension);
  67. // * XOBject Templates;
  68. //
  69. // -----------------------------------------------------------
  70. // THANKS TO:
  71. //
  72. // Olivier Plathey (http://www.fpdf.org) for original FPDF.
  73. // Efthimios Mavrogeorgiadis (emavro@yahoo.com) for suggestions on RTL language support.
  74. // Klemen Vodopivec (http://www.fpdf.de/downloads/addons/37/) for Encryption algorithm.
  75. // Warren Sherliker (wsherliker@gmail.com) for better image handling.
  76. // dullus for text Justification.
  77. // Bob Vincent (pillarsdotnet@users.sourceforge.net) for <li> value attribute.
  78. // Patrick Benny for text stretch suggestion on Cell().
  79. // Johannes Güntert for JavaScript support.
  80. // Denis Van Nuffelen for Dynamic Form.
  81. // Jacek Czekaj for multibyte justification
  82. // Anthony Ferrara for the reintroduction of legacy image methods.
  83. // Sourceforge user 1707880 (hucste) for line-trough mode.
  84. // Larry Stanbery for page groups.
  85. // Martin Hall-May for transparency.
  86. // Aaron C. Spike for Polycurve method.
  87. // Mohamad Ali Golkar, Saleh AlMatrafe, Charles Abbott for Arabic and Persian support.
  88. // Moritz Wagner and Andreas Wurmser for graphic functions.
  89. // Andrew Whitehead for core fonts support.
  90. // Esteban Joël Marín for OpenType font conversion.
  91. // Teus Hagen for several suggestions and fixes.
  92. // Yukihiro Nakadaira for CID-0 CJK fonts fixes.
  93. // Kosmas Papachristos for some CSS improvements.
  94. // Marcel Partap for some fixes.
  95. // Won Kyu Park for several suggestions, fixes and patches.
  96. // Dominik Dzienia for QR-code support.
  97. // Laurent Minguet for some suggestions.
  98. // Christian Deligant for some suggestions and fixes.
  99. // Anyone that has reported a bug or sent a suggestion.
  100. //============================================================+
  101. /**
  102. * @file
  103. * This is a PHP class for generating PDF documents without requiring external extensions.<br>
  104. * 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>
  105. * <h3>TCPDF main features are:</h3>
  106. * <ul>
  107. * <li>no external libraries are required for the basic functions;</li>
  108. * <li>all standard page formats, custom page formats, custom margins and units of measure;</li>
  109. * <li>UTF-8 Unicode and Right-To-Left languages;</li>
  110. * <li>TrueTypeUnicode, OpenTypeUnicode, TrueType, OpenType, Type1 and CID-0 fonts;</li>
  111. * <li>font subsetting;</li>
  112. * <li>methods to publish some XHTML + CSS code, Javascript and Forms;</li>
  113. * <li>images, graphic (geometric figures) and transformation methods;
  114. * <li>supports JPEG, PNG and SVG 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>
  115. * <li>1D and 2D barcodes: 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, QR-Code, PDF417;</li>
  116. * <li>Grayscale, RGB, CMYK, Spot Colors and Transparencies;</li>
  117. * <li>automatic page header and footer management;</li>
  118. * <li>document encryption up to 256 bit and digital signature certifications;</li>
  119. * <li>transactions to UNDO commands;</li>
  120. * <li>PDF annotations, including links, text and file attachments;</li>
  121. * <li>text rendering modes (fill, stroke and clipping);</li>
  122. * <li>multiple columns mode;</li>
  123. * <li>no-write page regions;</li>
  124. * <li>bookmarks and table of content;</li>
  125. * <li>text hyphenation;</li>
  126. * <li>text stretching and spacing (tracking/kerning);</li>
  127. * <li>automatic page break, line break and text alignments including justification;</li>
  128. * <li>automatic page numbering and page groups;</li>
  129. * <li>move and delete pages;</li>
  130. * <li>page compression (requires php-zlib extension);</li>
  131. * <li>XOBject Templates;</li>
  132. * </ul>
  133. * Tools to encode your unicode fonts are on fonts/utils directory.</p>
  134. * @package com.tecnick.tcpdf
  135. * @author Nicola Asuni
  136. * @version 5.9.039
  137. */
  138. // Main configuration file. Define the K_TCPDF_EXTERNAL_CONFIG constant to skip this file.
  139. require_once(dirname(__FILE__).'/config/tcpdf_config.php');
  140. /**
  141. * @class TCPDF
  142. * PHP class for generating PDF documents without requiring external extensions.
  143. * 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>
  144. * @package com.tecnick.tcpdf
  145. * @brief PHP class for generating PDF documents without requiring external extensions.
  146. * @version 5.9.039
  147. * @author Nicola Asuni - info@tecnick.com
  148. */
  149. class TCPDF {
  150. // private properties
  151. /**
  152. * Current TCPDF version.
  153. * @private
  154. */
  155. private $tcpdf_version = '5.9.039';
  156. // Protected properties
  157. /**
  158. * Current page number.
  159. * @protected
  160. */
  161. protected $page;
  162. /**
  163. * Current object number.
  164. * @protected
  165. */
  166. protected $n;
  167. /**
  168. * Array of object offsets.
  169. * @protected
  170. */
  171. protected $offsets;
  172. /**
  173. * Buffer holding in-memory PDF.
  174. * @protected
  175. */
  176. protected $buffer;
  177. /**
  178. * Array containing pages.
  179. * @protected
  180. */
  181. protected $pages = array();
  182. /**
  183. * Current document state.
  184. * @protected
  185. */
  186. protected $state;
  187. /**
  188. * Compression flag.
  189. * @protected
  190. */
  191. protected $compress;
  192. /**
  193. * Current page orientation (P = Portrait, L = Landscape).
  194. * @protected
  195. */
  196. protected $CurOrientation;
  197. /**
  198. * Page dimensions.
  199. * @protected
  200. */
  201. protected $pagedim = array();
  202. /**
  203. * Scale factor (number of points in user unit).
  204. * @protected
  205. */
  206. protected $k;
  207. /**
  208. * Width of page format in points.
  209. * @protected
  210. */
  211. protected $fwPt;
  212. /**
  213. * Height of page format in points.
  214. * @protected
  215. */
  216. protected $fhPt;
  217. /**
  218. * Current width of page in points.
  219. * @protected
  220. */
  221. protected $wPt;
  222. /**
  223. * Current height of page in points.
  224. * @protected
  225. */
  226. protected $hPt;
  227. /**
  228. * Current width of page in user unit.
  229. * @protected
  230. */
  231. protected $w;
  232. /**
  233. * Current height of page in user unit.
  234. * @protected
  235. */
  236. protected $h;
  237. /**
  238. * Left margin.
  239. * @protected
  240. */
  241. protected $lMargin;
  242. /**
  243. * Top margin.
  244. * @protected
  245. */
  246. protected $tMargin;
  247. /**
  248. * Right margin.
  249. * @protected
  250. */
  251. protected $rMargin;
  252. /**
  253. * Page break margin.
  254. * @protected
  255. */
  256. protected $bMargin;
  257. /**
  258. * Array of cell internal paddings ('T' => top, 'R' => right, 'B' => bottom, 'L' => left).
  259. * @since 5.9.000 (2010-10-03)
  260. * @protected
  261. */
  262. protected $cell_padding = array('T' => 0, 'R' => 0, 'B' => 0, 'L' => 0);
  263. /**
  264. * Array of cell margins ('T' => top, 'R' => right, 'B' => bottom, 'L' => left).
  265. * @since 5.9.000 (2010-10-04)
  266. * @protected
  267. */
  268. protected $cell_margin = array('T' => 0, 'R' => 0, 'B' => 0, 'L' => 0);
  269. /**
  270. * Current horizontal position in user unit for cell positioning.
  271. * @protected
  272. */
  273. protected $x;
  274. /**
  275. * Current vertical position in user unit for cell positioning.
  276. * @protected
  277. */
  278. protected $y;
  279. /**
  280. * Height of last cell printed.
  281. * @protected
  282. */
  283. protected $lasth;
  284. /**
  285. * Line width in user unit.
  286. * @protected
  287. */
  288. protected $LineWidth;
  289. /**
  290. * Array of standard font names.
  291. * @protected
  292. */
  293. protected $CoreFonts;
  294. /**
  295. * Array of used fonts.
  296. * @protected
  297. */
  298. protected $fonts = array();
  299. /**
  300. * Array of font files.
  301. * @protected
  302. */
  303. protected $FontFiles = array();
  304. /**
  305. * Array of encoding differences.
  306. * @protected
  307. */
  308. protected $diffs = array();
  309. /**
  310. * Array of used images.
  311. * @protected
  312. */
  313. protected $images = array();
  314. /**
  315. * Array of Annotations in pages.
  316. * @protected
  317. */
  318. protected $PageAnnots = array();
  319. /**
  320. * Array of internal links.
  321. * @protected
  322. */
  323. protected $links = array();
  324. /**
  325. * Current font family.
  326. * @protected
  327. */
  328. protected $FontFamily;
  329. /**
  330. * Current font style.
  331. * @protected
  332. */
  333. protected $FontStyle;
  334. /**
  335. * Current font ascent (distance between font top and baseline).
  336. * @protected
  337. * @since 2.8.000 (2007-03-29)
  338. */
  339. protected $FontAscent;
  340. /**
  341. * Current font descent (distance between font bottom and baseline).
  342. * @protected
  343. * @since 2.8.000 (2007-03-29)
  344. */
  345. protected $FontDescent;
  346. /**
  347. * Underlining flag.
  348. * @protected
  349. */
  350. protected $underline;
  351. /**
  352. * Overlining flag.
  353. * @protected
  354. */
  355. protected $overline;
  356. /**
  357. * Current font info.
  358. * @protected
  359. */
  360. protected $CurrentFont;
  361. /**
  362. * Current font size in points.
  363. * @protected
  364. */
  365. protected $FontSizePt;
  366. /**
  367. * Current font size in user unit.
  368. * @protected
  369. */
  370. protected $FontSize;
  371. /**
  372. * Commands for drawing color.
  373. * @protected
  374. */
  375. protected $DrawColor;
  376. /**
  377. * Commands for filling color.
  378. * @protected
  379. */
  380. protected $FillColor;
  381. /**
  382. * Commands for text color.
  383. * @protected
  384. */
  385. protected $TextColor;
  386. /**
  387. * Indicates whether fill and text colors are different.
  388. * @protected
  389. */
  390. protected $ColorFlag;
  391. /**
  392. * Automatic page breaking.
  393. * @protected
  394. */
  395. protected $AutoPageBreak;
  396. /**
  397. * Threshold used to trigger page breaks.
  398. * @protected
  399. */
  400. protected $PageBreakTrigger;
  401. /**
  402. * Flag set when processing footer.
  403. * @protected
  404. */
  405. protected $InFooter = false;
  406. /**
  407. * Zoom display mode.
  408. * @protected
  409. */
  410. protected $ZoomMode;
  411. /**
  412. * Layout display mode.
  413. * @protected
  414. */
  415. protected $LayoutMode;
  416. /**
  417. * If true set the document information dictionary in Unicode.
  418. * @protected
  419. */
  420. protected $docinfounicode = true;
  421. /**
  422. * Document title.
  423. * @protected
  424. */
  425. protected $title = '';
  426. /**
  427. * Document subject.
  428. * @protected
  429. */
  430. protected $subject = '';
  431. /**
  432. * Document author.
  433. * @protected
  434. */
  435. protected $author = '';
  436. /**
  437. * Document keywords.
  438. * @protected
  439. */
  440. protected $keywords = '';
  441. /**
  442. * Document creator.
  443. * @protected
  444. */
  445. protected $creator = '';
  446. /**
  447. * String alias for total number of pages.
  448. * @protected
  449. */
  450. protected $AliasNbPages = '{nb}';
  451. /**
  452. * String alias for page number.
  453. * @protected
  454. */
  455. protected $AliasNumPage = '{pnb}';
  456. /**
  457. * The right-bottom (or left-bottom for RTL) corner X coordinate of last inserted image.
  458. * @since 2002-07-31
  459. * @author Nicola Asuni
  460. * @protected
  461. */
  462. protected $img_rb_x;
  463. /**
  464. * The right-bottom corner Y coordinate of last inserted image.
  465. * @since 2002-07-31
  466. * @author Nicola Asuni
  467. * @protected
  468. */
  469. protected $img_rb_y;
  470. /**
  471. * Adjusting factor to convert pixels to user units.
  472. * @since 2004-06-14
  473. * @author Nicola Asuni
  474. * @protected
  475. */
  476. protected $imgscale = 1;
  477. /**
  478. * Boolean flag set to true when the input text is unicode (require unicode fonts).
  479. * @since 2005-01-02
  480. * @author Nicola Asuni
  481. * @protected
  482. */
  483. protected $isunicode = false;
  484. /**
  485. * Object containing unicode data.
  486. * @since 5.9.004 (2010-10-18)
  487. * @author Nicola Asuni
  488. * @protected
  489. */
  490. protected $unicode;
  491. /**
  492. * PDF version.
  493. * @since 1.5.3
  494. * @protected
  495. */
  496. protected $PDFVersion = '1.7';
  497. /**
  498. * Minimum distance between header and top page margin.
  499. * @protected
  500. */
  501. protected $header_margin;
  502. /**
  503. * Minimum distance between footer and bottom page margin.
  504. * @protected
  505. */
  506. protected $footer_margin;
  507. /**
  508. * Original left margin value.
  509. * @protected
  510. * @since 1.53.0.TC013
  511. */
  512. protected $original_lMargin;
  513. /**
  514. * Original right margin value.
  515. * @protected
  516. * @since 1.53.0.TC013
  517. */
  518. protected $original_rMargin;
  519. /**
  520. * Default font used on page header.
  521. * @protected
  522. */
  523. protected $header_font;
  524. /**
  525. * Default font used on page footer.
  526. * @protected
  527. */
  528. protected $footer_font;
  529. /**
  530. * Language templates.
  531. * @protected
  532. */
  533. protected $l;
  534. /**
  535. * Barcode to print on page footer (only if set).
  536. * @protected
  537. */
  538. protected $barcode = false;
  539. /**
  540. * Boolean flag to print/hide page header.
  541. * @protected
  542. */
  543. protected $print_header = true;
  544. /**
  545. * Boolean flag to print/hide page footer.
  546. * @protected
  547. */
  548. protected $print_footer = true;
  549. /**
  550. * Header image logo.
  551. * @protected
  552. */
  553. protected $header_logo = '';
  554. /**
  555. * Width of header image logo in user units.
  556. * @protected
  557. */
  558. protected $header_logo_width = 30;
  559. /**
  560. * Title to be printed on default page header.
  561. * @protected
  562. */
  563. protected $header_title = '';
  564. /**
  565. * String to pring on page header after title.
  566. * @protected
  567. */
  568. protected $header_string = '';
  569. /**
  570. * Default number of columns for html table.
  571. * @protected
  572. */
  573. protected $default_table_columns = 4;
  574. // variables for html parser
  575. /**
  576. * HTML PARSER: array to store current link and rendering styles.
  577. * @protected
  578. */
  579. protected $HREF = array();
  580. /**
  581. * List of available fonts on filesystem.
  582. * @protected
  583. */
  584. protected $fontlist = array();
  585. /**
  586. * Current foreground color.
  587. * @protected
  588. */
  589. protected $fgcolor;
  590. /**
  591. * HTML PARSER: array of boolean values, true in case of ordered list (OL), false otherwise.
  592. * @protected
  593. */
  594. protected $listordered = array();
  595. /**
  596. * HTML PARSER: array count list items on nested lists.
  597. * @protected
  598. */
  599. protected $listcount = array();
  600. /**
  601. * HTML PARSER: current list nesting level.
  602. * @protected
  603. */
  604. protected $listnum = 0;
  605. /**
  606. * HTML PARSER: indent amount for lists.
  607. * @protected
  608. */
  609. protected $listindent = 0;
  610. /**
  611. * HTML PARSER: current list indententation level.
  612. * @protected
  613. */
  614. protected $listindentlevel = 0;
  615. /**
  616. * Current background color.
  617. * @protected
  618. */
  619. protected $bgcolor;
  620. /**
  621. * Temporary font size in points.
  622. * @protected
  623. */
  624. protected $tempfontsize = 10;
  625. /**
  626. * Spacer string for LI tags.
  627. * @protected
  628. */
  629. protected $lispacer = '';
  630. /**
  631. * Default encoding.
  632. * @protected
  633. * @since 1.53.0.TC010
  634. */
  635. protected $encoding = 'UTF-8';
  636. /**
  637. * PHP internal encoding.
  638. * @protected
  639. * @since 1.53.0.TC016
  640. */
  641. protected $internal_encoding;
  642. /**
  643. * Boolean flag to indicate if the document language is Right-To-Left.
  644. * @protected
  645. * @since 2.0.000
  646. */
  647. protected $rtl = false;
  648. /**
  649. * Boolean flag used to force RTL or LTR string direction.
  650. * @protected
  651. * @since 2.0.000
  652. */
  653. protected $tmprtl = false;
  654. // --- Variables used for document encryption:
  655. /**
  656. * IBoolean flag indicating whether document is protected.
  657. * @protected
  658. * @since 2.0.000 (2008-01-02)
  659. */
  660. protected $encrypted;
  661. /**
  662. * Array containing encryption settings.
  663. * @protected
  664. * @since 5.0.005 (2010-05-11)
  665. */
  666. protected $encryptdata = array();
  667. /**
  668. * Last RC4 key encrypted (cached for optimisation).
  669. * @protected
  670. * @since 2.0.000 (2008-01-02)
  671. */
  672. protected $last_enc_key;
  673. /**
  674. * Last RC4 computed key.
  675. * @protected
  676. * @since 2.0.000 (2008-01-02)
  677. */
  678. protected $last_enc_key_c;
  679. /**
  680. * Encryption padding string.
  681. * @protected
  682. */
  683. protected $enc_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";
  684. /**
  685. * File ID (used on document trailer).
  686. * @protected
  687. * @since 5.0.005 (2010-05-12)
  688. */
  689. protected $file_id;
  690. // --- bookmark ---
  691. /**
  692. * Outlines for bookmark.
  693. * @protected
  694. * @since 2.1.002 (2008-02-12)
  695. */
  696. protected $outlines = array();
  697. /**
  698. * Outline root for bookmark.
  699. * @protected
  700. * @since 2.1.002 (2008-02-12)
  701. */
  702. protected $OutlineRoot;
  703. // --- javascript and form ---
  704. /**
  705. * Javascript code.
  706. * @protected
  707. * @since 2.1.002 (2008-02-12)
  708. */
  709. protected $javascript = '';
  710. /**
  711. * Javascript counter.
  712. * @protected
  713. * @since 2.1.002 (2008-02-12)
  714. */
  715. protected $n_js;
  716. /**
  717. * line trough state
  718. * @protected
  719. * @since 2.8.000 (2008-03-19)
  720. */
  721. protected $linethrough;
  722. /**
  723. * Array with additional document-wide usage rights for the document.
  724. * @protected
  725. * @since 5.8.014 (2010-08-23)
  726. */
  727. protected $ur = array();
  728. /**
  729. * DPI (Dot Per Inch) Document Resolution (do not change).
  730. * @protected
  731. * @since 3.0.000 (2008-03-27)
  732. */
  733. protected $dpi = 72;
  734. /**
  735. * Array of page numbers were a new page group was started.
  736. * @protected
  737. * @since 3.0.000 (2008-03-27)
  738. */
  739. protected $newpagegroup = array();
  740. /**
  741. * Contains the number of pages of the groups.
  742. * @protected
  743. * @since 3.0.000 (2008-03-27)
  744. */
  745. protected $pagegroups;
  746. /**
  747. * Contains the alias of the current page group.
  748. * @protected
  749. * @since 3.0.000 (2008-03-27)
  750. */
  751. protected $currpagegroup;
  752. /**
  753. * Restrict the rendering of some elements to screen or printout.
  754. * @protected
  755. * @since 3.0.000 (2008-03-27)
  756. */
  757. protected $visibility = 'all';
  758. /**
  759. * Print visibility.
  760. * @protected
  761. * @since 3.0.000 (2008-03-27)
  762. */
  763. protected $n_ocg_print;
  764. /**
  765. * View visibility.
  766. * @protected
  767. * @since 3.0.000 (2008-03-27)
  768. */
  769. protected $n_ocg_view;
  770. /**
  771. * Array of transparency objects and parameters.
  772. * @protected
  773. * @since 3.0.000 (2008-03-27)
  774. */
  775. protected $extgstates;
  776. /**
  777. * Set the default JPEG compression quality (1-100).
  778. * @protected
  779. * @since 3.0.000 (2008-03-27)
  780. */
  781. protected $jpeg_quality;
  782. /**
  783. * Default cell height ratio.
  784. * @protected
  785. * @since 3.0.014 (2008-05-23)
  786. */
  787. protected $cell_height_ratio = K_CELL_HEIGHT_RATIO;
  788. /**
  789. * PDF viewer preferences.
  790. * @protected
  791. * @since 3.1.000 (2008-06-09)
  792. */
  793. protected $viewer_preferences;
  794. /**
  795. * A name object specifying how the document should be displayed when opened.
  796. * @protected
  797. * @since 3.1.000 (2008-06-09)
  798. */
  799. protected $PageMode;
  800. /**
  801. * Array for storing gradient information.
  802. * @protected
  803. * @since 3.1.000 (2008-06-09)
  804. */
  805. protected $gradients = array();
  806. /**
  807. * Array used to store positions inside the pages buffer (keys are the page numbers).
  808. * @protected
  809. * @since 3.2.000 (2008-06-26)
  810. */
  811. protected $intmrk = array();
  812. /**
  813. * Array used to store positions inside the pages buffer (keys are the page numbers).
  814. * @protected
  815. * @since 5.7.000 (2010-08-03)
  816. */
  817. protected $bordermrk = array();
  818. /**
  819. * Array used to store page positions to track empty pages (keys are the page numbers).
  820. * @protected
  821. * @since 5.8.007 (2010-08-18)
  822. */
  823. protected $emptypagemrk = array();
  824. /**
  825. * Array used to store content positions inside the pages buffer (keys are the page numbers).
  826. * @protected
  827. * @since 4.6.021 (2009-07-20)
  828. */
  829. protected $cntmrk = array();
  830. /**
  831. * Array used to store footer positions of each page.
  832. * @protected
  833. * @since 3.2.000 (2008-07-01)
  834. */
  835. protected $footerpos = array();
  836. /**
  837. * Array used to store footer length of each page.
  838. * @protected
  839. * @since 4.0.014 (2008-07-29)
  840. */
  841. protected $footerlen = array();
  842. /**
  843. * Boolean flag to indicate if a new line is created.
  844. * @protected
  845. * @since 3.2.000 (2008-07-01)
  846. */
  847. protected $newline = true;
  848. /**
  849. * End position of the latest inserted line.
  850. * @protected
  851. * @since 3.2.000 (2008-07-01)
  852. */
  853. protected $endlinex = 0;
  854. /**
  855. * PDF string for width value of the last line.
  856. * @protected
  857. * @since 4.0.006 (2008-07-16)
  858. */
  859. protected $linestyleWidth = '';
  860. /**
  861. * PDF string for CAP value of the last line.
  862. * @protected
  863. * @since 4.0.006 (2008-07-16)
  864. */
  865. protected $linestyleCap = '0 J';
  866. /**
  867. * PDF string for join value of the last line.
  868. * @protected
  869. * @since 4.0.006 (2008-07-16)
  870. */
  871. protected $linestyleJoin = '0 j';
  872. /**
  873. * PDF string for dash value of the last line.
  874. * @protected
  875. * @since 4.0.006 (2008-07-16)
  876. */
  877. protected $linestyleDash = '[] 0 d';
  878. /**
  879. * Boolean flag to indicate if marked-content sequence is open.
  880. * @protected
  881. * @since 4.0.013 (2008-07-28)
  882. */
  883. protected $openMarkedContent = false;
  884. /**
  885. * Count the latest inserted vertical spaces on HTML.
  886. * @protected
  887. * @since 4.0.021 (2008-08-24)
  888. */
  889. protected $htmlvspace = 0;
  890. /**
  891. * Array of Spot colors.
  892. * @protected
  893. * @since 4.0.024 (2008-09-12)
  894. */
  895. protected $spot_colors = array();
  896. /**
  897. * Symbol used for HTML unordered list items.
  898. * @protected
  899. * @since 4.0.028 (2008-09-26)
  900. */
  901. protected $lisymbol = '';
  902. /**
  903. * String used to mark the beginning and end of EPS image blocks.
  904. * @protected
  905. * @since 4.1.000 (2008-10-18)
  906. */
  907. protected $epsmarker = 'x#!#EPS#!#x';
  908. /**
  909. * Array of transformation matrix.
  910. * @protected
  911. * @since 4.2.000 (2008-10-29)
  912. */
  913. protected $transfmatrix = array();
  914. /**
  915. * Current key for transformation matrix.
  916. * @protected
  917. * @since 4.8.005 (2009-09-17)
  918. */
  919. protected $transfmatrix_key = 0;
  920. /**
  921. * Booklet mode for double-sided pages.
  922. * @protected
  923. * @since 4.2.000 (2008-10-29)
  924. */
  925. protected $booklet = false;
  926. /**
  927. * Epsilon value used for float calculations.
  928. * @protected
  929. * @since 4.2.000 (2008-10-29)
  930. */
  931. protected $feps = 0.005;
  932. /**
  933. * Array used for custom vertical spaces for HTML tags.
  934. * @protected
  935. * @since 4.2.001 (2008-10-30)
  936. */
  937. protected $tagvspaces = array();
  938. /**
  939. * HTML PARSER: custom indent amount for lists. Negative value means disabled.
  940. * @protected
  941. * @since 4.2.007 (2008-11-12)
  942. */
  943. protected $customlistindent = -1;
  944. /**
  945. * Boolean flag to indicate if the border of the cell sides that cross the page should be removed.
  946. * @protected
  947. * @since 4.2.010 (2008-11-14)
  948. */
  949. protected $opencell = true;
  950. /**
  951. * Array of files to embedd.
  952. * @protected
  953. * @since 4.4.000 (2008-12-07)
  954. */
  955. protected $embeddedfiles = array();
  956. /**
  957. * Boolean flag to indicate if we are inside a PRE tag.
  958. * @protected
  959. * @since 4.4.001 (2008-12-08)
  960. */
  961. protected $premode = false;
  962. /**
  963. * Array used to store positions of graphics transformation blocks inside the page buffer.
  964. * keys are the page numbers
  965. * @protected
  966. * @since 4.4.002 (2008-12-09)
  967. */
  968. protected $transfmrk = array();
  969. /**
  970. * Default color for html links.
  971. * @protected
  972. * @since 4.4.003 (2008-12-09)
  973. */
  974. protected $htmlLinkColorArray = array(0, 0, 255);
  975. /**
  976. * Default font style to add to html links.
  977. * @protected
  978. * @since 4.4.003 (2008-12-09)
  979. */
  980. protected $htmlLinkFontStyle = 'U';
  981. /**
  982. * Counts the number of pages.
  983. * @protected
  984. * @since 4.5.000 (2008-12-31)
  985. */
  986. protected $numpages = 0;
  987. /**
  988. * Array containing page lengths in bytes.
  989. * @protected
  990. * @since 4.5.000 (2008-12-31)
  991. */
  992. protected $pagelen = array();
  993. /**
  994. * Counts the number of pages.
  995. * @protected
  996. * @since 4.5.000 (2008-12-31)
  997. */
  998. protected $numimages = 0;
  999. /**
  1000. * Store the image keys.
  1001. * @protected
  1002. * @since 4.5.000 (2008-12-31)
  1003. */
  1004. protected $imagekeys = array();
  1005. /**
  1006. * Length of the buffer in bytes.
  1007. * @protected
  1008. * @since 4.5.000 (2008-12-31)
  1009. */
  1010. protected $bufferlen = 0;
  1011. /**
  1012. * If true enables disk caching.
  1013. * @protected
  1014. * @since 4.5.000 (2008-12-31)
  1015. */
  1016. protected $diskcache = false;
  1017. /**
  1018. * Counts the number of fonts.
  1019. * @protected
  1020. * @since 4.5.000 (2009-01-02)
  1021. */
  1022. protected $numfonts = 0;
  1023. /**
  1024. * Store the font keys.
  1025. * @protected
  1026. * @since 4.5.000 (2009-01-02)
  1027. */
  1028. protected $fontkeys = array();
  1029. /**
  1030. * Store the font object IDs.
  1031. * @protected
  1032. * @since 4.8.001 (2009-09-09)
  1033. */
  1034. protected $font_obj_ids = array();
  1035. /**
  1036. * Store the fage status (true when opened, false when closed).
  1037. * @protected
  1038. * @since 4.5.000 (2009-01-02)
  1039. */
  1040. protected $pageopen = array();
  1041. /**
  1042. * Default monospace font.
  1043. * @protected
  1044. * @since 4.5.025 (2009-03-10)
  1045. */
  1046. protected $default_monospaced_font = 'courier';
  1047. /**
  1048. * Cloned copy of the current class object.
  1049. * @protected
  1050. * @since 4.5.029 (2009-03-19)
  1051. */
  1052. protected $objcopy;
  1053. /**
  1054. * Array used to store the lengths of cache files.
  1055. * @protected
  1056. * @since 4.5.029 (2009-03-19)
  1057. */
  1058. protected $cache_file_length = array();
  1059. /**
  1060. * Table header content to be repeated on each new page.
  1061. * @protected
  1062. * @since 4.5.030 (2009-03-20)
  1063. */
  1064. protected $thead = '';
  1065. /**
  1066. * Margins used for table header.
  1067. * @protected
  1068. * @since 4.5.030 (2009-03-20)
  1069. */
  1070. protected $theadMargins = array();
  1071. /**
  1072. * Cache array for UTF8StringToArray() method.
  1073. * @protected
  1074. * @since 4.5.037 (2009-04-07)
  1075. */
  1076. protected $cache_UTF8StringToArray = array();
  1077. /**
  1078. * Maximum size of cache array used for UTF8StringToArray() method.
  1079. * @protected
  1080. * @since 4.5.037 (2009-04-07)
  1081. */
  1082. protected $cache_maxsize_UTF8StringToArray = 8;
  1083. /**
  1084. * Current size of cache array used for UTF8StringToArray() method.
  1085. * @protected
  1086. * @since 4.5.037 (2009-04-07)
  1087. */
  1088. protected $cache_size_UTF8StringToArray = 0;
  1089. /**
  1090. * Boolean flag to enable document digital signature.
  1091. * @protected
  1092. * @since 4.6.005 (2009-04-24)
  1093. */
  1094. protected $sign = false;
  1095. /**
  1096. * Digital signature data.
  1097. * @protected
  1098. * @since 4.6.005 (2009-04-24)
  1099. */
  1100. protected $signature_data = array();
  1101. /**
  1102. * Digital signature max length.
  1103. * @protected
  1104. * @since 4.6.005 (2009-04-24)
  1105. */
  1106. protected $signature_max_length = 11742;
  1107. /**
  1108. * Data for digital signature appearance.
  1109. * @protected
  1110. * @since 5.3.011 (2010-06-16)
  1111. */
  1112. protected $signature_appearance = array('page' => 1, 'rect' => '0 0 0 0');
  1113. /**
  1114. * Regular expression used to find blank characters (required for word-wrapping).
  1115. * @protected
  1116. * @since 4.6.006 (2009-04-28)
  1117. */
  1118. protected $re_spaces = '/[^\S\xa0]/';
  1119. /**
  1120. * Array of $re_spaces parts.
  1121. * @protected
  1122. * @since 5.5.011 (2010-07-09)
  1123. */
  1124. protected $re_space = array('p' => '[^\S\xa0]', 'm' => '');
  1125. /**
  1126. * Digital signature object ID.
  1127. * @protected
  1128. * @since 4.6.022 (2009-06-23)
  1129. */
  1130. protected $sig_obj_id = 0;
  1131. /**
  1132. * ByteRange placemark used during digital signature process.
  1133. * @protected
  1134. * @since 4.6.028 (2009-08-25)
  1135. */
  1136. protected $byterange_string = '/ByteRange[0 ********** ********** **********]';
  1137. /**
  1138. * Placemark used during digital signature process.
  1139. * @protected
  1140. * @since 4.6.028 (2009-08-25)
  1141. */
  1142. protected $sig_annot_ref = '***SIGANNREF*** 0 R';
  1143. /**
  1144. * ID of page objects.
  1145. * @protected
  1146. * @since 4.7.000 (2009-08-29)
  1147. */
  1148. protected $page_obj_id = array();
  1149. /**
  1150. * List of form annotations IDs.
  1151. * @protected
  1152. * @since 4.8.000 (2009-09-07)
  1153. */
  1154. protected $form_obj_id = array();
  1155. /**
  1156. * Deafult Javascript field properties. Possible values are described on official Javascript for Acrobat API reference. Annotation options can be directly specified using the 'aopt' entry.
  1157. * @protected
  1158. * @since 4.8.000 (2009-09-07)
  1159. */
  1160. protected $default_form_prop = array('lineWidth'=>1, 'borderStyle'=>'solid', 'fillColor'=>array(255, 255, 255), 'strokeColor'=>array(128, 128, 128));
  1161. /**
  1162. * Javascript objects array.
  1163. * @protected
  1164. * @since 4.8.000 (2009-09-07)
  1165. */
  1166. protected $js_objects = array();
  1167. /**
  1168. * Current form action (used during XHTML rendering).
  1169. * @protected
  1170. * @since 4.8.000 (2009-09-07)
  1171. */
  1172. protected $form_action = '';
  1173. /**
  1174. * Current form encryption type (used during XHTML rendering).
  1175. * @protected
  1176. * @since 4.8.000 (2009-09-07)
  1177. */
  1178. protected $form_enctype = 'application/x-www-form-urlencoded';
  1179. /**
  1180. * Current method to submit forms.
  1181. * @protected
  1182. * @since 4.8.000 (2009-09-07)
  1183. */
  1184. protected $form_mode = 'post';
  1185. /**
  1186. * List of fonts used on form fields (fontname => fontkey).
  1187. * @protected
  1188. * @since 4.8.001 (2009-09-09)
  1189. */
  1190. protected $annotation_fonts = array();
  1191. /**
  1192. * List of radio buttons parent objects.
  1193. * @protected
  1194. * @since 4.8.001 (2009-09-09)
  1195. */
  1196. protected $radiobutton_groups = array();
  1197. /**
  1198. * List of radio group objects IDs.
  1199. * @protected
  1200. * @since 4.8.001 (2009-09-09)
  1201. */
  1202. protected $radio_groups = array();
  1203. /**
  1204. * Text indentation value (used for text-indent CSS attribute).
  1205. * @protected
  1206. * @since 4.8.006 (2009-09-23)
  1207. */
  1208. protected $textindent = 0;
  1209. /**
  1210. * Store page number when startTransaction() is called.
  1211. * @protected
  1212. * @since 4.8.006 (2009-09-23)
  1213. */
  1214. protected $start_transaction_page = 0;
  1215. /**
  1216. * Store Y position when startTransaction() is called.
  1217. * @protected
  1218. * @since 4.9.001 (2010-03-28)
  1219. */
  1220. protected $start_transaction_y = 0;
  1221. /**
  1222. * True when we are printing the thead section on a new page.
  1223. * @protected
  1224. * @since 4.8.027 (2010-01-25)
  1225. */
  1226. protected $inthead = false;
  1227. /**
  1228. * Array of column measures (width, space, starting Y position).
  1229. * @protected
  1230. * @since 4.9.001 (2010-03-28)
  1231. */
  1232. protected $columns = array();
  1233. /**
  1234. * Number of colums.
  1235. * @protected
  1236. * @since 4.9.001 (2010-03-28)
  1237. */
  1238. protected $num_columns = 1;
  1239. /**
  1240. * Current column number.
  1241. * @protected
  1242. * @since 4.9.001 (2010-03-28)
  1243. */
  1244. protected $current_column = 0;
  1245. /**
  1246. * Starting page for columns.
  1247. * @protected
  1248. * @since 4.9.001 (2010-03-28)
  1249. */
  1250. protected $column_start_page = 0;
  1251. /**
  1252. * Maximum page and column selected.
  1253. * @protected
  1254. * @since 5.8.000 (2010-08-11)
  1255. */
  1256. protected $maxselcol = array('page' => 0, 'column' => 0);
  1257. /**
  1258. * Array of: X difference between table cell x start and starting page margin, cellspacing, cellpadding.
  1259. * @protected
  1260. * @since 5.8.000 (2010-08-11)
  1261. */
  1262. protected $colxshift = array('x' => 0, 's' => array('H' => 0, 'V' => 0), 'p' => array('L' => 0, 'T' => 0, 'R' => 0, 'B' => 0));
  1263. /**
  1264. * Text rendering mode: 0 = Fill text; 1 = Stroke text; 2 = Fill, then stroke text; 3 = Neither fill nor stroke text (invisible); 4 = Fill text and add to path for clipping; 5 = Stroke text and add to path for clipping; 6 = Fill, then stroke text and add to path for clipping; 7 = Add text to path for clipping.
  1265. * @protected
  1266. * @since 4.9.008 (2010-04-03)
  1267. */
  1268. protected $textrendermode = 0;
  1269. /**
  1270. * Text stroke width in doc units.
  1271. * @protected
  1272. * @since 4.9.008 (2010-04-03)
  1273. */
  1274. protected $textstrokewidth = 0;
  1275. /**
  1276. * Current stroke color.
  1277. * @protected
  1278. * @since 4.9.008 (2010-04-03)
  1279. */
  1280. protected $strokecolor;
  1281. /**
  1282. * Default unit of measure for document.
  1283. * @protected
  1284. * @since 5.0.000 (2010-04-22)
  1285. */
  1286. protected $pdfunit = 'mm';
  1287. /**
  1288. * Boolean flag true when we are on TOC (Table Of Content) page.
  1289. * @protected
  1290. */
  1291. protected $tocpage = false;
  1292. /**
  1293. * Boolean flag: if true convert vector images (SVG, EPS) to raster image using GD or ImageMagick library.
  1294. * @protected
  1295. * @since 5.0.000 (2010-04-26)
  1296. */
  1297. protected $rasterize_vector_images = false;
  1298. /**
  1299. * Boolean flag: if true enables font subsetting by default.
  1300. * @protected
  1301. * @since 5.3.002 (2010-06-07)
  1302. */
  1303. protected $font_subsetting = true;
  1304. /**
  1305. * Array of default graphic settings.
  1306. * @protected
  1307. * @since 5.5.008 (2010-07-02)
  1308. */
  1309. protected $default_graphic_vars = array();
  1310. /**
  1311. * Array of XObjects.
  1312. * @protected
  1313. * @since 5.8.014 (2010-08-23)
  1314. */
  1315. protected $xobjects = array();
  1316. /**
  1317. * Boolean value true when we are inside an XObject.
  1318. * @protected
  1319. * @since 5.8.017 (2010-08-24)
  1320. */
  1321. protected $inxobj = false;
  1322. /**
  1323. * Current XObject ID.
  1324. * @protected
  1325. * @since 5.8.017 (2010-08-24)
  1326. */
  1327. protected $xobjid = '';
  1328. /**
  1329. * Percentage of character stretching.
  1330. * @protected
  1331. * @since 5.9.000 (2010-09-29)
  1332. */
  1333. protected $font_stretching = 100;
  1334. /**
  1335. * Increases or decreases the space between characters in a text by the specified amount (tracking/kerning).
  1336. * @protected
  1337. * @since 5.9.000 (2010-09-29)
  1338. */
  1339. protected $font_spacing = 0;
  1340. /**
  1341. * Array of no-write regions.
  1342. * ('page' => page number or empy for current page, 'xt' => X top, 'yt' => Y top, 'xb' => X bottom, 'yb' => Y bottom, 'side' => page side 'L' = left or 'R' = right)
  1343. * @protected
  1344. * @since 5.9.003 (2010-10-14)
  1345. */
  1346. protected $page_regions = array();
  1347. /**
  1348. * Array containing HTML color names and values.
  1349. * @protected
  1350. * @since 5.9.004 (2010-10-18)
  1351. */
  1352. protected $webcolor = array();
  1353. /**
  1354. * Array containing spot color names and values.
  1355. * @protected
  1356. * @since 5.9.012 (2010-11-11)
  1357. */
  1358. protected $spotcolor = array();
  1359. /**
  1360. * Directory used for the last SVG image.
  1361. * @protected
  1362. * @since 5.0.000 (2010-05-05)
  1363. */
  1364. protected $svgdir = '';
  1365. /**
  1366. * Deafult unit of measure for SVG.
  1367. * @protected
  1368. * @since 5.0.000 (2010-05-02)
  1369. */
  1370. protected $svgunit = 'px';
  1371. /**
  1372. * Array of SVG gradients.
  1373. * @protected
  1374. * @since 5.0.000 (2010-05-02)
  1375. */
  1376. protected $svggradients = array();
  1377. /**
  1378. * ID of last SVG gradient.
  1379. * @protected
  1380. * @since 5.0.000 (2010-05-02)
  1381. */
  1382. protected $svggradientid = 0;
  1383. /**
  1384. * Boolean value true when in SVG defs group.
  1385. * @protected
  1386. * @since 5.0.000 (2010-05-02)
  1387. */
  1388. protected $svgdefsmode = false;
  1389. /**
  1390. * Array of SVG defs.
  1391. * @protected
  1392. * @since 5.0.000 (2010-05-02)
  1393. */
  1394. protected $svgdefs = array();
  1395. /**
  1396. * Boolean value true when in SVG clipPath tag.
  1397. * @protected
  1398. * @since 5.0.000 (2010-04-26)
  1399. */
  1400. protected $svgclipmode = false;
  1401. /**
  1402. * Array of SVG clipPath commands.
  1403. * @protected
  1404. * @since 5.0.000 (2010-05-02)
  1405. */
  1406. protected $svgclippaths = array();
  1407. /**
  1408. * Array of SVG clipPath tranformation matrix.
  1409. * @protected
  1410. * @since 5.8.022 (2010-08-31)
  1411. */
  1412. protected $svgcliptm = array();
  1413. /**
  1414. * ID of last SVG clipPath.
  1415. * @protected
  1416. * @since 5.0.000 (2010-05-02)
  1417. */
  1418. protected $svgclipid = 0;
  1419. /**
  1420. * SVG text.
  1421. * @protected
  1422. * @since 5.0.000 (2010-05-02)
  1423. */
  1424. protected $svgtext = '';
  1425. /**
  1426. * SVG text properties.
  1427. * @protected
  1428. * @since 5.8.013 (2010-08-23)
  1429. */
  1430. protected $svgtextmode = array();
  1431. /**
  1432. * Array of hinheritable SVG properties.
  1433. * @protected
  1434. * @since 5.0.000 (2010-05-02)
  1435. */
  1436. protected $svginheritprop = array('clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cursor', 'direction', 'fill', 'fill-opacity', 'fill-rule', 'font', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'glyph-orientation-horizontal', 'glyph-orientation-vertical', 'image-rendering', 'kerning', 'letter-spacing', 'marker', 'marker-end', 'marker-mid', 'marker-start', 'pointer-events', 'shape-rendering', 'stroke', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke-width', 'text-anchor', 'text-rendering', 'visibility', 'word-spacing', 'writing-mode');
  1437. /**
  1438. * Array of SVG properties.
  1439. * @protected
  1440. * @since 5.0.000 (2010-05-02)
  1441. */
  1442. protected $svgstyles = array(array(
  1443. 'alignment-baseline' => 'auto',
  1444. 'baseline-shift' => 'baseline',
  1445. 'clip' => 'auto',
  1446. 'clip-path' => 'none',
  1447. 'clip-rule' => 'nonzero',
  1448. 'color' => 'black',
  1449. 'color-interpolation' => 'sRGB',
  1450. 'color-interpolation-filters' => 'linearRGB',
  1451. 'color-profile' => 'auto',
  1452. 'color-rendering' => 'auto',
  1453. 'cursor' => 'auto',
  1454. 'direction' => 'ltr',
  1455. 'display' => 'inline',
  1456. 'dominant-baseline' => 'auto',
  1457. 'enable-background' => 'accumulate',
  1458. 'fill' => 'black',
  1459. 'fill-opacity' => 1,
  1460. 'fill-rule' => 'nonzero',
  1461. 'filter' => 'none',
  1462. 'flood-color' => 'black',
  1463. 'flood-opacity' => 1,
  1464. 'font' => '',
  1465. 'font-family' => 'helvetica',
  1466. 'font-size' => 'medium',
  1467. 'font-size-adjust' => 'none',
  1468. 'font-stretch' => 'normal',
  1469. 'font-style' => 'normal',
  1470. 'font-variant' => 'normal',
  1471. 'font-weight' => 'normal',
  1472. 'glyph-orientation-horizontal' => '0deg',
  1473. 'glyph-orientation-vertical' => 'auto',
  1474. 'image-rendering' => 'auto',
  1475. 'kerning' => 'auto',
  1476. 'letter-spacing' => 'normal',
  1477. 'lighting-color' => 'white',
  1478. 'marker' => '',
  1479. 'marker-end' => 'none',
  1480. 'marker-mid' => 'none',
  1481. 'marker-start' => 'none',
  1482. 'mask' => 'none',
  1483. 'opacity' => 1,
  1484. 'overflow' => 'auto',
  1485. 'pointer-events' => 'visiblePainted',
  1486. 'shape-rendering' => 'auto',
  1487. 'stop-color' => 'black',
  1488. 'stop-opacity' => 1,
  1489. 'stroke' => 'none',
  1490. 'stroke-dasharray' => 'none',
  1491. 'stroke-dashoffset' => 0,
  1492. 'stroke-linecap' => 'butt',
  1493. 'stroke-linejoin' => 'miter',
  1494. 'stroke-miterlimit' => 4,
  1495. 'stroke-opacity' => 1,
  1496. 'stroke-width' => 1,
  1497. 'text-anchor' => 'start',
  1498. 'text-decoration' => 'none',
  1499. 'text-rendering' => 'auto',
  1500. 'unicode-bidi' => 'normal',
  1501. 'visibility' => 'visible',
  1502. 'word-spacing' => 'normal',
  1503. 'writing-mode' => 'lr-tb',
  1504. 'text-color' => 'black',
  1505. 'transfmatrix' => array(1, 0, 0, 1, 0, 0)
  1506. ));
  1507. //------------------------------------------------------------
  1508. // METHODS
  1509. //------------------------------------------------------------
  1510. /**
  1511. * This is the class constructor.
  1512. * It allows to set up the page format, the orientation and the measure unit used in all the methods (except for the font sizes).
  1513. * @param $orientation (string) page orientation. Possible values are (case insensitive):<ul><li>P or Portrait (default)</li><li>L or Landscape</li><li>'' (empty string) for automatic orientation</li></ul>
  1514. * @param $unit (string) 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.
  1515. * @param $format (mixed) The format used for pages. It can be either: one of the string values specified at getPageSizeFromFormat() or an array of parameters specified at setPageFormat().
  1516. * @param $unicode (boolean) TRUE means that the input text is unicode (default = true)
  1517. * @param $diskcache (boolean) if TRUE reduce the RAM memory usage by caching temporary data on filesystem (slower).
  1518. * @param $encoding (string) charset encoding; default is UTF-8
  1519. * @public
  1520. * @see getPageSizeFromFormat(), setPageFormat()
  1521. */
  1522. public function __construct($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding='UTF-8', $diskcache=false) {
  1523. /* Set internal character encoding to ASCII */
  1524. if (function_exists('mb_internal_encoding') AND mb_internal_encoding()) {
  1525. $this->internal_encoding = mb_internal_encoding();
  1526. mb_internal_encoding('ASCII');
  1527. }
  1528. // get array of HTML colors
  1529. require(dirname(__FILE__).'/htmlcolors.php');
  1530. $this->webcolor = $webcolor;
  1531. // get array of custom spot colors
  1532. if (file_exists(dirname(__FILE__).'/spotcolors.php')) {
  1533. require(dirname(__FILE__).'/spotcolors.php');
  1534. $this->spotcolor = $spotcolor;
  1535. } else {
  1536. $this->spotcolor = array();
  1537. }
  1538. require_once(dirname(__FILE__).'/unicode_data.php');
  1539. $this->unicode = new TCPDF_UNICODE_DATA();
  1540. $this->font_obj_ids = array();
  1541. $this->page_obj_id = array();
  1542. $this->form_obj_id = array();
  1543. // set disk caching
  1544. $this->diskcache = $diskcache ? true : false;
  1545. // set language direction
  1546. $this->rtl = false;
  1547. $this->tmprtl = false;
  1548. // some checks
  1549. $this->_dochecks();
  1550. // initialization of properties
  1551. $this->isunicode = $unicode;
  1552. $this->page = 0;
  1553. $this->transfmrk[0] = array();
  1554. $this->pagedim = array();
  1555. $this->n = 2;
  1556. $this->buffer = '';
  1557. $this->pages = array();
  1558. $this->state = 0;
  1559. $this->fonts = array();
  1560. $this->FontFiles = array();
  1561. $this->diffs = array();
  1562. $this->images = array();
  1563. $this->links = array();
  1564. $this->gradients = array();
  1565. $this->InFooter = false;
  1566. $this->lasth = 0;
  1567. $this->FontFamily = 'helvetica';
  1568. $this->FontStyle = '';
  1569. $this->FontSizePt = 12;
  1570. $this->underline = false;
  1571. $this->overline = false;
  1572. $this->linethrough = false;
  1573. $this->DrawColor = '0 G';
  1574. $this->FillColor = '0 g';
  1575. $this->TextColor = '0 g';
  1576. $this->ColorFlag = false;
  1577. // encryption values
  1578. $this->encrypted = false;
  1579. $this->last_enc_key = '';
  1580. // standard Unicode fonts
  1581. $this->CoreFonts = array(
  1582. 'courier'=>'Courier',
  1583. 'courierB'=>'Courier-Bold',
  1584. 'courierI'=>'Courier-Oblique',
  1585. 'courierBI'=>'Courier-BoldOblique',
  1586. 'helvetica'=>'Helvetica',
  1587. 'helveticaB'=>'Helvetica-Bold',
  1588. 'helveticaI'=>'Helvetica-Oblique',
  1589. 'helveticaBI'=>'Helvetica-BoldOblique',
  1590. 'times'=>'Times-Roman',
  1591. 'timesB'=>'Times-Bold',
  1592. 'timesI'=>'Times-Italic',
  1593. 'timesBI'=>'Times-BoldItalic',
  1594. 'symbol'=>'Symbol',
  1595. 'zapfdingbats'=>'ZapfDingbats'
  1596. );
  1597. // set scale factor
  1598. $this->setPageUnit($unit);
  1599. // set page format and orientation
  1600. $this->setPageFormat($format, $orientation);
  1601. // page margins (1 cm)
  1602. $margin = 28.35 / $this->k;
  1603. $this->SetMargins($margin, $margin);
  1604. // internal cell padding
  1605. $cpadding = $margin / 10;
  1606. $this->setCellPaddings($cpadding, 0, $cpadding, 0);
  1607. // cell margins
  1608. $this->setCellMargins(0, 0, 0, 0);
  1609. // line width (0.2 mm)
  1610. $this->LineWidth = 0.57 / $this->k;
  1611. $this->linestyleWidth = sprintf('%.2F w', ($this->LineWidth * $this->k));
  1612. $this->linestyleCap = '0 J';
  1613. $this->linestyleJoin = '0 j';
  1614. $this->linestyleDash = '[] 0 d';
  1615. // automatic page break
  1616. $this->SetAutoPageBreak(true, (2 * $margin));
  1617. // full width display mode
  1618. $this->SetDisplayMode('fullwidth');
  1619. // compression
  1620. $this->SetCompression(true);
  1621. // set default PDF version number
  1622. $this->PDFVersion = '1.7';
  1623. $this->encoding = $encoding;
  1624. $this->HREF = array();
  1625. $this->getFontsList();
  1626. $this->fgcolor = array('R' => 0, 'G' => 0, 'B' => 0);
  1627. $this->strokecolor = array('R' => 0, 'G' => 0, 'B' => 0);
  1628. $this->bgcolor = array('R' => 255, 'G' => 255, 'B' => 255);
  1629. $this->extgstates = array();
  1630. // user's rights
  1631. $this->sign = false;
  1632. $this->ur['enabled'] = false;
  1633. $this->ur['document'] = '/FullSave';
  1634. $this->ur['annots'] = '/Create/Delete/Modify/Copy/Import/Export';
  1635. $this->ur['form'] = '…

Large files files are truncated, but you can click here to view the full file