PageRenderTime 67ms CodeModel.GetById 26ms RepoModel.GetById 1ms app.codeStats 2ms

/include/html2pdf/_tcpdf/tcpdf.php

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

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