PageRenderTime 103ms CodeModel.GetById 47ms RepoModel.GetById 0ms app.codeStats 3ms

/common/libraries/plugin/phpexcel/PHPExcel/Shared/PDF/tcpdf.php

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

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