146 require_once(dirname(__FILE__).
'/config/tcpdf_config.php');
 
  165      private $tcpdf_version = 
'5.9.202';
 
  319      protected $cell_margin = array(
'T' => 0, 
'R' => 0, 
'B' => 0, 
'L' => 0);
 
  767      protected $txtshadow = array(
'enabled'=>
false, 
'depth_w'=>0, 
'depth_h'=>0, 
'color'=>
false, 
'opacity'=>1, 
'blend_mode'=>
'Normal');
 
  905      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";
 
 1449      protected $default_form_prop = array(
'lineWidth'=>1, 
'borderStyle'=>
'solid', 
'fillColor'=>array(255, 255, 255), 
'strokeColor'=>array(128, 128, 128));
 
 1568      protected $colxshift = array(
'x' => 0, 
's' => array(
'H' => 0, 
'V' => 0), 
'p' => array(
'L' => 0, 
'T' => 0, 
'R' => 0, 
'B' => 0));
 
 1798      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');
 
 1806           'alignment-baseline' => 
'auto',
 
 1807           'baseline-shift' => 
'baseline',
 
 1809           'clip-path' => 
'none',
 
 1810           'clip-rule' => 
'nonzero',
 
 1812           'color-interpolation' => 
'sRGB',
 
 1813           'color-interpolation-filters' => 
'linearRGB',
 
 1814           'color-profile' => 
'auto',
 
 1815           'color-rendering' => 
'auto',
 
 1817           'direction' => 
'ltr',
 
 1818           'display' => 
'inline',
 
 1819           'dominant-baseline' => 
'auto',
 
 1820           'enable-background' => 
'accumulate',
 
 1822           'fill-opacity' => 1,
 
 1823           'fill-rule' => 
'nonzero',
 
 1825           'flood-color' => 
'black',
 
 1826           'flood-opacity' => 1,
 
 1828           'font-family' => 
'helvetica',
 
 1829           'font-size' => 
'medium',
 
 1830           'font-size-adjust' => 
'none',
 
 1831           'font-stretch' => 
'normal',
 
 1832           'font-style' => 
'normal',
 
 1833           'font-variant' => 
'normal',
 
 1834           'font-weight' => 
'normal',
 
 1835           'glyph-orientation-horizontal' => 
'0deg',
 
 1836           'glyph-orientation-vertical' => 
'auto',
 
 1837           'image-rendering' => 
'auto',
 
 1838           'kerning' => 
'auto',
 
 1839           'letter-spacing' => 
'normal',
 
 1840           'lighting-color' => 
'white',
 
 1842           'marker-end' => 
'none',
 
 1843           'marker-mid' => 
'none',
 
 1844           'marker-start' => 
'none',
 
 1847           'overflow' => 
'auto',
 
 1848           'pointer-events' => 
'visiblePainted',
 
 1849           'shape-rendering' => 
'auto',
 
 1850           'stop-color' => 
'black',
 
 1851           'stop-opacity' => 1,
 
 1853           'stroke-dasharray' => 
'none',
 
 1854           'stroke-dashoffset' => 0,
 
 1855           'stroke-linecap' => 
'butt',
 
 1856           'stroke-linejoin' => 
'miter',
 
 1857           'stroke-miterlimit' => 4,
 
 1858           'stroke-opacity' => 1,
 
 1859           'stroke-width' => 1,
 
 1860           'text-anchor' => 
'start',
 
 1861           'text-decoration' => 
'none',
 
 1862           'text-rendering' => 
'auto',
 
 1863           'unicode-bidi' => 
'normal',
 
 1864           'visibility' => 
'visible',
 
 1865           'word-spacing' => 
'normal',
 
 1866           'writing-mode' => 
'lr-tb',
 
 1867           'text-color' => 
'black',
 
 1868           'transfmatrix' => array(1, 0, 0, 1, 0, 0)
 
 1912      protected $overprint = array(
'OP' => 
false, 
'op' => 
false, 
'OPM' => 0);
 
 1920      protected $alpha = array(
'CA' => 1, 
'ca' => 1, 
'BM' => 
'/Normal', 
'AIS' => 
false);
 
 1927      protected $page_boxes = array(
'MediaBox', 
'CropBox', 
'BleedBox', 
'TrimBox', 
'ArtBox');
 
 1969           if (function_exists(
'mb_internal_encoding') AND mb_internal_encoding()) {
 
 1970                $this->internal_encoding = mb_internal_encoding();
 
 1974           require(dirname(__FILE__).
'/htmlcolors.php');
 
 1977           if (file_exists(dirname(__FILE__).
'/spotcolors.php')) {
 
 1978                require(dirname(__FILE__).
'/spotcolors.php');
 
 1981                $this->spotcolor = array();
 
 1983           require_once(dirname(__FILE__).
'/unicode_data.php');
 
 1985           require_once(dirname(__FILE__).
'/encodings_maps.php');
 
 1987           $this->font_obj_ids = array();
 
 1988           $this->page_obj_id = array();
 
 1989           $this->form_obj_id = array();
 
 1991           $this->pdfa_mode = $pdfa;
 
 1992           $this->force_srgb = 
false;
 
 1994           $this->diskcache = 
$diskcache ? 
true : 
false;
 
 1997           $this->tmprtl = 
false;
 
 2003           $this->transfmrk[0] = array();
 
 2004           $this->pagedim = array();
 
 2007           $this->pages = array();
 
 2009           $this->fonts = array();
 
 2010           $this->FontFiles = array();
 
 2011           $this->diffs = array();
 
 2012           $this->images = array();
 
 2013           $this->links = array();
 
 2014           $this->gradients = array();
 
 2015           $this->InFooter = 
false;
 
 2018           $this->FontStyle = 
'';
 
 2019           $this->FontSizePt = 12;
 
 2020           $this->underline = 
false;
 
 2021           $this->overline = 
false;
 
 2022           $this->linethrough = 
false;
 
 2023           $this->DrawColor = 
'0 G';
 
 2024           $this->FillColor = 
'0 g';
 
 2025           $this->TextColor = 
'0 g';
 
 2026           $this->ColorFlag = 
false;
 
 2027           $this->pdflayers = array();
 
 2029           $this->encrypted = 
false;
 
 2030           $this->last_enc_key = 
'';
 
 2032           $this->CoreFonts = array(
 
 2033                'courier'=>
'Courier',
 
 2034                'courierB'=>
'Courier-Bold',
 
 2035                'courierI'=>
'Courier-Oblique',
 
 2036                'courierBI'=>
'Courier-BoldOblique',
 
 2037                'helvetica'=>
'Helvetica',
 
 2038                'helveticaB'=>
'Helvetica-Bold',
 
 2039                'helveticaI'=>
'Helvetica-Oblique',
 
 2040                'helveticaBI'=>
'Helvetica-BoldOblique',
 
 2041                'times'=>
'Times-Roman',
 
 2042                'timesB'=>
'Times-Bold',
 
 2043                'timesI'=>
'Times-Italic',
 
 2044                'timesBI'=>
'Times-BoldItalic',
 
 2046                'zapfdingbats'=>
'ZapfDingbats' 
 2058           $cpadding = $margin / 10;
 
 2063           $this->LineWidth = 0.57 / 
$this->k;
 
 2064           $this->linestyleWidth = sprintf(
'%F w', ($this->LineWidth * $this->k));
 
 2065           $this->linestyleCap = 
'0 J';
 
 2066           $this->linestyleJoin = 
'0 j';
 
 2067           $this->linestyleDash = 
'[] 0 d';
 
 2076           $this->pdfproducer = 
"\x54\x43\x50\x44\x46\x20".$this->tcpdf_version.
"\x20\x28\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29";
 
 2077           $this->tcpdflink = 
true;
 
 2079           $this->HREF = array();
 
 2081           $this->fgcolor = array(
'R' => 0, 
'G' => 0, 
'B' => 0);
 
 2082           $this->strokecolor = array(
'R' => 0, 
'G' => 0, 
'B' => 0);
 
 2083           $this->bgcolor = array(
'R' => 255, 
'G' => 255, 
'B' => 255);
 
 2084           $this->extgstates = array();
 
 2087           $this->sign = 
false;
 
 2088           $this->ur[
'enabled'] = 
false;
 
 2089           $this->ur[
'document'] = 
'/FullSave';
 
 2090           $this->ur[
'annots'] = 
'/Create/Delete/Modify/Copy/Import/Export';
 
 2091           $this->ur[
'form'] = 
'/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate';
 
 2092           $this->ur[
'signature'] = 
'/Modify';
 
 2093           $this->ur[
'ef'] = 
'/Create/Delete/Modify/Import';
 
 2094           $this->ur[
'formex'] = 
'';
 
 2095           $this->signature_appearance = array(
'page' => 1, 
'rect' => 
'0 0 0 0');
 
 2096           $this->empty_signature_appearance = array();
 
 2098           $this->jpeg_quality = 
$GLOBALS[
'site_parameters'][
'jpeg_quality'];
 
 2102           $this->
SetFont($this->FontFamily, $this->FontStyle, $this->FontSizePt);
 
 2104           if ($this->isunicode AND (@preg_match(
'/\pL/u', 
'a') == 1)) {
 
 2115           $this->default_form_prop = array(
'lineWidth'=>1, 
'borderStyle'=>
'solid', 
'fillColor'=>array(255, 255, 255), 
'strokeColor'=>array(128, 128, 128));
 
 2117           $serformat = (is_array($format) ? serialize($format) : $format);
 
 2118           $this->file_id = md5($this->
getRandomSeed(
'TCPDF'.$orientation.$unit.$serformat.$encoding));
 
 2120           $this->doc_creation_timestamp = time();
 
 2124           $this->header_xobj_autoreset = 
false;
 
 2125           $this->custom_xmp = 
'';
 
 2135           if (isset($this->internal_encoding) AND !empty($this->internal_encoding)) {
 
 2136                mb_internal_encoding($this->internal_encoding);
 
 2149           return $this->tcpdf_version;
 
 2159           $unit = strtolower($unit);
 
 2170                     $this->k = $this->dpi / 25.4;
 
 2175                     $this->k = $this->dpi / 2.54;
 
 2185                     $this->
Error(
'Incorrect unit: '.$unit);
 
 2189           $this->pdfunit = $unit;
 
 2190           if (isset($this->CurOrientation)) {
 
 2511           switch (strtoupper($format)) {
 
 2513                case 'A0' : {$pf = array( 2383.937, 3370.394); 
break;}
 
 2514                case 'A1' : {$pf = array( 1683.780, 2383.937); 
break;}
 
 2515                case 'A2' : {$pf = array( 1190.551, 1683.780); 
break;}
 
 2516                case 'A3' : {$pf = array(  841.890, 1190.551); 
break;}
 
 2517                case 'A4' : {$pf = array(  595.276,  841.890); 
break;}
 
 2518                case 'A5' : {$pf = array(  419.528,  595.276); 
break;}
 
 2519                case 'A6' : {$pf = array(  297.638,  419.528); 
break;}
 
 2520                case 'A7' : {$pf = array(  209.764,  297.638); 
break;}
 
 2521                case 'A8' : {$pf = array(  147.402,  209.764); 
break;}
 
 2522                case 'A9' : {$pf = array(  104.882,  147.402); 
break;}
 
 2523                case 'A10': {$pf = array(   73.701,  104.882); 
break;}
 
 2524                case 'A11': {$pf = array(   51.024,   73.701); 
break;}
 
 2525                case 'A12': {$pf = array(   36.850,   51.024); 
break;}
 
 2527                case 'B0' : {$pf = array( 2834.646, 4008.189); 
break;}
 
 2528                case 'B1' : {$pf = array( 2004.094, 2834.646); 
break;}
 
 2529                case 'B2' : {$pf = array( 1417.323, 2004.094); 
break;}
 
 2530                case 'B3' : {$pf = array( 1000.630, 1417.323); 
break;}
 
 2531                case 'B4' : {$pf = array(  708.661, 1000.630); 
break;}
 
 2532                case 'B5' : {$pf = array(  498.898,  708.661); 
break;}
 
 2533                case 'B6' : {$pf = array(  354.331,  498.898); 
break;}
 
 2534                case 'B7' : {$pf = array(  249.449,  354.331); 
break;}
 
 2535                case 'B8' : {$pf = array(  175.748,  249.449); 
break;}
 
 2536                case 'B9' : {$pf = array(  124.724,  175.748); 
break;}
 
 2537                case 'B10': {$pf = array(   87.874,  124.724); 
break;}
 
 2538                case 'B11': {$pf = array(   62.362,   87.874); 
break;}
 
 2539                case 'B12': {$pf = array(   42.520,   62.362); 
break;}
 
 2541                case 'C0' : {$pf = array( 2599.370, 3676.535); 
break;}
 
 2542                case 'C1' : {$pf = array( 1836.850, 2599.370); 
break;}
 
 2543                case 'C2' : {$pf = array( 1298.268, 1836.850); 
break;}
 
 2544                case 'C3' : {$pf = array(  918.425, 1298.268); 
break;}
 
 2545                case 'C4' : {$pf = array(  649.134,  918.425); 
break;}
 
 2546                case 'C5' : {$pf = array(  459.213,  649.134); 
break;}
 
 2547                case 'C6' : {$pf = array(  323.150,  459.213); 
break;}
 
 2548                case 'C7' : {$pf = array(  229.606,  323.150); 
break;}
 
 2549                case 'C8' : {$pf = array(  161.575,  229.606); 
break;}
 
 2550                case 'C9' : {$pf = array(  113.386,  161.575); 
break;}
 
 2551                case 'C10': {$pf = array(   79.370,  113.386); 
break;}
 
 2552                case 'C11': {$pf = array(   56.693,   79.370); 
break;}
 
 2553                case 'C12': {$pf = array(   39.685,   56.693); 
break;}
 
 2554                case 'C76': {$pf = array(  229.606,  459.213); 
break;}
 
 2555                case 'DL' : {$pf = array(  311.811,  623.622); 
break;}
 
 2557                case 'E0' : {$pf = array( 2491.654, 3517.795); 
break;}
 
 2558                case 'E1' : {$pf = array( 1757.480, 2491.654); 
break;}
 
 2559                case 'E2' : {$pf = array( 1247.244, 1757.480); 
break;}
 
 2560                case 'E3' : {$pf = array(  878.740, 1247.244); 
break;}
 
 2561                case 'E4' : {$pf = array(  623.622,  878.740); 
break;}
 
 2562                case 'E5' : {$pf = array(  439.370,  623.622); 
break;}
 
 2563                case 'E6' : {$pf = array(  311.811,  439.370); 
break;}
 
 2564                case 'E7' : {$pf = array(  221.102,  311.811); 
break;}
 
 2565                case 'E8' : {$pf = array(  155.906,  221.102); 
break;}
 
 2566                case 'E9' : {$pf = array(  110.551,  155.906); 
break;}
 
 2567                case 'E10': {$pf = array(   76.535,  110.551); 
break;}
 
 2568                case 'E11': {$pf = array(   53.858,   76.535); 
break;}
 
 2569                case 'E12': {$pf = array(   36.850,   53.858); 
break;}
 
 2571                case 'G0' : {$pf = array( 2715.591, 3838.110); 
break;}
 
 2572                case 'G1' : {$pf = array( 1919.055, 2715.591); 
break;}
 
 2573                case 'G2' : {$pf = array( 1357.795, 1919.055); 
break;}
 
 2574                case 'G3' : {$pf = array(  958.110, 1357.795); 
break;}
 
 2575                case 'G4' : {$pf = array(  677.480,  958.110); 
break;}
 
 2576                case 'G5' : {$pf = array(  479.055,  677.480); 
break;}
 
 2577                case 'G6' : {$pf = array(  337.323,  479.055); 
break;}
 
 2578                case 'G7' : {$pf = array(  238.110,  337.323); 
break;}
 
 2579                case 'G8' : {$pf = array(  167.244,  238.110); 
break;}
 
 2580                case 'G9' : {$pf = array(  119.055,  167.244); 
break;}
 
 2581                case 'G10': {$pf = array(   82.205,  119.055); 
break;}
 
 2582                case 'G11': {$pf = array(   59.528,   82.205); 
break;}
 
 2583                case 'G12': {$pf = array(   39.685,   59.528); 
break;}
 
 2585                case 'RA0': {$pf = array( 2437.795, 3458.268); 
break;}
 
 2586                case 'RA1': {$pf = array( 1729.134, 2437.795); 
break;}
 
 2587                case 'RA2': {$pf = array( 1218.898, 1729.134); 
break;}
 
 2588                case 'RA3': {$pf = array(  864.567, 1218.898); 
break;}
 
 2589                case 'RA4': {$pf = array(  609.449,  864.567); 
break;}
 
 2590                case 'SRA0': {$pf = array( 2551.181, 3628.346); 
break;}
 
 2591                case 'SRA1': {$pf = array( 1814.173, 2551.181); 
break;}
 
 2592                case 'SRA2': {$pf = array( 1275.591, 1814.173); 
break;}
 
 2593                case 'SRA3': {$pf = array(  907.087, 1275.591); 
break;}
 
 2594                case 'SRA4': {$pf = array(  637.795,  907.087); 
break;}
 
 2596                case '4A0': {$pf = array( 4767.874, 6740.787); 
break;}
 
 2597                case '2A0': {$pf = array( 3370.394, 4767.874); 
break;}
 
 2599                case 'A2_EXTRA'   : {$pf = array( 1261.417, 1754.646); 
break;}
 
 2600                case 'A3+'        : {$pf = array(  932.598, 1369.134); 
break;}
 
 2601                case 'A3_EXTRA'   : {$pf = array(  912.756, 1261.417); 
break;}
 
 2602                case 'A3_SUPER'   : {$pf = array(  864.567, 1440.000); 
break;}
 
 2603                case 'SUPER_A3'   : {$pf = array(  864.567, 1380.472); 
break;}
 
 2604                case 'A4_EXTRA'   : {$pf = array(  666.142,  912.756); 
break;}
 
 2605                case 'A4_SUPER'   : {$pf = array(  649.134,  912.756); 
break;}
 
 2606                case 'SUPER_A4'   : {$pf = array(  643.465, 1009.134); 
break;}
 
 2607                case 'A4_LONG'    : {$pf = array(  595.276,  986.457); 
break;}
 
 2608                case 'F4'         : {$pf = array(  595.276,  935.433); 
break;}
 
 2609                case 'SO_B5_EXTRA': {$pf = array(  572.598,  782.362); 
break;}
 
 2610                case 'A5_EXTRA'   : {$pf = array(  490.394,  666.142); 
break;}
 
 2612                case 'ANSI_E': {$pf = array( 2448.000, 3168.000); 
break;}
 
 2613                case 'ANSI_D': {$pf = array( 1584.000, 2448.000); 
break;}
 
 2614                case 'ANSI_C': {$pf = array( 1224.000, 1584.000); 
break;}
 
 2615                case 'ANSI_B': {$pf = array(  792.000, 1224.000); 
break;}
 
 2616                case 'ANSI_A': {$pf = array(  612.000,  792.000); 
break;}
 
 2619                case 'LEDGER' : {$pf = array( 1224.000,  792.000); 
break;}
 
 2623                case 'TABLOID': {$pf = array(  792.000, 1224.000); 
break;}
 
 2626                case 'LETTER' : {$pf = array(  612.000,  792.000); 
break;}
 
 2628                case 'LEGAL'  : {$pf = array(  612.000, 1008.000); 
break;}
 
 2629                case 'GOVERNMENTLETTER':
 
 2630                case 'GLETTER': {$pf = array(  576.000,  756.000); 
break;}
 
 2632                case 'JLEGAL' : {$pf = array(  576.000,  360.000); 
break;}
 
 2634                case 'QUADDEMY': {$pf = array( 2520.000, 3240.000); 
break;}
 
 2635                case 'SUPER_B': {$pf = array(  936.000, 1368.000); 
break;}
 
 2636                case 'QUARTO': {$pf = array(  648.000,  792.000); 
break;}
 
 2637                case 'GOVERNMENTLEGAL':
 
 2638                case 'FOLIO': {$pf = array(  612.000,  936.000); 
break;}
 
 2640                case 'EXECUTIVE': {$pf = array(  522.000,  756.000); 
break;}
 
 2643                case 'MEMO': {$pf = array(  396.000,  612.000); 
break;}
 
 2644                case 'FOOLSCAP': {$pf = array(  595.440,  936.000); 
break;}
 
 2645                case 'COMPACT': {$pf = array(  306.000,  486.000); 
break;}
 
 2646                case 'ORGANIZERJ': {$pf = array(  198.000,  360.000); 
break;}
 
 2648                case 'P1': {$pf = array( 1587.402, 2437.795); 
break;}
 
 2649                case 'P2': {$pf = array( 1218.898, 1587.402); 
break;}
 
 2650                case 'P3': {$pf = array(  793.701, 1218.898); 
break;}
 
 2651                case 'P4': {$pf = array(  609.449,  793.701); 
break;}
 
 2652                case 'P5': {$pf = array(  396.850,  609.449); 
break;}
 
 2653                case 'P6': {$pf = array(  303.307,  396.850); 
break;}
 
 2655                case 'ARCH_E' : {$pf = array( 2592.000, 3456.000); 
break;}
 
 2656                case 'ARCH_E1': {$pf = array( 2160.000, 3024.000); 
break;}
 
 2657                case 'ARCH_D' : {$pf = array( 1728.000, 2592.000); 
break;}
 
 2659                case 'ARCH_C' : {$pf = array( 1296.000, 1728.000); 
break;}
 
 2660                case 'ARCH_B' : {$pf = array(  864.000, 1296.000); 
break;}
 
 2661                case 'ARCH_A' : {$pf = array(  648.000,  864.000); 
break;}
 
 2664                case 'ANNENV_A2'  : {$pf = array(  314.640,  414.000); 
break;}
 
 2665                case 'ANNENV_A6'  : {$pf = array(  342.000,  468.000); 
break;}
 
 2666                case 'ANNENV_A7'  : {$pf = array(  378.000,  522.000); 
break;}
 
 2667                case 'ANNENV_A8'  : {$pf = array(  396.000,  584.640); 
break;}
 
 2668                case 'ANNENV_A10' : {$pf = array(  450.000,  692.640); 
break;}
 
 2669                case 'ANNENV_SLIM': {$pf = array(  278.640,  638.640); 
break;}
 
 2671                case 'COMMENV_N6_1/4': {$pf = array(  252.000,  432.000); 
break;}
 
 2672                case 'COMMENV_N6_3/4': {$pf = array(  260.640,  468.000); 
break;}
 
 2673                case 'COMMENV_N8'    : {$pf = array(  278.640,  540.000); 
break;}
 
 2674                case 'COMMENV_N9'    : {$pf = array(  278.640,  638.640); 
break;}
 
 2675                case 'COMMENV_N10'   : {$pf = array(  296.640,  684.000); 
break;}
 
 2676                case 'COMMENV_N11'   : {$pf = array(  324.000,  746.640); 
break;}
 
 2677                case 'COMMENV_N12'   : {$pf = array(  342.000,  792.000); 
break;}
 
 2678                case 'COMMENV_N14'   : {$pf = array(  360.000,  828.000); 
break;}
 
 2680                case 'CATENV_N1'     : {$pf = array(  432.000,  648.000); 
break;}
 
 2681                case 'CATENV_N1_3/4' : {$pf = array(  468.000,  684.000); 
break;}
 
 2682                case 'CATENV_N2'     : {$pf = array(  468.000,  720.000); 
break;}
 
 2683                case 'CATENV_N3'     : {$pf = array(  504.000,  720.000); 
break;}
 
 2684                case 'CATENV_N6'     : {$pf = array(  540.000,  756.000); 
break;}
 
 2685                case 'CATENV_N7'     : {$pf = array(  576.000,  792.000); 
break;}
 
 2686                case 'CATENV_N8'     : {$pf = array(  594.000,  810.000); 
break;}
 
 2687                case 'CATENV_N9_1/2' : {$pf = array(  612.000,  756.000); 
break;}
 
 2688                case 'CATENV_N9_3/4' : {$pf = array(  630.000,  810.000); 
break;}
 
 2689                case 'CATENV_N10_1/2': {$pf = array(  648.000,  864.000); 
break;}
 
 2690                case 'CATENV_N12_1/2': {$pf = array(  684.000,  900.000); 
break;}
 
 2691                case 'CATENV_N13_1/2': {$pf = array(  720.000,  936.000); 
break;}
 
 2692                case 'CATENV_N14_1/4': {$pf = array(  810.000,  882.000); 
break;}
 
 2693                case 'CATENV_N14_1/2': {$pf = array(  828.000, 1044.000); 
break;}
 
 2695                case 'JIS_B0' : {$pf = array( 2919.685, 4127.244); 
break;}
 
 2696                case 'JIS_B1' : {$pf = array( 2063.622, 2919.685); 
break;}
 
 2697                case 'JIS_B2' : {$pf = array( 1459.843, 2063.622); 
break;}
 
 2698                case 'JIS_B3' : {$pf = array( 1031.811, 1459.843); 
break;}
 
 2699                case 'JIS_B4' : {$pf = array(  728.504, 1031.811); 
break;}
 
 2700                case 'JIS_B5' : {$pf = array(  515.906,  728.504); 
break;}
 
 2701                case 'JIS_B6' : {$pf = array(  362.835,  515.906); 
break;}
 
 2702                case 'JIS_B7' : {$pf = array(  257.953,  362.835); 
break;}
 
 2703                case 'JIS_B8' : {$pf = array(  181.417,  257.953); 
break;}
 
 2704                case 'JIS_B9' : {$pf = array(  127.559,  181.417); 
break;}
 
 2705                case 'JIS_B10': {$pf = array(   90.709,  127.559); 
break;}
 
 2706                case 'JIS_B11': {$pf = array(   62.362,   90.709); 
break;}
 
 2707                case 'JIS_B12': {$pf = array(   45.354,   62.362); 
break;}
 
 2709                case 'PA0' : {$pf = array( 2381.102, 3174.803,); 
break;}
 
 2710                case 'PA1' : {$pf = array( 1587.402, 2381.102); 
break;}
 
 2711                case 'PA2' : {$pf = array( 1190.551, 1587.402); 
break;}
 
 2712                case 'PA3' : {$pf = array(  793.701, 1190.551); 
break;}
 
 2713                case 'PA4' : {$pf = array(  595.276,  793.701); 
break;}
 
 2714                case 'PA5' : {$pf = array(  396.850,  595.276); 
break;}
 
 2715                case 'PA6' : {$pf = array(  297.638,  396.850); 
break;}
 
 2716                case 'PA7' : {$pf = array(  198.425,  297.638); 
break;}
 
 2717                case 'PA8' : {$pf = array(  147.402,  198.425); 
break;}
 
 2718                case 'PA9' : {$pf = array(   99.213,  147.402); 
break;}
 
 2719                case 'PA10': {$pf = array(   73.701,   99.213); 
break;}
 
 2721                case 'PASSPORT_PHOTO': {$pf = array(   99.213,  127.559); 
break;}
 
 2722                case 'E'   : {$pf = array(  233.858,  340.157); 
break;}
 
 2724                case '3R'  : {$pf = array(  252.283,  360.000); 
break;}
 
 2726                case '4R'  : {$pf = array(  289.134,  430.866); 
break;}
 
 2727                case '4D'  : {$pf = array(  340.157,  430.866); 
break;}
 
 2729                case '5R'  : {$pf = array(  360.000,  504.567); 
break;}
 
 2731                case '6R'  : {$pf = array(  430.866,  575.433); 
break;}
 
 2733                case '8R'  : {$pf = array(  575.433,  720.000); 
break;}
 
 2735                case 'S8R' : {$pf = array(  575.433,  864.567); 
break;}
 
 2737                case '10R' : {$pf = array(  720.000,  864.567); 
break;}
 
 2739                case 'S10R': {$pf = array(  720.000, 1080.000); 
break;}
 
 2740                case '11R' : {$pf = array(  790.866, 1009.134); 
break;}
 
 2741                case 'S11R': {$pf = array(  790.866, 1224.567); 
break;}
 
 2742                case '12R' : {$pf = array(  864.567, 1080.000); 
break;}
 
 2743                case 'S12R': {$pf = array(  864.567, 1292.598); 
break;}
 
 2745                case 'NEWSPAPER_BROADSHEET': {$pf = array( 2125.984, 1700.787); 
break;}
 
 2746                case 'NEWSPAPER_BERLINER'  : {$pf = array( 1332.283,  892.913); 
break;}
 
 2747                case 'NEWSPAPER_TABLOID':
 
 2748                case 'NEWSPAPER_COMPACT'   : {$pf = array( 1218.898,  793.701); 
break;}
 
 2751                case 'BUSINESS_CARD':
 
 2752                case 'BUSINESS_CARD_ISO7810': {$pf = array(  153.014,  242.646); 
break;}
 
 2753                case 'BUSINESS_CARD_ISO216' : {$pf = array(  147.402,  209.764); 
break;}
 
 2754                case 'BUSINESS_CARD_IT':
 
 2755                case 'BUSINESS_CARD_UK':
 
 2756                case 'BUSINESS_CARD_FR':
 
 2757                case 'BUSINESS_CARD_DE':
 
 2758                case 'BUSINESS_CARD_ES'     : {$pf = array(  155.906,  240.945); 
break;}
 
 2759                case 'BUSINESS_CARD_CA':
 
 2760                case 'BUSINESS_CARD_US'     : {$pf = array(  144.567,  252.283); 
break;}
 
 2761                case 'BUSINESS_CARD_JP'     : {$pf = array(  155.906,  257.953); 
break;}
 
 2762                case 'BUSINESS_CARD_HK'     : {$pf = array(  153.071,  255.118); 
break;}
 
 2763                case 'BUSINESS_CARD_AU':
 
 2764                case 'BUSINESS_CARD_DK':
 
 2765                case 'BUSINESS_CARD_SE'     : {$pf = array(  155.906,  255.118); 
break;}
 
 2766                case 'BUSINESS_CARD_RU':
 
 2767                case 'BUSINESS_CARD_CZ':
 
 2768                case 'BUSINESS_CARD_FI':
 
 2769                case 'BUSINESS_CARD_HU':
 
 2770                case 'BUSINESS_CARD_IL'     : {$pf = array(  141.732,  255.118); 
break;}
 
 2772                case '4SHEET' : {$pf = array( 2880.000, 4320.000); 
break;}
 
 2773                case '6SHEET' : {$pf = array( 3401.575, 5102.362); 
break;}
 
 2774                case '12SHEET': {$pf = array( 8640.000, 4320.000); 
break;}
 
 2775                case '16SHEET': {$pf = array( 5760.000, 8640.000); 
break;}
 
 2776                case '32SHEET': {$pf = array(11520.000, 8640.000); 
break;}
 
 2777                case '48SHEET': {$pf = array(17280.000, 8640.000); 
break;}
 
 2778                case '64SHEET': {$pf = array(23040.000, 8640.000); 
break;}
 
 2779                case '96SHEET': {$pf = array(34560.000, 8640.000); 
break;}
 
 2782                case 'EN_EMPEROR'          : {$pf = array( 3456.000, 5184.000); 
break;}
 
 2783                case 'EN_ANTIQUARIAN'      : {$pf = array( 2232.000, 3816.000); 
break;}
 
 2784                case 'EN_GRAND_EAGLE'      : {$pf = array( 2070.000, 3024.000); 
break;}
 
 2785                case 'EN_DOUBLE_ELEPHANT'  : {$pf = array( 1926.000, 2880.000); 
break;}
 
 2786                case 'EN_ATLAS'            : {$pf = array( 1872.000, 2448.000); 
break;}
 
 2787                case 'EN_COLOMBIER'        : {$pf = array( 1692.000, 2484.000); 
break;}
 
 2788                case 'EN_ELEPHANT'         : {$pf = array( 1656.000, 2016.000); 
break;}
 
 2789                case 'EN_DOUBLE_DEMY'      : {$pf = array( 1620.000, 2556.000); 
break;}
 
 2790                case 'EN_IMPERIAL'         : {$pf = array( 1584.000, 2160.000); 
break;}
 
 2791                case 'EN_PRINCESS'         : {$pf = array( 1548.000, 2016.000); 
break;}
 
 2792                case 'EN_CARTRIDGE'        : {$pf = array( 1512.000, 1872.000); 
break;}
 
 2793                case 'EN_DOUBLE_LARGE_POST': {$pf = array( 1512.000, 2376.000); 
break;}
 
 2794                case 'EN_ROYAL'            : {$pf = array( 1440.000, 1800.000); 
break;}
 
 2796                case 'EN_HALF_POST'        : {$pf = array( 1404.000, 1692.000); 
break;}
 
 2797                case 'EN_SUPER_ROYAL'      : {$pf = array( 1368.000, 1944.000); 
break;}
 
 2798                case 'EN_DOUBLE_POST'      : {$pf = array( 1368.000, 2196.000); 
break;}
 
 2799                case 'EN_MEDIUM'           : {$pf = array( 1260.000, 1656.000); 
break;}
 
 2800                case 'EN_DEMY'             : {$pf = array( 1260.000, 1620.000); 
break;}
 
 2801                case 'EN_LARGE_POST'       : {$pf = array( 1188.000, 1512.000); 
break;}
 
 2802                case 'EN_COPY_DRAUGHT'     : {$pf = array( 1152.000, 1440.000); 
break;}
 
 2803                case 'EN_POST'             : {$pf = array( 1116.000, 1386.000); 
break;}
 
 2804                case 'EN_CROWN'            : {$pf = array( 1080.000, 1440.000); 
break;}
 
 2805                case 'EN_PINCHED_POST'     : {$pf = array( 1062.000, 1332.000); 
break;}
 
 2806                case 'EN_BRIEF'            : {$pf = array(  972.000, 1152.000); 
break;}
 
 2807                case 'EN_FOOLSCAP'         : {$pf = array(  972.000, 1224.000); 
break;}
 
 2808                case 'EN_SMALL_FOOLSCAP'   : {$pf = array(  954.000, 1188.000); 
break;}
 
 2809                case 'EN_POTT'             : {$pf = array(  900.000, 1080.000); 
break;}
 
 2811                case 'BE_GRAND_AIGLE' : {$pf = array( 1984.252, 2948.031); 
break;}
 
 2812                case 'BE_COLOMBIER'   : {$pf = array( 1757.480, 2409.449); 
break;}
 
 2813                case 'BE_DOUBLE_CARRE': {$pf = array( 1757.480, 2607.874); 
break;}
 
 2814                case 'BE_ELEPHANT'    : {$pf = array( 1746.142, 2182.677); 
break;}
 
 2815                case 'BE_PETIT_AIGLE' : {$pf = array( 1700.787, 2381.102); 
break;}
 
 2816                case 'BE_GRAND_JESUS' : {$pf = array( 1559.055, 2069.291); 
break;}
 
 2817                case 'BE_JESUS'       : {$pf = array( 1530.709, 2069.291); 
break;}
 
 2818                case 'BE_RAISIN'      : {$pf = array( 1417.323, 1842.520); 
break;}
 
 2819                case 'BE_GRAND_MEDIAN': {$pf = array( 1303.937, 1714.961); 
break;}
 
 2820                case 'BE_DOUBLE_POSTE': {$pf = array( 1233.071, 1601.575); 
break;}
 
 2821                case 'BE_COQUILLE'    : {$pf = array( 1218.898, 1587.402); 
break;}
 
 2822                case 'BE_PETIT_MEDIAN': {$pf = array( 1176.378, 1502.362); 
break;}
 
 2823                case 'BE_RUCHE'       : {$pf = array( 1020.472, 1303.937); 
break;}
 
 2824                case 'BE_PROPATRIA'   : {$pf = array(  977.953, 1218.898); 
break;}
 
 2825                case 'BE_LYS'         : {$pf = array(  898.583, 1125.354); 
break;}
 
 2826                case 'BE_POT'         : {$pf = array(  870.236, 1088.504); 
break;}
 
 2827                case 'BE_ROSETTE'     : {$pf = array(  765.354,  983.622); 
break;}
 
 2829                case 'FR_UNIVERS'          : {$pf = array( 2834.646, 3685.039); 
break;}
 
 2830                case 'FR_DOUBLE_COLOMBIER' : {$pf = array( 2551.181, 3571.654); 
break;}
 
 2831                case 'FR_GRANDE_MONDE'     : {$pf = array( 2551.181, 3571.654); 
break;}
 
 2832                case 'FR_DOUBLE_SOLEIL'    : {$pf = array( 2267.717, 3401.575); 
break;}
 
 2833                case 'FR_DOUBLE_JESUS'     : {$pf = array( 2154.331, 3174.803); 
break;}
 
 2834                case 'FR_GRAND_AIGLE'      : {$pf = array( 2125.984, 3004.724); 
break;}
 
 2835                case 'FR_PETIT_AIGLE'      : {$pf = array( 1984.252, 2664.567); 
break;}
 
 2836                case 'FR_DOUBLE_RAISIN'    : {$pf = array( 1842.520, 2834.646); 
break;}
 
 2837                case 'FR_JOURNAL'          : {$pf = array( 1842.520, 2664.567); 
break;}
 
 2838                case 'FR_COLOMBIER_AFFICHE': {$pf = array( 1785.827, 2551.181); 
break;}
 
 2839                case 'FR_DOUBLE_CAVALIER'  : {$pf = array( 1757.480, 2607.874); 
break;}
 
 2840                case 'FR_CLOCHE'           : {$pf = array( 1700.787, 2267.717); 
break;}
 
 2841                case 'FR_SOLEIL'           : {$pf = array( 1700.787, 2267.717); 
break;}
 
 2842                case 'FR_DOUBLE_CARRE'     : {$pf = array( 1587.402, 2551.181); 
break;}
 
 2843                case 'FR_DOUBLE_COQUILLE'  : {$pf = array( 1587.402, 2494.488); 
break;}
 
 2844                case 'FR_JESUS'            : {$pf = array( 1587.402, 2154.331); 
break;}
 
 2845                case 'FR_RAISIN'           : {$pf = array( 1417.323, 1842.520); 
break;}
 
 2846                case 'FR_CAVALIER'         : {$pf = array( 1303.937, 1757.480); 
break;}
 
 2847                case 'FR_DOUBLE_COURONNE'  : {$pf = array( 1303.937, 2040.945); 
break;}
 
 2848                case 'FR_CARRE'            : {$pf = array( 1275.591, 1587.402); 
break;}
 
 2849                case 'FR_COQUILLE'         : {$pf = array( 1247.244, 1587.402); 
break;}
 
 2850                case 'FR_DOUBLE_TELLIERE'  : {$pf = array( 1247.244, 1927.559); 
break;}
 
 2851                case 'FR_DOUBLE_CLOCHE'    : {$pf = array( 1133.858, 1700.787); 
break;}
 
 2852                case 'FR_DOUBLE_POT'       : {$pf = array( 1133.858, 1757.480); 
break;}
 
 2853                case 'FR_ECU'              : {$pf = array( 1133.858, 1474.016); 
break;}
 
 2854                case 'FR_COURONNE'         : {$pf = array( 1020.472, 1303.937); 
break;}
 
 2855                case 'FR_TELLIERE'         : {$pf = array(  963.780, 1247.244); 
break;}
 
 2856                case 'FR_POT'              : {$pf = array(  878.740, 1133.858); 
break;}
 
 2858                default: {$pf = array(  595.276,  841.890); 
break;}
 
 2919           if (!empty($format) AND isset($this->pagedim[$this->page])) {
 
 2921                unset($this->pagedim[$this->page]);
 
 2923           if (is_string($format)) {
 
 2926                $this->fwPt = $pf[0];
 
 2927                $this->fhPt = $pf[1];
 
 2930                if (isset($format[
'MediaBox'])) {
 
 2931                     $this->
setPageBoxes($this->page, 
'MediaBox', $format[
'MediaBox'][
'llx'], $format[
'MediaBox'][
'lly'], $format[
'MediaBox'][
'urx'], $format[
'MediaBox'][
'ury'], 
false);
 
 2932                     $this->fwPt = (($format[
'MediaBox'][
'urx'] - $format[
'MediaBox'][
'llx']) * $this->k);
 
 2933                     $this->fhPt = (($format[
'MediaBox'][
'ury'] - $format[
'MediaBox'][
'lly']) * $this->k);
 
 2935                     if (isset($format[0]) AND is_numeric($format[0]) AND isset($format[1]) AND is_numeric($format[1])) {
 
 2936                          $pf = array(($format[0] * $this->k), ($format[1] * $this->k));
 
 2938                          if (!isset($format[
'format'])) {
 
 2940                               $format[
'format'] = 
'A4';
 
 2944                     $this->fwPt = $pf[0];
 
 2945                     $this->fhPt = $pf[1];
 
 2946                     $this->
setPageBoxes($this->page, 
'MediaBox', 0, 0, $this->fwPt, $this->fhPt, 
true);
 
 2949                if (isset($format[
'CropBox'])) {
 
 2950                     $this->
setPageBoxes($this->page, 
'CropBox', $format[
'CropBox'][
'llx'], $format[
'CropBox'][
'lly'], $format[
'CropBox'][
'urx'], $format[
'CropBox'][
'ury'], 
false);
 
 2953                if (isset($format[
'BleedBox'])) {
 
 2954                     $this->
setPageBoxes($this->page, 
'BleedBox', $format[
'BleedBox'][
'llx'], $format[
'BleedBox'][
'lly'], $format[
'BleedBox'][
'urx'], $format[
'BleedBox'][
'ury'], 
false);
 
 2957                if (isset($format[
'TrimBox'])) {
 
 2958                     $this->
setPageBoxes($this->page, 
'TrimBox', $format[
'TrimBox'][
'llx'], $format[
'TrimBox'][
'lly'], $format[
'TrimBox'][
'urx'], $format[
'TrimBox'][
'ury'], 
false);
 
 2961                if (isset($format[
'ArtBox'])) {
 
 2962                     $this->
setPageBoxes($this->page, 
'ArtBox', $format[
'ArtBox'][
'llx'], $format[
'ArtBox'][
'lly'], $format[
'ArtBox'][
'urx'], $format[
'ArtBox'][
'ury'], 
false);
 
 2965                if (isset($format[
'BoxColorInfo'])) {
 
 2966                     $this->pagedim[
$this->page][
'BoxColorInfo'] = $format[
'BoxColorInfo'];
 
 2968                if (isset($format[
'Rotate']) AND (($format[
'Rotate'] % 90) == 0)) {
 
 2970                     $this->pagedim[
$this->page][
'Rotate'] = intval($format[
'Rotate']);
 
 2972                if (isset($format[
'PZ'])) {
 
 2974                     $this->pagedim[
$this->page][
'PZ'] = floatval($format[
'PZ']);
 
 2976                if (isset($format[
'trans'])) {
 
 2978                     if (isset($format[
'trans'][
'Dur'])) {
 
 2980                          $this->pagedim[
$this->page][
'trans'][
'Dur'] = floatval($format[
'trans'][
'Dur']);
 
 2982                     $stansition_styles = array(
'Split', 
'Blinds', 
'Box', 
'Wipe', 
'Dissolve', 
'Glitter', 
'R', 
'Fly', 
'Push', 
'Cover', 
'Uncover', 
'Fade');
 
 2983                     if (isset($format[
'trans'][
'S']) AND in_array($format[
'trans'][
'S'], $stansition_styles)) {
 
 2985                          $this->pagedim[
$this->page][
'trans'][
'S'] = $format[
'trans'][
'S'];
 
 2986                          $valid_effect = array(
'Split', 
'Blinds');
 
 2987                          $valid_vals = array(
'H', 
'V');
 
 2988                          if (isset($format[
'trans'][
'Dm']) AND in_array($format[
'trans'][
'S'], $valid_effect) AND in_array($format[
'trans'][
'Dm'], $valid_vals)) {
 
 2989                               $this->pagedim[
$this->page][
'trans'][
'Dm'] = $format[
'trans'][
'Dm'];
 
 2991                          $valid_effect = array(
'Split', 
'Box', 
'Fly');
 
 2992                          $valid_vals = array(
'I', 
'O');
 
 2993                          if (isset($format[
'trans'][
'M']) AND in_array($format[
'trans'][
'S'], $valid_effect) AND in_array($format[
'trans'][
'M'], $valid_vals)) {
 
 2994                               $this->pagedim[
$this->page][
'trans'][
'M'] = $format[
'trans'][
'M'];
 
 2996                          $valid_effect = array(
'Wipe', 
'Glitter', 
'Fly', 
'Cover', 
'Uncover', 
'Push');
 
 2997                          if (isset($format[
'trans'][
'Di']) AND in_array($format[
'trans'][
'S'], $valid_effect)) {
 
 2998                               if (((($format[
'trans'][
'Di'] == 90) OR ($format[
'trans'][
'Di'] == 180)) AND ($format[
'trans'][
'S'] == 
'Wipe'))
 
 2999                                    OR (($format[
'trans'][
'Di'] == 315) AND ($format[
'trans'][
'S'] == 
'Glitter'))
 
 3000                                    OR (($format[
'trans'][
'Di'] == 0) OR ($format[
'trans'][
'Di'] == 270))) {
 
 3001                                    $this->pagedim[
$this->page][
'trans'][
'Di'] = intval($format[
'trans'][
'Di']);
 
 3004                          if (isset($format[
'trans'][
'SS']) AND ($format[
'trans'][
'S'] == 
'Fly')) {
 
 3005                               $this->pagedim[
$this->page][
'trans'][
'SS'] = floatval($format[
'trans'][
'SS']);
 
 3007                          if (isset($format[
'trans'][
'B']) AND ($format[
'trans'][
'B'] === 
true) AND ($format[
'trans'][
'S'] == 
'Fly')) {
 
 3008                               $this->pagedim[
$this->page][
'trans'][
'B'] = 
'true';
 
 3013                     if (isset($format[
'trans'][
'D'])) {
 
 3015                          $this->pagedim[
$this->page][
'trans'][
'D'] = floatval($format[
'trans'][
'D']);
 
 3037           if (!isset($this->pagedim[
$page])) {
 
 3039                $this->pagedim[
$page] = array();
 
 3041           $pageboxes = array(
'MediaBox', 
'CropBox', 
'BleedBox', 
'TrimBox', 
'ArtBox');
 
 3042           if (!in_array($type, $pageboxes)) {
 
 3050           $this->pagedim[
$page][$type][
'llx'] = ($llx * 
$k);
 
 3051           $this->pagedim[
$page][$type][
'lly'] = ($lly * 
$k);
 
 3052           $this->pagedim[
$page][$type][
'urx'] = ($urx * 
$k);
 
 3053           $this->pagedim[
$page][$type][
'ury'] = ($ury * 
$k);
 
 3063           $pageboxes = array(
'MediaBox', 
'CropBox', 
'BleedBox', 
'TrimBox', 
'ArtBox');
 
 3064           foreach ($pageboxes as $type) {
 
 3066                if (isset($this->pagedim[
$page][$type])) {
 
 3067                     $tmp = $this->pagedim[
$page][$type][
'llx'];
 
 3068                     $this->pagedim[
$page][$type][
'llx'] = $this->pagedim[
$page][$type][
'lly'];
 
 3069                     $this->pagedim[
$page][$type][
'lly'] = $tmp;
 
 3070                     $tmp = $this->pagedim[
$page][$type][
'urx'];
 
 3071                     $this->pagedim[
$page][$type][
'urx'] = $this->pagedim[
$page][$type][
'ury'];
 
 3072                     $this->pagedim[
$page][$type][
'ury'] = $tmp;
 
 3086           if (!isset($this->pagedim[$this->page][
'MediaBox'])) {
 
 3088                $this->
setPageBoxes($this->page, 
'MediaBox', 0, 0, $this->fwPt, $this->fhPt, 
true);
 
 3090           if (!isset($this->pagedim[$this->page][
'CropBox'])) {
 
 3092                $this->
setPageBoxes($this->page, 
'CropBox', $this->pagedim[$this->page][
'MediaBox'][
'llx'], $this->pagedim[$this->page][
'MediaBox'][
'lly'], $this->pagedim[$this->page][
'MediaBox'][
'urx'], $this->pagedim[$this->page][
'MediaBox'][
'ury'], 
true);
 
 3094           if (!isset($this->pagedim[$this->page][
'BleedBox'])) {
 
 3096                $this->
setPageBoxes($this->page, 
'BleedBox', $this->pagedim[$this->page][
'CropBox'][
'llx'], $this->pagedim[$this->page][
'CropBox'][
'lly'], $this->pagedim[$this->page][
'CropBox'][
'urx'], $this->pagedim[$this->page][
'CropBox'][
'ury'], 
true);
 
 3098           if (!isset($this->pagedim[$this->page][
'TrimBox'])) {
 
 3100                $this->
setPageBoxes($this->page, 
'TrimBox', $this->pagedim[$this->page][
'CropBox'][
'llx'], $this->pagedim[$this->page][
'CropBox'][
'lly'], $this->pagedim[$this->page][
'CropBox'][
'urx'], $this->pagedim[$this->page][
'CropBox'][
'ury'], 
true);
 
 3102           if (!isset($this->pagedim[$this->page][
'ArtBox'])) {
 
 3104                $this->
setPageBoxes($this->page, 
'ArtBox', $this->pagedim[$this->page][
'CropBox'][
'llx'], $this->pagedim[$this->page][
'CropBox'][
'lly'], $this->pagedim[$this->page][
'CropBox'][
'urx'], $this->pagedim[$this->page][
'CropBox'][
'ury'], 
true);
 
 3106           if (!isset($this->pagedim[$this->page][
'Rotate'])) {
 
 3110           if (!isset($this->pagedim[$this->page][
'PZ'])) {
 
 3114           if ($this->fwPt > $this->fhPt) {
 
 3116                $default_orientation = 
'L';
 
 3119                $default_orientation = 
'P';
 
 3121           $valid_orientations = array(
'P', 
'L');
 
 3122           if (empty($orientation)) {
 
 3123                $orientation = $default_orientation;
 
 3125                $orientation = strtoupper($orientation{0});
 
 3127           if (in_array($orientation, $valid_orientations) AND ($orientation != $default_orientation)) {
 
 3128                $this->CurOrientation = $orientation;
 
 3132                $this->CurOrientation = $default_orientation;
 
 3136           if ((abs($this->pagedim[$this->page][
'MediaBox'][
'urx'] - $this->hPt) < $this->feps) AND (abs($this->pagedim[$this->page][
'MediaBox'][
'ury'] - $this->wPt) < $this->feps)){
 
 3140           $this->w = ($this->wPt / 
$this->k);
 
 3141           $this->h = ($this->hPt / 
$this->k);
 
 3143                if (isset($this->AutoPageBreak)) {
 
 3146                     $autopagebreak = 
true;
 
 3150                if (isset($this->bMargin)) {
 
 3154                     $bottommargin = 2 * 28.35 / 
$this->k;
 
 3164           $this->pagedim[
$this->page][
'bm'] = $bottommargin;
 
 3167           $this->pagedim[
$this->page][
'pb'] = $autopagebreak;
 
 3191           $this->re_spaces = $re;
 
 3192           $re_parts = explode(
'/', $re);
 
 3194           $this->re_space = array();
 
 3195           if (isset($re_parts[1]) AND !empty($re_parts[1])) {
 
 3196                $this->re_space[
'p'] = $re_parts[1];
 
 3198                $this->re_space[
'p'] = 
'[\s]';
 
 3201           if (isset($re_parts[2]) AND !empty($re_parts[2])) {
 
 3202                $this->re_space[
'm'] = $re_parts[2];
 
 3204                $this->re_space[
'm'] = 
'';
 
 3215      public function setRTL($enable, $resetx=
true) {
 
 3216           $enable = $enable ? 
true : 
false;
 
 3217           $resetx = ($resetx AND ($enable != $this->rtl));
 
 3218           $this->rtl = $enable;
 
 3219           $this->tmprtl = 
false;
 
 3243           switch (strtoupper(
$mode)) {
 
 3264           $this->tmprtl = $newmode;
 
 3274           return ($this->rtl OR ($this->tmprtl == 
'R'));
 
 3315           $this->imgscale = $scale;
 
 3339           if (empty($pagenum)) {
 
 3342           return $this->pagedim[$pagenum];
 
 3355           if (empty($pagenum)) {
 
 3358           return $this->pagedim[$pagenum][
'w'];
 
 3371           if (empty($pagenum)) {
 
 3374           return $this->pagedim[$pagenum][
'h'];
 
 3387           if (empty($pagenum)) {
 
 3390           return $this->pagedim[$pagenum][
'bm'];
 
 3414      public function SetMargins($left, $top, $right=-1, $keepmargins=
false) {
 
 3416           $this->lMargin = $left;
 
 3417           $this->tMargin = $top;
 
 3421           $this->rMargin = $right;
 
 3438           $this->lMargin = $margin;
 
 3439           if (($this->page > 0) AND ($this->x < $margin)) {
 
 3453           $this->tMargin = $margin;
 
 3454           if (($this->page > 0) AND ($this->y < $margin)) {
 
 3467           $this->rMargin = $margin;
 
 3468           if (($this->page > 0) AND ($this->x > ($this->w - $margin))) {
 
 3469                $this->x = $this->w - $margin;
 
 3482                $this->cell_padding[
'L'] = $pad;
 
 3483                $this->cell_padding[
'T'] = $pad;
 
 3484                $this->cell_padding[
'R'] = $pad;
 
 3485                $this->cell_padding[
'B'] = $pad;
 
 3500           if (($left !== 
'') AND ($left >= 0)) {
 
 3501                $this->cell_padding[
'L'] = $left;
 
 3503           if (($top !== 
'') AND ($top >= 0)) {
 
 3504                $this->cell_padding[
'T'] = $top;
 
 3506           if (($right !== 
'') AND ($right >= 0)) {
 
 3507                $this->cell_padding[
'R'] = $right;
 
 3509           if (($bottom !== 
'') AND ($bottom >= 0)) {
 
 3510                $this->cell_padding[
'B'] = $bottom;
 
 3536           if (($left !== 
'') AND ($left >= 0)) {
 
 3537                $this->cell_margin[
'L'] = $left;
 
 3539           if (($top !== 
'') AND ($top >= 0)) {
 
 3540                $this->cell_margin[
'T'] = $top;
 
 3542           if (($right !== 
'') AND ($right >= 0)) {
 
 3543                $this->cell_margin[
'R'] = $right;
 
 3545           if (($bottom !== 
'') AND ($bottom >= 0)) {
 
 3546                $this->cell_margin[
'B'] = $bottom;
 
 3572           if (is_string($brd)) {
 
 3574                $slen = strlen($brd);
 
 3576                for (
$i = 0; 
$i < $slen; ++
$i) {
 
 3577                     $newbrd[$brd[
$i]] = 
true;
 
 3580           } 
elseif (($brd === 1) OR ($brd === 
true) OR (is_numeric($brd) AND (intval($brd) > 0))) {
 
 3581                $brd = array(
'LRTB' => 
true);
 
 3583           if (!is_array($brd)) {
 
 3589           if (isset($brd[
'mode'])) {
 
 3590                $mode = $brd[
'mode'];
 
 3591                unset($brd[
'mode']);
 
 3596           foreach ($brd as $border => $style) {
 
 3598                if (is_array($style) AND isset($style[
'width'])) {
 
 3600                     $line_width = $style[
'width'];
 
 3614                          $adj = ($line_width / 2);
 
 3619                if ((strpos($border,
'T') !== 
false) AND ($this->cell_padding[
'T'] < $adj)) {
 
 3620                     $this->cell_padding[
'T'] = $adj;
 
 3622                if ((strpos($border,
'R') !== 
false) AND ($this->cell_padding[
'R'] < $adj)) {
 
 3623                     $this->cell_padding[
'R'] = $adj;
 
 3625                if ((strpos($border,
'B') !== 
false) AND ($this->cell_padding[
'B'] < $adj)) {
 
 3626                     $this->cell_padding[
'B'] = $adj;
 
 3628                if ((strpos($border,
'L') !== 
false) AND ($this->cell_padding[
'L'] < $adj)) {
 
 3629                     $this->cell_padding[
'L'] = $adj;
 
 3632           return array(
'T' => ($this->cell_padding[
'T'] - $cp[
'T']), 
'R' => ($this->cell_padding[
'R'] - $cp[
'R']), 
'B' => ($this->cell_padding[
'B'] - $cp[
'B']), 
'L' => ($this->cell_padding[
'L'] - $cp[
'L']));
 
 3644           $this->AutoPageBreak = $auto ? 
true : 
false;
 
 3645           $this->bMargin = $margin;
 
 3646           $this->PageBreakTrigger = $this->h - ($margin*2);
 
 3668           if (($zoom == 
'fullpage') OR ($zoom == 
'fullwidth') OR ($zoom == 
'real') OR ($zoom == 
'default') OR (!is_string($zoom))) {
 
 3669                $this->ZoomMode = $zoom;
 
 3671                $this->
Error(
'Incorrect zoom display mode: '.$zoom);
 
 3676                case 'SinglePage': {
 
 3677                     $this->LayoutMode = 
'SinglePage';
 
 3682                     $this->LayoutMode = 
'OneColumn';
 
 3686                case 'TwoColumnLeft': {
 
 3687                     $this->LayoutMode = 
'TwoColumnLeft';
 
 3690                case 'TwoColumnRight': {
 
 3691                     $this->LayoutMode = 
'TwoColumnRight';
 
 3694                case 'TwoPageLeft': {
 
 3695                     $this->LayoutMode = 
'TwoPageLeft';
 
 3698                case 'TwoPageRight': {
 
 3699                     $this->LayoutMode = 
'TwoPageRight';
 
 3703                     $this->LayoutMode = 
'SinglePage';
 
 3708                     $this->PageMode = 
'UseNone';
 
 3711                case 'UseOutlines': {
 
 3712                     $this->PageMode = 
'UseOutlines';
 
 3716                     $this->PageMode = 
'UseThumbs';
 
 3719                case 'FullScreen': {
 
 3720                     $this->PageMode = 
'FullScreen';
 
 3724                     $this->PageMode = 
'UseOC';
 
 3728                     $this->PageMode = 
'UseAttachments';
 
 3732                     $this->PageMode = 
'UseNone';
 
 3745           if (function_exists(
'gzcompress')) {
 
 3746                $this->compress = 
$compress ? 
true : 
false;
 
 3748                $this->compress = 
false;
 
 3759           $this->force_srgb = 
$mode ? 
true : 
false;
 
 3770           $this->docinfounicode = 
$unicode ? 
true : 
false;
 
 3839           die(
'<strong>TCPDF ERROR: </strong>'.$msg);
 
 3863           if ($this->state == 3) {
 
 3866           if ($this->page == 0) {
 
 3870           if ($this->tcpdflink) {
 
 3874                $this->lastpage(
true);
 
 3877                $this->y = $this->h - (1 / 
$this->k);
 
 3883                $msg = 
"\x50\x6f\x77\x65\x72\x65\x64\x20\x62\x79\x20\x54\x43\x50\x44\x46\x20\x28\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67\x29";
 
 3884                $lnk = 
"\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67";
 
 3885                $this->
Cell(0, 0, $msg, 0, 0, 
'L', 0, $lnk, 0, 
false, 
'D', 
'B');
 
 3906      public function setPage($pnum, $resetmargins=
false) {
 
 3907           if (($pnum == $this->page) AND ($this->state == 2)) {
 
 3910           if (($pnum > 0) AND ($pnum <= $this->numpages)) {
 
 3915                $this->page = $pnum;
 
 3920                $this->tMargin = $this->pagedim[
$this->page][
'tm'];
 
 3921                $this->bMargin = $this->pagedim[
$this->page][
'bm'];
 
 3922                $this->original_lMargin = $this->pagedim[
$this->page][
'olm'];
 
 3923                $this->original_rMargin = $this->pagedim[
$this->page][
'orm'];
 
 3924                $this->AutoPageBreak = $this->pagedim[
$this->page][
'pb'];
 
 3925                $this->CurOrientation = $this->pagedim[
$this->page][
'or'];
 
 3929                if ($resetmargins) {
 
 3930                     $this->lMargin = $this->pagedim[
$this->page][
'olm'];
 
 3931                     $this->rMargin = $this->pagedim[
$this->page][
'orm'];
 
 3932                     $this->
SetY($this->tMargin);
 
 3935                     if ($this->pagedim[$this->page][
'olm'] != $this->pagedim[$oldpage][
'olm']) {
 
 3937                          $this->lMargin += $deltam;
 
 3938                          $this->rMargin -= $deltam;
 
 3942                $this->
Error(
'Wrong page number on setPage() function: '.$pnum);
 
 3988      public function addTOCPage($orientation=
'', $format=
'', $keepmargins=
false) {
 
 3989           $this->
AddPage($orientation, $format, $keepmargins, 
true);
 
 4013      public function AddPage($orientation=
'', $format=
'', $keepmargins=
false, 
$tocpage=
false) {
 
 4014           if ($this->inxobj) {
 
 4018           if (!isset($this->original_lMargin) OR $keepmargins) {
 
 4021           if (!isset($this->original_rMargin) OR $keepmargins) {
 
 4039           if (($this->page == 0) OR ($this->numpages > $this->page) OR (!$this->pageopen[$this->page])) {
 
 4049                $this->tocpage = 
false;
 
 4065                $this->tocpage = 
true;
 
 4068           if ($this->tocpage) {
 
 4072                foreach ($tmpoutlines as $key => $outline) {
 
 4073                     if ($outline[
'p'] > $this->numpages) {
 
 4074                          $this->outlines[$key][
'p'] = ($outline[
'p'] + 1);
 
 4079                foreach ($tmpdests as $key => $dest) {
 
 4080                     if ($dest[
'p'] > $this->numpages) {
 
 4081                          $this->dests[$key][
'p'] = ($dest[
'p'] + 1);
 
 4086                foreach ($tmplinks as $key => $link) {
 
 4087                     if ($link[0] > $this->numpages) {
 
 4088                          $this->links[$key][0] = ($link[0] + 1);
 
 4092           if ($this->numpages > $this->page) {
 
 4094                $this->
setPage($this->page + 1);
 
 4095                $this->
SetY($this->tMargin);
 
 4099           if ($this->state == 0) {
 
 4151           if (isset($this->footerlen[
$page])) {
 
 4152                $this->cntmrk[
$page] = $this->pagelen[
$page] - $this->footerlen[
$page];
 
 4154                $this->cntmrk[
$page] = $this->pagelen[
$page];
 
 4168      public function setHeaderData($ln=
'', $lw=0, $ht=
'', $hs=
'', $tc=array(0,0,0), $lc=array(0,0,0)) {
 
 4169           $this->header_logo = $ln;
 
 4170           $this->header_logo_width = $lw;
 
 4171           $this->header_title = $ht;
 
 4172           $this->header_string = $hs;
 
 4173           $this->header_text_color = $tc;
 
 4174           $this->header_line_color = $lc;
 
 4184           $this->footer_text_color = $tc;
 
 4185           $this->footer_line_color = $lc;
 
 4213           $this->header_margin = $hm;
 
 4233           $this->footer_margin = $fm;
 
 4251           $this->print_header = $val ? 
true : 
false;
 
 4260           $this->print_footer = $val ? 
true : 
false;
 
 4286           $this->header_xobjid = -1;
 
 4295           $this->header_xobj_autoreset = $val ? 
true : 
false;
 
 4304           if ($this->header_xobjid < 0) {
 
 4306                $this->header_xobjid = $this->
startTemplate($this->w, $this->tMargin);
 
 4315                if (($headerdata[
'logo']) AND ($headerdata[
'logo'] != 
K_BLANK_IMAGE)) {
 
 4317                     if (($imgtype == 
'eps') OR ($imgtype == 
'ai')) {
 
 4319                     } 
elseif ($imgtype == 
'svg') {
 
 4328                $cell_height = round(($this->cell_height_ratio * $headerfont[2]) / $this->k, 2);
 
 4331                     $header_x = $this->original_rMargin + ($headerdata[
'logo_width'] * 1.1);
 
 4333                     $header_x = $this->original_lMargin + ($headerdata[
'logo_width'] * 1.1);
 
 4335                $cw = $this->w - $this->original_lMargin - $this->original_rMargin - ($headerdata[
'logo_width'] * 1.1);
 
 4338                $this->
SetFont($headerfont[0], 
'B', $headerfont[2] + 1);
 
 4339                $this->
SetX($header_x);
 
 4340                $this->
Cell($cw, $cell_height, $headerdata[
'title'], 0, 1, 
'', 0, 
'', 0);
 
 4342                $this->
SetFont($headerfont[0], $headerfont[1], $headerfont[2]);
 
 4343                $this->
SetX($header_x);
 
 4344                $this->
MultiCell($cw, $cell_height, $headerdata[
'string'], 0, 
'', 0, 1, 
'', 
'', 
true, 0, 
false, 
true, 0, 
'T', 
false);
 
 4346                $this->
SetLineStyle(array(
'width' => 0.85 / $this->k, 
'cap' => 
'butt', 
'join' => 
'miter', 
'dash' => 0, 
'color' => $headerdata[
'line_color']));
 
 4347                $this->
SetY((2.835 / $this->k) + max($imgy, $this->y));
 
 4349                     $this->
SetX($this->original_rMargin);
 
 4351                     $this->
SetX($this->original_lMargin);
 
 4353                $this->
Cell(($this->w - $this->original_lMargin - $this->original_rMargin), 0, 
'', 
'T', 0, 
'C');
 
 4359           if (!$this->header_xobj_autoreset AND $this->booklet AND (($this->page % 2) == 0)) {
 
 4364                $x = $this->w + $dx;
 
 4368           $this->
printTemplate($this->header_xobjid, 
$x, 0, 0, 0, 
'', 
'', 
false);
 
 4369           if ($this->header_xobj_autoreset) {
 
 4371                $this->header_xobjid = -1;
 
 4385           $this->
SetLineStyle(array(
'width' => $line_width, 
'cap' => 
'butt', 
'join' => 
'miter', 
'dash' => 0, 
'color' => $this->footer_line_color));
 
 4389                $this->
Ln($line_width);
 
 4390                $barcode_width = round(($this->w - $this->original_lMargin - $this->original_rMargin) / 3);
 
 4392                     'position' => $this->rtl?
'R':
'L',
 
 4393                     'align' => $this->rtl?
'R':
'L',
 
 4396                     'cellfitalign' => 
'',
 
 4399                     'fgcolor' => array(0,0,0),
 
 4403                $this->
write1DBarcode(
$barcode, 
'C128', 
'', $cur_y + $line_width, 
'', (($this->footer_margin / 3) - $line_width), 0.3, $style, 
'');
 
 4405           $w_page = isset($this->l[
'w_page']) ? $this->l[
'w_page'].
' ' : 
'';
 
 4406           if (empty($this->pagegroups)) {
 
 4407                $pagenumtxt = $w_page.$this->getAliasNumPage().
' / '.$this->
getAliasNbPages();
 
 4409                $pagenumtxt = $w_page.$this->getPageNumGroupAlias().
' / '.$this->
getPageGroupAlias();
 
 4411           $this->
SetY($cur_y);
 
 4414                $this->
SetX($this->original_rMargin);
 
 4415                $this->
Cell(0, 0, $pagenumtxt, 
'T', 0, 
'L');
 
 4417                $this->
SetX($this->original_lMargin);
 
 4428           if (!$this->print_header OR ($this->state != 2)) {
 
 4431           $this->InHeader = 
true;
 
 4442                $this->
SetXY($this->original_rMargin, $this->header_margin);
 
 4444                $this->
SetXY($this->original_lMargin, $this->header_margin);
 
 4446           $this->
SetFont($this->header_font[0], $this->header_font[1], $this->header_font[2]);
 
 4450                $this->
SetXY($this->original_rMargin, $this->tMargin);
 
 4452                $this->
SetXY($this->original_lMargin, $this->tMargin);
 
 4456           $this->thead = $temp_thead;
 
 4457           $this->theadMargins = $temp_theadMargins;
 
 4458           $this->newline = 
false;
 
 4459           $this->InHeader = 
false;
 
 4468           if ($this->state != 2) {
 
 4471           $this->InFooter = 
true;
 
 4477           if ($this->print_footer) {
 
 4479                $this->current_column = 0;
 
 4480                $this->num_columns = 1;
 
 4491                     $this->
SetXY($this->original_rMargin, $footer_y);
 
 4493                     $this->
SetXY($this->original_lMargin, $footer_y);
 
 4495                $this->
SetFont($this->footer_font[0], $this->footer_font[1], $this->footer_font[2]);
 
 4499                     $this->
SetXY($this->original_rMargin, $this->tMargin);
 
 4501                     $this->
SetXY($this->original_lMargin, $this->tMargin);
 
 4505                $this->thead = $temp_thead;
 
 4506                $this->theadMargins = $temp_theadMargins;
 
 4510           $this->current_column = $gvars[
'current_column'];
 
 4511           $this->num_columns = $gvars[
'num_columns'];
 
 4514           $this->InFooter = 
false;
 
 4524           return (($this->InHeader === 
false) AND ($this->InFooter === 
false));
 
 4533           if ($this->num_columns > 1) {
 
 4537           if (isset($this->theadMargins[
'top'])) {
 
 4539                $this->tMargin = $this->theadMargins[
'top'];
 
 4543           if (!$this->
empty_string($this->thead) AND (!$this->inthead)) {
 
 4548                $this->lMargin = $this->theadMargins[
'lmargin'] + ($this->pagedim[
$this->page][
'olm'] - $this->pagedim[$this->theadMargins[
'page']][
'olm']);
 
 4549                $this->rMargin = $this->theadMargins[
'rmargin'] + ($this->pagedim[
$this->page][
'orm'] - $this->pagedim[$this->theadMargins[
'page']][
'orm']);
 
 4550                $this->cell_padding = $this->theadMargins[
'cell_padding'];
 
 4557                if ($this->theadMargins[
'cell']) {
 
 4559                          $this->x -= $this->cell_padding[
'R'];
 
 4561                          $this->x += $this->cell_padding[
'L'];
 
 4565                $this->
writeHTML($this->thead, 
false, 
false, 
false, 
false, 
'');
 
 4567                if (!isset($this->theadMargins[
'top'])) {
 
 4571                if (!isset($this->columns[0][
'th'])) {
 
 4572                     $this->columns[0][
'th'] = array();
 
 4574                $this->columns[0][
'th'][
'\''.$this->page.
'\''] = 
$this->y;
 
 4578                $this->lMargin = $prev_lMargin;
 
 4579                $this->rMargin = $prev_rMargin;
 
 4580                $this->cell_padding = $prev_cell_padding;
 
 4609           if (!isset($this->spot_colors[$name])) {
 
 4610                $i = (1 + count($this->spot_colors));
 
 4611                $this->spot_colors[$name] = array(
'C' => $c, 
'M' => $m, 
'Y' => 
$y, 
'K' => 
$k, 
'name' => $name, 
'i' => 
$i);
 
 4623           if (isset($this->spot_colors[$name])) {
 
 4624                return $this->spot_colors[$name];
 
 4626           $color = preg_replace(
'/[\s]*/', 
'', $name); 
 
 4627           $color = strtolower($color);
 
 4628           if (isset($this->spotcolor[$color])) {
 
 4629                $this->
AddSpotColor($this->spotcolor[$color][4], $this->spotcolor[$color][0], $this->spotcolor[$color][1], $this->spotcolor[$color][2], $this->spotcolor[$color][3]);
 
 4630                return $this->spot_colors[$this->spotcolor[$color][4]];
 
 4647                $this->
Error(
'Undefined spot color: '.$name.
', you must add it on the spotcolors.php file.');
 
 4649           $tint = (max(0, min(100, $tint)) / 100);
 
 4650           $pdfcolor = sprintf(
'/CS%d ', $this->spot_colors[$name][
'i']);
 
 4653                     $pdfcolor .= sprintf(
'CS %F SCN', $tint);
 
 4654                     $this->DrawColor = $pdfcolor;
 
 4659                     $pdfcolor .= sprintf(
'cs %F scn', $tint);
 
 4660                     $this->FillColor = $pdfcolor;
 
 4665                     $pdfcolor .= sprintf(
'cs %F scn', $tint);
 
 4666                     $this->TextColor = $pdfcolor;
 
 4672           if ($this->state == 2) {
 
 4673                $this->
_out($pdfcolor);
 
 4675           if ($this->inxobj) {
 
 4677                $this->xobjects[
$this->xobjid][
'spot_colors'][$name] = $this->spot_colors[$name];
 
 4730           if (is_array($color)) {
 
 4731                $color = array_values($color);
 
 4733                $c = isset($color[0]) ? $color[0] : -1;
 
 4735                $m = isset($color[1]) ? $color[1] : -1;
 
 4737                $y = isset($color[2]) ? $color[2] : -1;
 
 4739                $k = isset($color[3]) ? $color[3] : -1;
 
 4741                $name = isset($color[4]) ? $color[4] : 
'';
 
 4743                     return $this->
setColor($type, $c, $m, 
$y, 
$k, $ret, $name);
 
 4804      public function setColor($type, $col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=
false, $name=
'') {
 
 4806           if (!is_numeric($col1)) {
 
 4809           if (!is_numeric($col2)) {
 
 4812           if (!is_numeric($col3)) {
 
 4815           if (!is_numeric($col4)) {
 
 4820           if (($col2 == -1) AND ($col3 == -1) AND ($col4 == -1)) {
 
 4822                $col1 = max(0, min(255, $col1));
 
 4823                $intcolor = array(
'G' => $col1);
 
 4824                $pdfcolor = sprintf(
'%F ', ($col1 / 255));
 
 4828                $col1 = max(0, min(255, $col1));
 
 4829                $col2 = max(0, min(255, $col2));
 
 4830                $col3 = max(0, min(255, $col3));
 
 4831                $intcolor = array(
'R' => $col1, 
'G' => $col2, 
'B' => $col3);
 
 4832                $pdfcolor = sprintf(
'%F %F %F ', ($col1 / 255), ($col2 / 255), ($col3 / 255));
 
 4835                $col1 = max(0, min(100, $col1));
 
 4836                $col2 = max(0, min(100, $col2));
 
 4837                $col3 = max(0, min(100, $col3));
 
 4838                $col4 = max(0, min(100, $col4));
 
 4841                     $intcolor = array(
'C' => $col1, 
'M' => $col2, 
'Y' => $col3, 
'K' => $col4);
 
 4842                     $pdfcolor = sprintf(
'%F %F %F %F ', ($col1 / 100), ($col2 / 100), ($col3 / 100), ($col4 / 100));
 
 4846                     $intcolor = array(
'C' => $col1, 
'M' => $col2, 
'Y' => $col3, 
'K' => $col4, 
'name' => $name);
 
 4847                     $this->
AddSpotColor($name, $col1, $col2, $col3, $col4);
 
 4853                     $pdfcolor .= strtoupper($suffix);
 
 4854                     $this->DrawColor = $pdfcolor;
 
 4855                     $this->strokecolor = $intcolor;
 
 4859                     $pdfcolor .= $suffix;
 
 4860                     $this->FillColor = $pdfcolor;
 
 4861                     $this->bgcolor = $intcolor;
 
 4865                     $pdfcolor .= $suffix;
 
 4866                     $this->TextColor = $pdfcolor;
 
 4867                     $this->fgcolor = $intcolor;
 
 4872           if (($type != 
'text') AND ($this->state == 2)) {
 
 4874                     $this->
_out($pdfcolor);
 
 4889           $c = array_values($c);
 
 4891           switch (count($c)) {
 
 4894                     $color .= sprintf(
'%F %F %F %F', (max(0, min(100, floatval($c[0]))) / 100), (max(0, min(100, floatval($c[1]))) / 100), (max(0, min(100, floatval($c[2]))) / 100), (max(0, min(100, floatval($c[3]))) / 100));
 
 4899                     $color .= sprintf(
'%F %F %F', (max(0, min(255, floatval($c[0]))) / 255), (max(0, min(255, floatval($c[1]))) / 255), (max(0, min(255, floatval($c[2]))) / 255));
 
 4904                     $color .= sprintf(
'%F', (max(0, min(255, floatval($c[0]))) / 255));
 
 4925      public function SetDrawColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=
false, $name=
'') {
 
 4926           return $this->
setColor(
'draw', $col1, $col2, $col3, $col4, $ret, $name);
 
 4942      public function SetFillColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=
false, $name=
'') {
 
 4943           return $this->
setColor(
'fill', $col1, $col2, $col3, $col4, $ret, $name);
 
 4959      public function SetTextColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=
false, $name=
'') {
 
 4960           return $this->
setColor(
'text', $col1, $col2, $col3, $col4, $ret, $name);
 
 4975      public function GetStringWidth($s, $fontname=
'', $fontstyle=
'', $fontsize=0, $getarray=
false) {
 
 4997                $this->
SetFont($fontname, $fontstyle, $fontsize, 
'', 
'default', 
false);
 
 5003           foreach ($sa as $ck => $char) {
 
 5005                $cw = $this->
GetCharWidth($char, isset($sa[($ck + 1)]));
 
 5011                $this->
SetFont($prev_FontFamily, $prev_FontStyle, $prev_FontSizePt, 
'', 
'default', 
false);
 
 5031           if (($this->font_spacing < 0) OR (($this->font_spacing > 0) AND $notlast)) {
 
 5035           if ($this->font_stretching != 100) {
 
 5037                $chw *= ($this->font_stretching / 100);
 
 5055           if (isset($this->CurrentFont[
'cw'][$char])) {
 
 5056                $w = $this->CurrentFont[
'cw'][$char];
 
 5057           } 
elseif (isset($this->CurrentFont[
'dw'])) {
 
 5059                $w = $this->CurrentFont[
'dw'];
 
 5060           } 
elseif (isset($this->CurrentFont[
'cw'][32])) {
 
 5062                $w = $this->CurrentFont[
'cw'][32];
 
 5090           while (($file = readdir($fontsdir)) !== 
false) {
 
 5091                if (substr($file, -4) == 
'.php') {
 
 5092                     array_push($this->fontlist, strtolower(basename($file, 
'.php')));
 
 5095           closedir($fontsdir);
 
 5111      public function AddFont($family, $style=
'', $fontfile=
'', $subset=
'default') {
 
 5112           if ($subset === 
'default') {
 
 5115           if ($this->pdfa_mode) {
 
 5122                     $this->
Error(
'Empty font family');
 
 5126           if (substr($family, -1) == 
'I') {
 
 5128                $family = substr($family, 0, -1);
 
 5130           if (substr($family, -1) == 
'B') {
 
 5132                $family = substr($family, 0, -1);
 
 5135           $family = strtolower($family);
 
 5136           if ((!$this->isunicode) AND ($family == 
'arial')) {
 
 5137                $family = 
'helvetica';
 
 5139           if (($family == 
'symbol') OR ($family == 
'zapfdingbats')) {
 
 5142           if ($this->pdfa_mode AND (isset($this->CoreFonts[$family]))) {
 
 5144                $family = 
'pdfa'.$family;
 
 5146           $tempstyle = strtoupper($style);
 
 5149           if (strpos($tempstyle, 
'U') !== 
false) {
 
 5150                $this->underline = 
true;
 
 5152                $this->underline = 
false;
 
 5155           if (strpos($tempstyle, 
'D') !== 
false) {
 
 5156                $this->linethrough = 
true;
 
 5158                $this->linethrough = 
false;
 
 5161           if (strpos($tempstyle, 
'O') !== 
false) {
 
 5162                $this->overline = 
true;
 
 5164                $this->overline = 
false;
 
 5167           if (strpos($tempstyle, 
'B') !== 
false) {
 
 5171           if (strpos($tempstyle, 
'I') !== 
false) {
 
 5175           $fontkey = $family.$style;
 
 5176           $font_style = $style.($this->underline ? 
'U' : 
'').($this->linethrough ? 
'D' : 
'').($this->overline ? 
'O' : 
'');
 
 5177           $fontdata = array(
'fontkey' => $fontkey, 
'family' => $family, 
'style' => $font_style);
 
 5180           if ($fb !== 
false) {
 
 5181                if ($this->inxobj) {
 
 5183                     $this->xobjects[
$this->xobjid][
'fonts'][$fontkey] = $fb[
'i'];
 
 5196                $fontdir = dirname($fontfile);
 
 5197                if ($this->
empty_string($fontdir) OR ($fontdir == 
'.')) {
 
 5203           $missing_style = 
false; 
 
 5205           if ($this->
empty_string($fontfile) OR (!file_exists($fontfile))) {
 
 5207                $tmp_fontfile = str_replace(
' ', 
'', $family).strtolower($style).
'.php';
 
 5209                if (($fontdir !== 
false) AND file_exists($fontdir.$tmp_fontfile)) {
 
 5210                     $fontfile = $fontdir.$tmp_fontfile;
 
 5213                } 
elseif (file_exists($tmp_fontfile)) {
 
 5214                     $fontfile = $tmp_fontfile;
 
 5216                     $missing_style = 
true;
 
 5218                     $tmp_fontfile = str_replace(
' ', 
'', $family).
'.php';
 
 5219                     if (($fontdir !== 
false) AND file_exists($fontdir.$tmp_fontfile)) {
 
 5220                          $fontfile = $fontdir.$tmp_fontfile;
 
 5224                          $fontfile = $tmp_fontfile;
 
 5229           if (file_exists($fontfile)) {
 
 5232                $this->
Error(
'Could not include font definition file: '.$family.
'');
 
 5235           if ((!isset($type)) OR (!isset($cw))) {
 
 5236                $this->
Error(
'The font definition file has a bad format: '.$fontfile.
'');
 
 5245           if (!isset($cidinfo) OR $this->
empty_string($cidinfo)) {
 
 5246                $cidinfo = array(
'Registry'=>
'Adobe', 
'Ordering'=>
'Identity', 
'Supplement'=>0);
 
 5247                $cidinfo[
'uni2cid'] = array();
 
 5266                if (isset($desc[
'MissingWidth']) AND ($desc[
'MissingWidth'] > 0)) {
 
 5267                     $dw = $desc[
'MissingWidth'];
 
 5268                } 
elseif (isset($cw[32])) {
 
 5275           if ($type == 
'core') {
 
 5276                $name = $this->CoreFonts[$fontkey];
 
 5278           } 
elseif (($type == 
'TrueType') OR ($type == 
'Type1')) {
 
 5280           } 
elseif ($type == 
'TrueTypeUnicode') {
 
 5281                $enc = 
'Identity-H';
 
 5282           } 
elseif ($type == 
'cidfont0') {
 
 5283                if ($this->pdfa_mode) {
 
 5284                     $this->
Error(
'All fonts must be embedded in PDF/A mode!');
 
 5287                $this->
Error(
'Unknow font type: '.$type.
'');
 
 5290           if (!isset($name) OR empty($name)) {
 
 5294           if (($type != 
'core') AND $missing_style) {
 
 5296                $styles = array(
'' => 
'', 
'B' => 
',Bold', 
'I' => 
',Italic', 
'BI' => 
',BoldItalic');
 
 5297                $name .= $styles[$bistyle];
 
 5299                if (strpos($bistyle, 
'B') !== 
false) {
 
 5300                     if (isset($desc[
'StemV'])) {
 
 5302                          $desc[
'StemV'] = round($desc[
'StemV'] * 1.75);
 
 5305                          $desc[
'StemV'] = 123;
 
 5309                if (strpos($bistyle, 
'I') !== 
false) {
 
 5310                     if (isset($desc[
'ItalicAngle'])) {
 
 5311                          $desc[
'ItalicAngle'] -= 11;
 
 5313                          $desc[
'ItalicAngle'] = -11;
 
 5315                     if (isset($desc[
'Flags'])) {
 
 5316                          $desc[
'Flags'] |= 64; 
 
 5318                          $desc[
'Flags'] = 64;
 
 5323           if (!isset($cbbox)) {
 
 5327           $subsetchars = array_fill(0, 255, 
true);
 
 5328           $this->
setFontBuffer($fontkey, array(
'fontkey' => $fontkey, 
'i' => $this->numfonts, 
'type' => $type, 
'name' => $name, 
'desc' => $desc, 
'up' => $up, 
'ut' => $ut, 
'cw' => $cw, 
'cbbox' => $cbbox, 
'dw' => $dw, 
'enc' => $enc, 
'cidinfo' => $cidinfo, 
'file' => $file, 
'ctg' => $ctg, 
'subset' => $subset, 
'subsetchars' => $subsetchars));
 
 5329           if ($this->inxobj) {
 
 5333           if (isset($diff) AND (!empty($diff))) {
 
 5336                $nb = count($this->diffs);
 
 5337                for (
$i=1; 
$i <= $nb; ++
$i) {
 
 5338                     if ($this->diffs[
$i] == $diff) {
 
 5345                     $this->diffs[$d] = $diff;
 
 5350                if (!isset($this->FontFiles[$file])) {
 
 5351                     if ((strcasecmp($type,
'TrueType') == 0) OR (strcasecmp($type, 
'TrueTypeUnicode') == 0)) {
 
 5352                          $this->FontFiles[$file] = array(
'length1' => $originalsize, 
'fontdir' => $fontdir, 
'subset' => $subset, 
'fontkeys' => array($fontkey));
 
 5353                     } 
elseif ($type != 
'core') {
 
 5354                          $this->FontFiles[$file] = array(
'length1' => $size1, 
'length2' => $size2, 
'fontdir' => $fontdir, 
'subset' => $subset, 
'fontkeys' => array($fontkey));
 
 5358                     $this->FontFiles[$file][
'subset'] = ($this->FontFiles[$file][
'subset'] AND $subset);
 
 5359                     if (!in_array($fontkey, $this->FontFiles[$file][
'fontkeys'])) {
 
 5360                          $this->FontFiles[$file][
'fontkeys'][] = $fontkey;
 
 5384      public function SetFont($family, $style=
'', $size=null, $fontfile=
'', $subset=
'default', $out=
true) {
 
 5386           if ($size === null) {
 
 5393           $fontdata = $this->
AddFont($family, $style, $fontfile, $subset);
 
 5394           $this->FontFamily = $fontdata[
'family'];
 
 5395           $this->FontStyle = $fontdata[
'style'];
 
 5396           $this->CurrentFont = $this->
getFontBuffer($fontdata[
'fontkey']);
 
 5410           $this->FontSizePt = $size;
 
 5412           $this->FontSize = $size / 
$this->k;
 
 5414           if (isset($this->CurrentFont[
'desc'][
'FontBBox'])) {
 
 5415                $bbox = explode(
' ', substr($this->CurrentFont[
'desc'][
'FontBBox'], 1, -1));
 
 5416                $font_height = ((intval($bbox[3]) - intval($bbox[1])) * $size / 1000);
 
 5418                $font_height = $size * 1.219;
 
 5420           if (isset($this->CurrentFont[
'desc'][
'Ascent']) AND ($this->CurrentFont[
'desc'][
'Ascent'] > 0)) {
 
 5421                $font_ascent = ($this->CurrentFont[
'desc'][
'Ascent'] * $size / 1000);
 
 5423           if (isset($this->CurrentFont[
'desc'][
'Descent']) AND ($this->CurrentFont[
'desc'][
'Descent'] <= 0)) {
 
 5424                $font_descent = (- $this->CurrentFont[
'desc'][
'Descent'] * $size / 1000);
 
 5426           if (!isset($font_ascent) AND !isset($font_descent)) {
 
 5428                $font_ascent = 0.76 * $font_height;
 
 5429                $font_descent = $font_height - $font_ascent;
 
 5430           } 
elseif (!isset($font_descent)) {
 
 5431                $font_descent = $font_height - $font_ascent;
 
 5432           } 
elseif (!isset($font_ascent)) {
 
 5433                $font_ascent = $font_height - $font_descent;
 
 5435           $this->FontAscent = ($font_ascent / 
$this->k);
 
 5436           $this->FontDescent = ($font_descent / 
$this->k);
 
 5437           if ($out AND ($this->page > 0) AND (isset($this->CurrentFont[
'i'])) AND ($this->state == 2)) {
 
 5438                $this->
_out(sprintf(
'BT /F%d %F Tf ET', $this->CurrentFont[
'i'], $this->FontSizePt));
 
 5450           if (isset($this->CurrentFont[
'desc'][
'FontBBox'])) {
 
 5451                $tmpbbox = explode(
' ', substr($this->CurrentFont[
'desc'][
'FontBBox'], 1, -1));
 
 5452                $fbbox = array_map(array($this,
'getAbsFontMeasure'), $tmpbbox);
 
 5455                if (isset($this->CurrentFont[
'desc'][
'MaxWidth'])) {
 
 5456                     $maxw = $this->
getAbsFontMeasure(intval($this->CurrentFont[
'desc'][
'MaxWidth']));
 
 5459                     if (isset($this->CurrentFont[
'desc'][
'MissingWidth'])) {
 
 5460                          $maxw = max($maxw, $this->CurrentFont[
'desc'][
'MissingWidth']);
 
 5462                     if (isset($this->CurrentFont[
'desc'][
'AvgWidth'])) {
 
 5463                          $maxw = max($maxw, $this->CurrentFont[
'desc'][
'AvgWidth']);
 
 5465                     if (isset($this->CurrentFont[
'dw'])) {
 
 5466                          $maxw = max($maxw, $this->CurrentFont[
'dw']);
 
 5468                     foreach ($this->CurrentFont[
'cw'] as $char => 
$w) {
 
 5469                          $maxw = max($maxw, 
$w);
 
 5476                $fbbox = array(0, -$this->FontDescent, $maxw, $this->FontAscent);
 
 5488           return ($s * $this->FontSize / 1000);
 
 5498           if (isset($this->CurrentFont[
'cbbox'][$char])) {
 
 5499                return array_map(array($this,
'getAbsFontMeasure'), $this->CurrentFont[
'cbbox'][intval($char)]);
 
 5515           $fontdata = $this->
AddFont($font, $style);
 
 5517           if (isset($fontinfo[
'desc'][
'Descent']) AND ($fontinfo[
'desc'][
'Descent'] <= 0)) {
 
 5518                $descent = (- $fontinfo[
'desc'][
'Descent'] * $size / 1000);
 
 5520                $descent = (1.219 * 0.24 * $size);
 
 5522           return ($descent / $this->k);
 
 5536           $fontdata = $this->
AddFont($font, $style);
 
 5538           if (isset($fontinfo[
'desc'][
'Ascent']) AND ($fontinfo[
'desc'][
'Ascent'] > 0)) {
 
 5539                $ascent = ($fontinfo[
'desc'][
'Ascent'] * $size / 1000);
 
 5541                $ascent = 1.219 * 0.76 * $size;
 
 5543           return ($ascent / $this->k);
 
 5556           if (is_string($char)) {
 
 5563                     return (isset($this->CurrentFont[
'cw'][intval($char)]));
 
 5567           $fontdata = $this->
AddFont($font, $style);
 
 5569           return (isset($fontinfo[
'cw'][intval($char)]));
 
 5589           $fontdata = $this->
AddFont($font, $style);
 
 5592           foreach ($uniarr as 
$k => $chr) {
 
 5593                if (!isset($fontinfo[
'cw'][$chr])) {
 
 5595                     if (isset($subs[$chr])) {
 
 5597                          if (is_array($subs[$chr])) {
 
 5598                               foreach($subs[$chr] as $s) {
 
 5599                                    if (isset($fontinfo[
'cw'][$s])) {
 
 5604                          } 
elseif (isset($fontinfo[
'cw'][$subs[$chr]])) {
 
 5605                               $uniarr[
$k] = $subs[$chr];
 
 5620           $this->default_monospaced_font = $font;
 
 5632           $n = count($this->links) + 1;
 
 5633           $this->links[
$n] = array(0, 0);
 
 5653           $this->links[$link] = array(
$page, 
$y);
 
 5687           if ($this->inxobj) {
 
 5689                $this->xobjects[
$this->xobjid][
'annotations'][] = array(
'x' => 
$x, 
'y' => 
$y, 
'w' => 
$w, 
'h' => 
$h, 
'text' => $text, 
'opt' => $opt, 
'spaces' => $spaces);
 
 5701           if (isset($this->transfmatrix) AND !empty($this->transfmatrix)) {
 
 5702                for (
$i=$this->transfmatrix_key; 
$i > 0; --
$i) {
 
 5703                     $maxid = count($this->transfmatrix[
$i]) - 1;
 
 5704                     for ($j=$maxid; $j >= 0; --$j) {
 
 5705                          $ctm = $this->transfmatrix[
$i][$j];
 
 5706                          if (isset($ctm[
'a'])) {
 
 5708                               $y = ($this->h - 
$y) * $this->k;
 
 5714                               $x1 = ($ctm[
'a'] * $xt) + ($ctm[
'c'] * $yt) + $ctm[
'e'];
 
 5715                               $y1 = ($ctm[
'b'] * $xt) + ($ctm[
'd'] * $yt) + $ctm[
'f'];
 
 5719                               $x2 = ($ctm[
'a'] * $xt) + ($ctm[
'c'] * $yt) + $ctm[
'e'];
 
 5720                               $y2 = ($ctm[
'b'] * $xt) + ($ctm[
'd'] * $yt) + $ctm[
'f'];
 
 5724                               $x3 = ($ctm[
'a'] * $xt) + ($ctm[
'c'] * $yt) + $ctm[
'e'];
 
 5725                               $y3 = ($ctm[
'b'] * $xt) + ($ctm[
'd'] * $yt) + $ctm[
'f'];
 
 5729                               $x4 = ($ctm[
'a'] * $xt) + ($ctm[
'c'] * $yt) + $ctm[
'e'];
 
 5730                               $y4 = ($ctm[
'b'] * $xt) + ($ctm[
'd'] * $yt) + $ctm[
'f'];
 
 5732                               $x = min($x1, $x2, $x3, $x4);
 
 5733                               $y = max($y1, $y2, $y3, $y4);
 
 5734                               $w = (max($x1, $x2, $x3, $x4) - 
$x) / $this->k;
 
 5735                               $h = (
$y - min($y1, $y2, $y3, $y4)) / $this->k;
 
 5742           if ($this->page <= 0) {
 
 5747           if (!isset($this->PageAnnots[
$page])) {
 
 5748                $this->PageAnnots[
$page] = array();
 
 5751           $this->PageAnnots[
$page][] = array(
'n' => $this->n, 
'x' => 
$x, 
'y' => 
$y, 
'w' => 
$w, 
'h' => 
$h, 
'txt' => $text, 
'opt' => $opt, 
'numspaces' => $spaces);
 
 5752           if (!$this->pdfa_mode) {
 
 5753                if ((($opt[
'Subtype'] == 
'FileAttachment') OR ($opt[
'Subtype'] == 
'Sound')) AND (!$this->
empty_string($opt[
'FS'])) AND file_exists($opt[
'FS']) AND (!isset($this->embeddedfiles[basename($opt[
'FS'])]))) {
 
 5755                     $this->embeddedfiles[basename($opt[
'FS'])] = array(
'n' => $this->n, 
'file' => $opt[
'FS']);
 
 5759           if (isset($opt[
'mk'][
'i']) AND file_exists($opt[
'mk'][
'i'])) {
 
 5760                $this->
Image($opt[
'mk'][
'i'], 
'', 
'', 10, 10, 
'', 
'', 
'', 
false, 300, 
'', 
false, 
false, 0, 
false, 
true);
 
 5762           if (isset($opt[
'mk'][
'ri']) AND file_exists($opt[
'mk'][
'ri'])) {
 
 5763                $this->
Image($opt[
'mk'][
'ri'], 
'', 
'', 0, 0, 
'', 
'', 
'', 
false, 300, 
'', 
false, 
false, 0, 
false, 
true);
 
 5765           if (isset($opt[
'mk'][
'ix']) AND file_exists($opt[
'mk'][
'ix'])) {
 
 5766                $this->
Image($opt[
'mk'][
'ix'], 
'', 
'', 0, 0, 
'', 
'', 
'', 
false, 300, 
'', 
false, 
false, 0, 
false, 
true);
 
 5777           if ($this->pdfa_mode) {
 
 5781           reset($this->embeddedfiles);
 
 5782           foreach ($this->embeddedfiles as 
$filename => $filedata) {
 
 5783                $data = file_get_contents($filedata[
'file']);
 
 5785                if ($this->compress) {
 
 5787                     $filter = 
' /Filter /FlateDecode';
 
 5790                $out = $this->
_getobj($filedata[
'n']).
"\n";
 
 5791                $out .= 
'<< /Type /EmbeddedFile'.$filter.
' /Length '.strlen($stream).
' >>';
 
 5792                $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
 5793                $out .= 
"\n".
'endobj';
 
 5821      public function Text(
$x, 
$y, $txt, $fstroke=
false, $fclip=
false, $ffill=
true, $border=0, $ln=0, $align=
'', $fill=
false, $link=
'', $stretch=0, $ignore_min_height=
false, $calign=
'T', $valign=
'M', $rtloff=
false) {
 
 5826           $this->
Cell(0, 0, $txt, $border, $ln, $align, $fill, $link, $stretch, $ignore_min_height, $calign, $valign);
 
 5842           if ($this->num_columns > 1) {
 
 5844                if ($this->current_column < ($this->num_columns - 1)) {
 
 5847                } 
elseif ($this->AutoPageBreak) {
 
 5877                     $this->
AddPage($this->CurOrientation);
 
 5879                     $oldpage = $this->page - 1;
 
 5881                          if ($this->pagedim[$this->page][
'orm'] != $this->pagedim[$oldpage][
'orm']) {
 
 5882                               $this->x = 
$x - ($this->pagedim[
$this->page][
'orm'] - $this->pagedim[$oldpage][
'orm']);
 
 5887                          if ($this->pagedim[$this->page][
'olm'] != $this->pagedim[$oldpage][
'olm']) {
 
 5888                               $this->x = 
$x + ($this->pagedim[
$this->page][
'olm'] - $this->pagedim[$oldpage][
'olm']);
 
 5896           if ($current_page != $this->page) {
 
 5920           $txt = preg_replace(
'/([\\xc2]{1}[\\xad]{1})/', 
'', $txt);
 
 5921           if (!$this->isunicode) {
 
 5922                $txt = preg_replace(
'/([\\xad]{1})/', 
'', $txt);
 
 5946      public function Cell(
$w, 
$h=0, $txt=
'', $border=0, $ln=0, $align=
'', $fill=
false, $link=
'', $stretch=0, $ignore_min_height=
false, $calign=
'T', $valign=
'M') {
 
 5950           if (!$ignore_min_height) {
 
 5951                $min_cell_height = ($this->FontSize * 
$this->cell_height_ratio) + $this->cell_padding[
'T'] + $this->cell_padding[
'B'];
 
 5952                if (
$h < $min_cell_height) {
 
 5953                     $h = $min_cell_height;
 
 5956           $this->
checkPageBreak(
$h + $this->cell_margin[
'T'] + $this->cell_margin[
'B']);
 
 5958           if ($this->txtshadow[
'enabled']) {
 
 5967                $this->x += $this->txtshadow[
'depth_w'];
 
 5968                $this->y += $this->txtshadow[
'depth_h'];
 
 5972                if ($this->txtshadow[
'opacity'] != 
$alpha[
'CA']) {
 
 5973                     $this->
setAlpha($this->txtshadow[
'opacity'], $this->txtshadow[
'blend_mode']);
 
 5975                if ($this->state == 2) {
 
 5976                     $this->
_out($this->
getCellCode(
$w, 
$h, $txt, $border, $ln, $align, $fill, $link, $stretch, 
true, $calign, $valign));
 
 5984                if ($this->txtshadow[
'opacity'] != 
$alpha[
'CA']) {
 
 5988           if ($this->state == 2) {
 
 5989                $this->
_out($this->
getCellCode(
$w, 
$h, $txt, $border, $ln, $align, $fill, $link, $stretch, 
true, $calign, $valign));
 
 5991           $this->cell_padding = $prev_cell_padding;
 
 5992           $this->cell_margin = $prev_cell_margin;
 
 6015      protected function getCellCode(
$w, 
$h=0, $txt=
'', $border=0, $ln=0, $align=
'', $fill=
false, $link=
'', $stretch=0, $ignore_min_height=
false, $calign=
'T', $valign=
'M') {
 
 6017           $txt = str_replace($this->
unichr(160), 
' ', $txt);
 
 6023           if (!$ignore_min_height) {
 
 6024                $min_cell_height = ($this->FontSize * 
$this->cell_height_ratio) + $this->cell_padding[
'T'] + $this->cell_padding[
'B'];
 
 6025                if (
$h < $min_cell_height) {
 
 6026                     $h = $min_cell_height;
 
 6033                $x = $this->x - $this->cell_margin[
'R'];
 
 6035                $x = $this->x + $this->cell_margin[
'L'];
 
 6037           $y = $this->y + $this->cell_margin[
'T'];
 
 6047                               $y -= $this->cell_padding[
'T'];
 
 6098                               $y -= (
$h - $this->cell_padding[
'B']);
 
 6132                     $yt = 
$y + $this->cell_padding[
'T'];
 
 6153                     $w = $this->w - $this->rMargin - 
$x;
 
 6158           if (is_string($border) AND (strlen($border) == 4)) {
 
 6162           if ($fill OR ($border == 1)) {
 
 6164                     $op = ($border == 1) ? 
'B' : 
'f';
 
 6173                $s .= sprintf(
'%F %F %F %F re %s ', $xk, (($this->h - 
$y) * 
$k), (
$w * $k), (-
$h * $k), $op);
 
 6179                if ($this->isunicode) {
 
 6180                     if (($this->CurrentFont[
'type'] == 
'core') OR ($this->CurrentFont[
'type'] == 
'TrueType') OR ($this->CurrentFont[
'type'] == 
'Type1')) {
 
 6190                               $longtail = array(0x0e1b, 0x0e1d, 0x0e1f);
 
 6192                               $lowtail = array(0x0e0e, 0x0e0f);
 
 6194                               $upvowel = array(0x0e31, 0x0e34, 0x0e35, 0x0e36, 0x0e37);
 
 6196                               $tonemark = array(0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c);
 
 6198                               $lowvowel = array(0x0e38, 0x0e39, 0x0e3a);
 
 6200                               for (
$i = 0; 
$i < $numchars; 
$i++) {
 
 6205                                         $chn = (
$i < ($numchars - 1)) ? 
$unicode[(
$i + 1)] : 0;
 
 6206                                         if (in_array($ch0, $tonemark)) {
 
 6207                                              if ($chn == 0x0e33) {
 
 6209                                                   if (in_array($ch1, $longtail)) {
 
 6216                                              } 
elseif (in_array($ch1, $longtail) OR (in_array($ch2, $longtail) AND in_array($ch1, $lowvowel))) {
 
 6219                                              } 
elseif (in_array($ch1, $upvowel)) {
 
 6220                                                   if (in_array($ch2, $longtail)) {
 
 6231                                         } 
elseif (($ch0 == 0x0e33) AND (in_array($ch1, $longtail) OR (in_array($ch2, $longtail) AND in_array($ch1, $tonemark)))) {
 
 6235                                                   $this->CurrentFont[
'subsetchars'][0xf711] = 
true;
 
 6237                                                   $this->CurrentFont[
'subsetchars'][0x0e32] = 
true;
 
 6241                                         } 
elseif (in_array($ch1, $longtail)) {
 
 6242                                              if ($ch0 == 0x0e31) {
 
 6245                                              } 
elseif (in_array($ch0, $upvowel)) {
 
 6248                                              } 
elseif ($ch0 == 0x0e47) {
 
 6255                                         } 
elseif (in_array($ch1, $lowtail) AND in_array($ch0, $lowvowel)) {
 
 6258                                         } 
elseif (($ch0 == 0x0e0d) AND in_array($chn, $lowvowel)) {
 
 6261                                         } 
elseif (($ch0 == 0x0e10) AND in_array($chn, $lowvowel)) {
 
 6274                               $this->
setFontSubBuffer($this->CurrentFont[
'fontkey'], 
'subsetchars', $this->CurrentFont[
'subsetchars']);
 
 6279                $txt2 = $this->
_escape($txt2);
 
 6289                          $ratio = ((
$w - $this->cell_padding[
'L'] - $this->cell_padding[
'R']) / $width);
 
 6292                     if (($ratio < 1) OR (($ratio > 1) AND (($stretch % 2) == 0))) {
 
 6296                               $this->font_spacing += (
$w - $this->cell_padding[
'L'] - $this->cell_padding[
'R'] - $width) / (max(($this->
GetNumChars($txt) - 1), 1) * ($this->font_stretching / 100));
 
 6299                               $this->font_stretching *= $ratio;
 
 6302                          $width = 
$w - $this->cell_padding[
'L'] - $this->cell_padding[
'R'];
 
 6307                if ($this->font_stretching != 100) {
 
 6309                     $rs .= sprintf(
'BT %F Tz ET ', $this->font_stretching);
 
 6311                if ($this->font_spacing != 0) {
 
 6313                     $rs .= sprintf(
'BT %F Tc ET ', ($this->font_spacing * $this->k));
 
 6315                if ($this->ColorFlag AND ($this->textrendermode < 4)) {
 
 6316                     $s .= 
'q '.$this->TextColor.
' ';
 
 6319                $s .= sprintf(
'BT %d Tr %F w ET ', $this->textrendermode, ($this->textstrokewidth * $this->k));
 
 6321                $ns = substr_count($txt, chr(32));
 
 6324                if (($align == 
'J') AND ($ns > 0)) {
 
 6329                          $spacewidth = -1000 * (
$w - $width - $this->cell_padding[
'L'] - $this->cell_padding[
'R']) / ($ns?$ns:1) / 
$this->FontSize;
 
 6330                          if ($this->font_stretching != 100) {
 
 6332                               $spacewidth /= ($this->font_stretching / 100);
 
 6335                          $txt2 = str_replace(chr(0).chr(32), 
') '.sprintf(
'%F', $spacewidth).
' (', $txt2);
 
 6336                          $unicode_justification = 
true;
 
 6341                          $spacewidth = ((
$w - $width - $this->cell_padding[
'L'] - $this->cell_padding[
'R']) / ($ns?$ns:1)) * $this->k;
 
 6342                          if ($this->font_stretching != 100) {
 
 6344                               $spacewidth /= ($this->font_stretching / 100);
 
 6347                          $rs .= sprintf(
'BT %F Tw ET ', $spacewidth);
 
 6349                     $width = 
$w - $this->cell_padding[
'L'] - $this->cell_padding[
'R'];
 
 6352                $txt2 = str_replace(
"\r", 
' ', $txt2);
 
 6355                          $dx = (
$w - $width) / 2;
 
 6360                               $dx = $this->cell_padding[
'R'];
 
 6362                               $dx = 
$w - $width - $this->cell_padding[
'R'];
 
 6368                               $dx = 
$w - $width - $this->cell_padding[
'L'];
 
 6370                               $dx = $this->cell_padding[
'L'];
 
 6377                               $dx = $this->cell_padding[
'R'];
 
 6379                               $dx = $this->cell_padding[
'L'];
 
 6385                     $xdx = 
$x - $dx - $width;
 
 6391                $s .= sprintf(
'BT %F %F Td [(%s)] TJ ET', $xdk, (($this->h - $basefonty) * $k), $txt2);
 
 6392                if (isset($uniblock)) {
 
 6396                     $spw = ((
$w - $txwidth - $this->cell_padding[
'L'] - $this->cell_padding[
'R']) / ($ns?$ns:1));
 
 6397                     foreach ($uniblock as $uk => $uniarr) {
 
 6398                          if (($uk % 2) == 0) {
 
 6400                               if ($spacewidth != 0) {
 
 6402                                    $xshift += (count(array_keys($uniarr, 32)) * $spw);
 
 6408                               $topchr = $this->
_escape($topchr);
 
 6409                               $s .= sprintf(
' BT %F %F Td [(%s)] TJ ET', ($xdk + ($xshift * $k)), $ty, $topchr);
 
 6413                if ($this->underline) {
 
 6414                     $s .= 
' '.$this->_dounderlinew($xdx, $basefonty, $width);
 
 6416                if ($this->linethrough) {
 
 6417                     $s .= 
' '.$this->_dolinethroughw($xdx, $basefonty, $width);
 
 6419                if ($this->overline) {
 
 6420                     $s .= 
' '.$this->_dooverlinew($xdx, $basefonty, $width);
 
 6422                if ($this->ColorFlag AND ($this->textrendermode < 4)) {
 
 6426                     $this->
Link($xdx, $yt, $width, ($this->FontAscent + $this->FontDescent), $link, $ns);
 
 6433                if ($this->font_spacing != 0) {
 
 6435                     $rs .= 
' BT 0 Tc ET';
 
 6437                if ($this->font_stretching != 100) {
 
 6439                     $rs .= 
' BT 100 Tz ET';
 
 6444                $rs .= 
' BT 0 Tw ET';
 
 6447           $this->font_stretching = $prev_font_stretching;
 
 6448           $this->font_spacing = $prev_font_spacing;
 
 6452                $this->y = 
$y + 
$h + $this->cell_margin[
'B'];
 
 6463                     $this->x = 
$x - 
$w - $this->cell_margin[
'L'];
 
 6465                     $this->x = 
$x + 
$w + $this->cell_margin[
'R'];
 
 6468           $gstyles = 
''.$this->linestyleWidth.
' '.$this->linestyleCap.
' '.$this->linestyleJoin.
' '.$this->linestyleDash.
' '.$this->DrawColor.
' '.$this->FillColor.
"\n";
 
 6470           $this->cell_padding = $prev_cell_padding;
 
 6471           $this->cell_margin = $prev_cell_margin;
 
 6486                $this->CurrentFont[
'subsetchars'][$newchar] = 
true;
 
 6512                $brd = array(
'LRTB' => 
true);
 
 6521                $xeR = (
$x + 
$w) * $k;
 
 6523           $yeL = (($this->h - (
$y + 
$h)) * 
$k);
 
 6524           $yeT = (($this->h - 
$y) * 
$k);
 
 6529           if (is_string($brd)) {
 
 6531                $slen = strlen($brd);
 
 6533                for (
$i = 0; 
$i < $slen; ++
$i) {
 
 6534                     $newbrd[$brd[
$i]] = array(
'cap' => 
'square', 
'join' => 
'miter');
 
 6538           if (isset($brd[
'mode'])) {
 
 6539                $mode = $brd[
'mode'];
 
 6540                unset($brd[
'mode']);
 
 6544           foreach ($brd as $border => $style) {
 
 6545                if (is_array($style) AND !empty($style)) {
 
 6547                     $prev_style = $this->linestyleWidth.
' '.$this->linestyleCap.
' '.$this->linestyleJoin.
' '.$this->linestyleDash.
' '.$this->DrawColor.
' ';
 
 6552                          $off = (($this->LineWidth / 2) * 
$k);
 
 6566                          $off = ($this->LineWidth / 2) * 
$k;
 
 6593                if (strlen($border) == 4) {
 
 6594                     $s .= sprintf(
'%F %F %F %F re S ', $xT, $yT, (
$w * 
$k), (-
$h * $k));
 
 6595                } 
elseif (strlen($border) == 3) {
 
 6596                     if (strpos($border,
'B') === 
false) { 
 
 6597                          $s .= sprintf(
'%F %F m ', $xL, $yL);
 
 6598                          $s .= sprintf(
'%F %F l ', $xT, $yT);
 
 6599                          $s .= sprintf(
'%F %F l ', $xR, $yR);
 
 6600                          $s .= sprintf(
'%F %F l ', $xB, $yB);
 
 6602                     } 
elseif (strpos($border,
'L') === 
false) { 
 
 6603                          $s .= sprintf(
'%F %F m ', $xT, $yT);
 
 6604                          $s .= sprintf(
'%F %F l ', $xR, $yR);
 
 6605                          $s .= sprintf(
'%F %F l ', $xB, $yB);
 
 6606                          $s .= sprintf(
'%F %F l ', $xL, $yL);
 
 6608                     } 
elseif (strpos($border,
'T') === 
false) { 
 
 6609                          $s .= sprintf(
'%F %F m ', $xR, $yR);
 
 6610                          $s .= sprintf(
'%F %F l ', $xB, $yB);
 
 6611                          $s .= sprintf(
'%F %F l ', $xL, $yL);
 
 6612                          $s .= sprintf(
'%F %F l ', $xT, $yT);
 
 6614                     } 
elseif (strpos($border,
'R') === 
false) { 
 
 6615                          $s .= sprintf(
'%F %F m ', $xB, $yB);
 
 6616                          $s .= sprintf(
'%F %F l ', $xL, $yL);
 
 6617                          $s .= sprintf(
'%F %F l ', $xT, $yT);
 
 6618                          $s .= sprintf(
'%F %F l ', $xR, $yR);
 
 6621                } 
elseif (strlen($border) == 2) {
 
 6622                     if ((strpos($border,
'L') !== 
false) AND (strpos($border,
'T') !== 
false)) { 
 
 6623                          $s .= sprintf(
'%F %F m ', $xL, $yL);
 
 6624                          $s .= sprintf(
'%F %F l ', $xT, $yT);
 
 6625                          $s .= sprintf(
'%F %F l ', $xR, $yR);
 
 6627                     } 
elseif ((strpos($border,
'T') !== 
false) AND (strpos($border,
'R') !== 
false)) { 
 
 6628                          $s .= sprintf(
'%F %F m ', $xT, $yT);
 
 6629                          $s .= sprintf(
'%F %F l ', $xR, $yR);
 
 6630                          $s .= sprintf(
'%F %F l ', $xB, $yB);
 
 6632                     } 
elseif ((strpos($border,
'R') !== 
false) AND (strpos($border,
'B') !== 
false)) { 
 
 6633                          $s .= sprintf(
'%F %F m ', $xR, $yR);
 
 6634                          $s .= sprintf(
'%F %F l ', $xB, $yB);
 
 6635                          $s .= sprintf(
'%F %F l ', $xL, $yL);
 
 6637                     } 
elseif ((strpos($border,
'B') !== 
false) AND (strpos($border,
'L') !== 
false)) { 
 
 6638                          $s .= sprintf(
'%F %F m ', $xB, $yB);
 
 6639                          $s .= sprintf(
'%F %F l ', $xL, $yL);
 
 6640                          $s .= sprintf(
'%F %F l ', $xT, $yT);
 
 6642                     } 
elseif ((strpos($border,
'L') !== 
false) AND (strpos($border,
'R') !== 
false)) { 
 
 6643                          $s .= sprintf(
'%F %F m ', $xL, $yL);
 
 6644                          $s .= sprintf(
'%F %F l ', $xT, $yT);
 
 6646                          $s .= sprintf(
'%F %F m ', $xR, $yR);
 
 6647                          $s .= sprintf(
'%F %F l ', $xB, $yB);
 
 6649                     } 
elseif ((strpos($border,
'T') !== 
false) AND (strpos($border,
'B') !== 
false)) { 
 
 6650                          $s .= sprintf(
'%F %F m ', $xT, $yT);
 
 6651                          $s .= sprintf(
'%F %F l ', $xR, $yR);
 
 6653                          $s .= sprintf(
'%F %F m ', $xB, $yB);
 
 6654                          $s .= sprintf(
'%F %F l ', $xL, $yL);
 
 6658                     if (strpos($border,
'L') !== 
false) { 
 
 6659                          $s .= sprintf(
'%F %F m ', $xL, $yL);
 
 6660                          $s .= sprintf(
'%F %F l ', $xT, $yT);
 
 6662                     } 
elseif (strpos($border,
'T') !== 
false) { 
 
 6663                          $s .= sprintf(
'%F %F m ', $xT, $yT);
 
 6664                          $s .= sprintf(
'%F %F l ', $xR, $yR);
 
 6666                     } 
elseif (strpos($border,
'R') !== 
false) { 
 
 6667                          $s .= sprintf(
'%F %F m ', $xR, $yR);
 
 6668                          $s .= sprintf(
'%F %F l ', $xB, $yB);
 
 6670                     } 
elseif (strpos($border,
'B') !== 
false) { 
 
 6671                          $s .= sprintf(
'%F %F m ', $xB, $yB);
 
 6672                          $s .= sprintf(
'%F %F l ', $xL, $yL);
 
 6676                if (is_array($style) AND !empty($style)) {
 
 6678                     $s .= 
"\n".$this->linestyleWidth.
' '.$this->linestyleCap.
' '.$this->linestyleJoin.
' '.$this->linestyleDash.
' '.$this->DrawColor.
"\n";
 
 6709      public function MultiCell(
$w, 
$h, $txt, $border=0, $align=
'J', $fill=
false, $ln=1, 
$x=
'', 
$y=
'', $reseth=
true, $stretch=0, $ishtml=
false, $autopadding=
true, $maxh=0, $valign=
'T', $fitcell=
false) {
 
 6716           $this->cell_padding[
'T'] = 0;
 
 6717           $this->cell_padding[
'B'] = 0;
 
 6729           if ((
$h > 0) AND $this->
inPageBody() AND ((
$y + 
$h + $mc_margin[
'T'] + $mc_margin[
'B']) > $this->PageBreakTrigger)) {
 
 6731                $newh = ($this->PageBreakTrigger - 
$y);
 
 6732                $resth = (
$h - $newh); 
 
 6747           $oy = 
$y + $mc_margin[
'T'];
 
 6749                $ox = ($this->w - 
$x - $mc_margin[
'R']);
 
 6751                $ox = (
$x + $mc_margin[
'L']);
 
 6758                     $w = ($this->x - $this->lMargin - $mc_margin[
'L']);
 
 6760                     $w = ($this->w - $this->x - $this->rMargin - $mc_margin[
'R']);
 
 6767                $this->rMargin = ($this->w - 
$this->x);
 
 6768                $this->lMargin = ($this->x - 
$w);
 
 6771                $this->rMargin = ($this->w - $this->x - 
$w);
 
 6777                $this->y += $mc_padding[
'T'];
 
 6780                $this->
writeHTML($txt, 
true, 
false, $reseth, 
true, $align);
 
 6787                     $text_height = $this->
getStringHeight(
$w, $txt, $reseth, $autopadding, $mc_padding, $border);
 
 6792                          $prev_text_height = $text_height;
 
 6794                          while ($maxit > 0) {
 
 6795                               $fmid = (($fmax + $fmin) / 2);
 
 6798                               $text_height = $this->
getStringHeight(
$w, $txt, $reseth, $autopadding, $mc_padding, $border);
 
 6799                               if (($text_height == $maxh) OR (($text_height < $maxh) AND ($fmin >= ($fmax - 0.01)))) {
 
 6801                               } 
elseif ($text_height < $maxh) {
 
 6810                     if ($text_height < $maxh) {
 
 6811                          if ($valign == 
'M') {
 
 6813                               $this->y += (($maxh - $text_height) / 2);
 
 6814                          } 
elseif ($valign == 
'B') {
 
 6816                               $this->y += ($maxh - $text_height);
 
 6820                $nl = $this->
Write($this->lasth, $txt, 
'', 0, $align, 
true, $stretch, 
false, 
true, $maxh, 0, $mc_margin);
 
 6828                $this->y += $mc_padding[
'B'];
 
 6835                $skip = ($endpage - $startpage);
 
 6837                while ($tmpresth > 0) {
 
 6842                     if ($this->num_columns > 1) {
 
 6854           if ($this->num_columns == 0) {
 
 6855                $this->num_columns = 1;
 
 6859           $this->check_page_regions = 
false;
 
 6861           $border_start = $this->
getBorderMode($border, $position=
'start');
 
 6862           $border_end = $this->
getBorderMode($border, $position=
'end');
 
 6863           $border_middle = $this->
getBorderMode($border, $position=
'middle');
 
 6868                if ($this->num_columns < 2) {
 
 6874                if (
$page > $startpage) {
 
 6875                     if (($this->rtl) AND ($this->pagedim[
$page][
'orm'] != $this->pagedim[$startpage][
'orm'])) {
 
 6876                          $this->x -= ($this->pagedim[
$page][
'orm'] - $this->pagedim[$startpage][
'orm']);
 
 6877                     } 
elseif ((!$this->rtl) AND ($this->pagedim[
$page][
'olm'] != $this->pagedim[$startpage][
'olm'])) {
 
 6878                          $this->x += ($this->pagedim[
$page][
'olm'] - $this->pagedim[$startpage][
'olm']);
 
 6881                if ($startpage == $endpage) {
 
 6883                     for ($column = $startcolumn; $column <= $endcolumn; ++$column) { 
 
 6886                               $this->x -= $mc_margin[
'R'];
 
 6888                               $this->x += $mc_margin[
'L'];
 
 6890                          if ($startcolumn == $endcolumn) { 
 
 6892                               $h = max(
$h, ($currentY - $oy));
 
 6894                          } 
elseif ($column == $startcolumn) { 
 
 6895                               $cborder = $border_start;
 
 6898                          } 
elseif ($column == $endcolumn) { 
 
 6899                               $cborder = $border_end;
 
 6905                               $cborder = $border_middle;
 
 6909                          $ccode .= $this->
getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
 6915                               $this->x -= $mc_margin[
'R'];
 
 6917                               $this->x += $mc_margin[
'L'];
 
 6919                          if ($column == $startcolumn) { 
 
 6920                               $cborder = $border_start;
 
 6924                               $cborder = $border_middle;
 
 6928                          $ccode .= $this->
getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
 6931                     for ($column = 0; $column <= $endcolumn; ++$column) { 
 
 6934                               $this->x -= $mc_margin[
'R'];
 
 6936                               $this->x += $mc_margin[
'L'];
 
 6938                          if ($column == $endcolumn) {
 
 6940                               $cborder = $border_end;
 
 6947                               $cborder = $border_middle;
 
 6951                          $ccode .= $this->
getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
 6957                               $this->x -= $mc_margin[
'R'];
 
 6959                               $this->x += $mc_margin[
'L'];
 
 6961                          $cborder = $border_middle;
 
 6964                          $ccode .= $this->
getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
 6967                if ($cborder OR $fill) {
 
 6968                     $offsetlen = strlen($ccode);
 
 6970                     if ($this->inxobj) {
 
 6972                          if (end($this->xobjects[$this->xobjid][
'transfmrk']) !== 
false) {
 
 6973                               $pagemarkkey = key($this->xobjects[$this->xobjid][
'transfmrk']);
 
 6974                               $pagemark = $this->xobjects[
$this->xobjid][
'transfmrk'][$pagemarkkey];
 
 6975                               $this->xobjects[
$this->xobjid][
'transfmrk'][$pagemarkkey] += $offsetlen;
 
 6981                          $pstart = substr($pagebuff, 0, $pagemark);
 
 6982                          $pend = substr($pagebuff, $pagemark);
 
 6983                          $this->xobjects[
$this->xobjid][
'outdata'] = $pstart.$ccode.$pend;
 
 6985                          if (end($this->transfmrk[$this->page]) !== 
false) {
 
 6986                               $pagemarkkey = key($this->transfmrk[$this->page]);
 
 6987                               $pagemark = $this->transfmrk[
$this->page][$pagemarkkey];
 
 6988                               $this->transfmrk[
$this->page][$pagemarkkey] += $offsetlen;
 
 6989                          } 
elseif ($this->InFooter) {
 
 6997                          $pstart = substr($pagebuff, 0, $pagemark);
 
 6998                          $pend = substr($pagebuff, $pagemark);
 
 7006           $currentY = $this->
GetY();
 
 7008           if ($this->num_columns > 1) {
 
 7014                if ($this->page > $startpage) {
 
 7016                     $dl = ($this->pagedim[
$this->page][
'olm'] - $this->pagedim[$startpage][
'olm']);
 
 7017                     $dr = ($this->pagedim[
$this->page][
'orm'] - $this->pagedim[$startpage][
'orm']);
 
 7018                     if (($dl != 0) OR ($dr != 0)) {
 
 7019                          $this->lMargin += $dl;
 
 7020                          $this->rMargin += $dr;
 
 7026                $this->
SetY($currentY + $mc_margin[
'B']);
 
 7028                     $this->
SetX(
$x + 
$w + $mc_margin[
'L'] + $mc_margin[
'R']);
 
 7034                $this->
SetX(
$x + 
$w + $mc_margin[
'L'] + $mc_margin[
'R']);
 
 7037           $this->cell_padding = $prev_cell_padding;
 
 7038           $this->cell_margin = $prev_cell_margin;
 
 7053           if ((!$this->opencell) OR empty($brd)) {
 
 7059           if (is_string($brd)) {
 
 7061                $slen = strlen($brd);
 
 7063                for (
$i = 0; 
$i < $slen; ++
$i) {
 
 7064                     $newbrd[$brd[
$i]] = array(
'cap' => 
'square', 
'join' => 
'miter');
 
 7068           foreach ($brd as $border => $style) {
 
 7069                switch ($position) {
 
 7071                          if (strpos($border, 
'B') !== 
false) {
 
 7073                               $newkey = str_replace(
'B', 
'', $border);
 
 7074                               if (strlen($newkey) > 0) {
 
 7075                                    $brd[$newkey] = $style;
 
 7077                               unset($brd[$border]);
 
 7082                          if (strpos($border, 
'B') !== 
false) {
 
 7084                               $newkey = str_replace(
'B', 
'', $border);
 
 7085                               if (strlen($newkey) > 0) {
 
 7086                                    $brd[$newkey] = $style;
 
 7088                               unset($brd[$border]);
 
 7091                          if (strpos($border, 
'T') !== 
false) {
 
 7093                               $newkey = str_replace(
'T', 
'', $border);
 
 7094                               if (strlen($newkey) > 0) {
 
 7095                                    $brd[$newkey] = $style;
 
 7097                               unset($brd[$border]);
 
 7102                          if (strpos($border, 
'T') !== 
false) {
 
 7104                               $newkey = str_replace(
'T', 
'', $border);
 
 7105                               if (strlen($newkey) > 0) {
 
 7106                                    $brd[$newkey] = $style;
 
 7108                               unset($brd[$border]);
 
 7130      public function getNumLines($txt, 
$w=0, $reseth=
false, $autopadding=
true, $cellpadding=
'', $border=0) {
 
 7138           if (is_array($cellpadding)) {
 
 7139                $this->cell_padding = $cellpadding;
 
 7149           $wmax = 
$w - $this->cell_padding[
'L'] - $this->cell_padding[
'R'];
 
 7158           $length = count($chars);
 
 7159           $lastSeparator = -1;
 
 7160           for (
$i = 0; 
$i < $length; ++
$i) {
 
 7161                $charWidth = $charsWidth[
$i];
 
 7162                if (preg_match($this->re_spaces, $this->
unichr($chars[
$i]))) {
 
 7163                     $lastSeparator = 
$i;
 
 7165                if ((($sum + $charWidth) > $wmax) OR ($chars[$i] == 10)) {
 
 7167                     if ($chars[$i] == 10) {
 
 7168                          $lastSeparator = -1;
 
 7170                     } 
elseif ($lastSeparator != -1) {
 
 7171                          $i = $lastSeparator;
 
 7172                          $lastSeparator = -1;
 
 7181           if ($chars[($length - 1)] == 10) {
 
 7184           $this->cell_padding = $prev_cell_padding;
 
 7185           $this->lasth = $prev_lasth;
 
 7236      public function getStringHeight(
$w, $txt, $reseth=
false, $autopadding=
true, $cellpadding=
'', $border=0) {
 
 7240           if (is_array($cellpadding)) {
 
 7241                $this->cell_padding = $cellpadding;
 
 7244           $lines = $this->
getNumLines($txt, 
$w, $reseth, $autopadding, $cellpadding, $border);
 
 7248                $height += ($this->cell_padding[
'T'] + $this->cell_padding[
'B']);
 
 7250           $this->cell_padding = $prev_cell_padding;
 
 7251           $this->lasth = $prev_lasth;
 
 7273      public function Write(
$h, $txt, $link=
'', $fill=
false, $align=
'', $ln=
false, $stretch=0, $firstline=
false, $firstblock=
false, $maxh=0, $wadj=0, $margin=
'') {
 
 7276           if (strlen($txt) == 0) {
 
 7280           if ($margin === 
'') {
 
 7285           $s = str_replace(
"\r", 
'', $txt);
 
 7287           if (preg_match($this->unicode->uni_RE_PATTERN_ARABIC, $s)) {
 
 7293           if ($arabic OR ($this->tmprtl == 
'R') OR preg_match($this->unicode->uni_RE_PATTERN_RTL, $s)) {
 
 7304           array_walk($chrw, array($this, 
'getRawCharWidth'));
 
 7305           $maxchwidth = max($chrw);
 
 7309           $nb = count($chars);
 
 7311           $shy_replacement = 45;
 
 7312           $shy_replacement_char = $this->
unichr($shy_replacement);
 
 7314           $shy_replacement_width = $this->
GetCharWidth($shy_replacement);
 
 7316           $maxy = $this->y + $maxh - 
$h - $this->cell_padding[
'T'] - $this->cell_padding[
'B'];
 
 7326           $wmax = (
$w - $wadj);
 
 7328                $wmax -= ($this->cell_padding[
'L'] + $this->cell_padding[
'R']);
 
 7330           if ((!$firstline) AND (($chrwidth > $wmax) OR ($maxchwidth > $wmax))) {
 
 7335           $row_height = max(
$h, $this->FontSize * $this->cell_height_ratio);
 
 7347                if (($maxh > 0) AND ($this->y >= $maxy) ) {
 
 7354                     if ($align == 
'J') {
 
 7366                          $tmparr = array_slice($chars, $j, (
$i - $j));
 
 7368                               $tmparr = $this->
utf8Bidi($tmparr, $tmpstr, $this->tmprtl);
 
 7373                               $this->endlinex = $startx - $linew;
 
 7375                               $this->endlinex = $startx + $linew;
 
 7387                     if (!empty($tmpstr) OR ($this->y < ($this->PageBreakTrigger - $row_height))) {
 
 7388                          $this->
Cell(
$w, 
$h, $tmpstr, 0, 1, $talign, $fill, $link, $stretch);
 
 7392                          $this->cell_padding = $tmpcellpadding;
 
 7401                     if ((($this->y + $this->lasth) > $this->PageBreakTrigger) AND ($this->
inPageBody())) {
 
 7404                               $this->x -= $margin[
'R'];
 
 7406                               $this->x += $margin[
'L'];
 
 7408                          $this->lMargin += $margin[
'L'];
 
 7409                          $this->rMargin += $margin[
'R'];
 
 7412                     $wmax = (
$w - $this->cell_padding[
'L'] - $this->cell_padding[
'R']);
 
 7421                               OR preg_match($this->re_spaces, $this->
unichr($c))
 
 7423                                    AND (
$i < ($nb - 1))
 
 7424                                    AND @preg_match(
'/[\p{L}]/'.$this->re_space[
'm'], $this->
unichr($pc))
 
 7425                                    AND @preg_match(
'/[\p{L}]/'.$this->re_space[
'm'], $this->
unichr($chars[(
$i + 1)]))
 
 7432                          if (($c == 173) OR ($c == 45)) {
 
 7435                                    $tmp_shy_replacement_width = 0;
 
 7436                                    $tmp_shy_replacement_char = 
'';
 
 7438                                    $tmp_shy_replacement_width = $shy_replacement_width;
 
 7439                                    $tmp_shy_replacement_char = $shy_replacement_char;
 
 7453                     if ((
$l > $wmax) OR (($c == 173) AND ((
$l + $tmp_shy_replacement_width) > $wmax)) ) {
 
 7457                               if (($this->rtl AND ($this->x <= ($this->w - $this->rMargin - $this->cell_padding[
'R'] - $margin[
'R'] - $chrwidth)))
 
 7458                                    OR ((!$this->rtl) AND ($this->x >= ($this->lMargin + $this->cell_padding[
'L'] + $margin[
'L'] + $chrwidth)))) {
 
 7470                                         $tmparr = array_slice($chars, $j, (
$i - $j));
 
 7472                                              $tmparr = $this->
utf8Bidi($tmparr, $tmpstr, $this->tmprtl);
 
 7477                                              $this->endlinex = $startx - $linew;
 
 7479                                              $this->endlinex = $startx + $linew;
 
 7490                                    $this->
Cell(
$w, 
$h, $tmpstr, 0, 1, $align, $fill, $link, $stretch);
 
 7493                                         $this->cell_padding = $tmpcellpadding;
 
 7501                               if ($this->rtl AND (!$firstblock) AND ($sep < 
$i)) {
 
 7508                               $nextstr = preg_split(
'/'.$this->re_space[
'p'].
'/'.$this->re_space[
'm'], $this->
stringTrim($strrest));
 
 7509                               if (isset($nextstr[0]) AND ($this->
GetStringWidth($nextstr[0]) > $pw)) {
 
 7514                                         $tmparr = array_slice($chars, $j, (
$i - $j));
 
 7516                                              $tmparr = $this->
utf8Bidi($tmparr, $tmpstr, $this->tmprtl);
 
 7521                                              $this->endlinex = ($startx - $linew);
 
 7523                                              $this->endlinex = ($startx + $linew);
 
 7534                                    $this->
Cell(
$w, 
$h, $tmpstr, 0, 1, $align, $fill, $link, $stretch);
 
 7537                                         $this->cell_padding = $tmpcellpadding;
 
 7546                                         $shy_width = $tmp_shy_replacement_width;
 
 7548                                              $shy_char_left = $tmp_shy_replacement_char;
 
 7549                                              $shy_char_right = 
'';
 
 7551                                              $shy_char_left = 
'';
 
 7552                                              $shy_char_right = $tmp_shy_replacement_char;
 
 7556                                         $shy_char_left = 
'';
 
 7557                                         $shy_char_right = 
'';
 
 7562                                         $tmparr = array_slice($chars, $j, (($sep + $endspace) - $j));
 
 7564                                              $tmparr = $this->
utf8Bidi($tmparr, $tmpstr, $this->tmprtl);
 
 7569                                              $this->endlinex = $startx - $linew - $shy_width;
 
 7571                                              $this->endlinex = $startx + $linew + $shy_width;
 
 7583                                    $this->
Cell(
$w, 
$h, $shy_char_left.$tmpstr.$shy_char_right, 0, 1, $align, $fill, $link, $stretch);
 
 7586                                         if ($chars[$sep] == 45) {
 
 7590                                         $this->cell_padding = $tmpcellpadding;
 
 7600                          if ((($this->y + $this->lasth) > $this->PageBreakTrigger) AND ($this->
inPageBody())) {
 
 7603                                    $this->x -= $margin[
'R'];
 
 7605                                    $this->x += $margin[
'L'];
 
 7607                               $this->lMargin += $margin[
'L'];
 
 7608                               $this->rMargin += $margin[
'R'];
 
 7611                          $wmax = 
$w - $this->cell_padding[
'L'] - $this->cell_padding[
'R'];
 
 7656                     $tmparr = array_slice($chars, $j, ($nb - $j));
 
 7658                          $tmparr = $this->
utf8Bidi($tmparr, $tmpstr, $this->tmprtl);
 
 7663                          $this->endlinex = $startx - $linew;
 
 7665                          $this->endlinex = $startx + $linew;
 
 7676                $this->
Cell(
$w, 
$h, $tmpstr, 0, $ln, $align, $fill, $link, $stretch);
 
 7679                     $this->cell_padding = $tmpcellpadding;
 
 7698                return ($this->x - $this->lMargin);
 
 7700                return ($this->w - $this->rMargin - $this->x);
 
 7713           if (strlen(
$start) == 0) {
 
 7716           if (strlen($end) == 0) {
 
 7717                $end = count($strarr);
 
 7721                $string .= $this->
unichr($strarr[
$i]);
 
 7736           if (strlen(
$start) == 0) {
 
 7739           if (strlen($end) == 0) {
 
 7740                $end = count($uniarr);
 
 7744                $string .= $uniarr[
$i];
 
 7757           return array_map(array($this, 
'unichr'), $ta);
 
 7769           if (!$this->isunicode) {
 
 7776                return chr(0xC0 | $c >> 6).chr(0x80 | $c & 0x3F);
 
 7777           } 
elseif ($c <= 0xFFFF) {
 
 7779                return chr(0xE0 | $c >> 12).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
 
 7780           } 
elseif ($c <= 0x10FFFF) {
 
 7782                return chr(0xF0 | $c >> 18).chr(0x80 | $c >> 12 & 0x3F).chr(0x80 | $c >> 6 & 0x3F).chr(0x80 | $c & 0x3F);
 
 7797           if (isset($iminfo[
'mime']) AND !empty($iminfo[
'mime'])) {
 
 7798                $mime = explode(
'/', $iminfo[
'mime']);
 
 7799                if ((count($mime) > 1) AND ($mime[0] == 
'image') AND (!empty($mime[1]))) {
 
 7800                     $type = strtolower(trim($mime[1]));
 
 7804                $fileinfo = pathinfo($imgfile);
 
 7805                if (isset($fileinfo[
'extension']) AND (!$this->
empty_string($fileinfo[
'extension']))) {
 
 7806                     $type = strtolower(trim($fileinfo[
'extension']));
 
 7809           if ($type == 
'jpg') {
 
 7836           if ($fitonpage OR $this->AutoPageBreak) {
 
 7837                $ratio_wh = (
$w / 
$h);
 
 7838                if (
$h > ($this->PageBreakTrigger - $this->tMargin)) {
 
 7840                     $w = (
$h * $ratio_wh);
 
 7847                          $h = (
$w / $ratio_wh);
 
 7859                     $x += ($this->x - $prev_x);
 
 7861                $this->newline = 
true;
 
 7865                $ratio_wh = (
$w / 
$h);
 
 7867                     $h = $this->PageBreakTrigger - 
$y;
 
 7868                     $w = (
$h * $ratio_wh);
 
 7870                if ((!$this->rtl) AND ((
$x + 
$w) > ($this->w - $this->rMargin))) {
 
 7871                     $w = $this->w - $this->rMargin - 
$x;
 
 7872                     $h = (
$w / $ratio_wh);
 
 7873                } 
elseif (($this->rtl) AND ((
$x - 
$w) < ($this->lMargin))) {
 
 7875                     $h = (
$w / $ratio_wh);
 
 7915      public function Image($file, 
$x=
'', 
$y=
'', 
$w=0, 
$h=0, $type=
'', $link=
'', $align=
'', $resize=
false, 
$dpi=300, $palign=
'', $ismask=
false, $imgmask=
false, $border=0, $fitbox=
false, $hidden=
false, $fitonpage=
false, $alt=
false, $altimgs=array()) {
 
 7916           if ($this->state != 2) {
 
 7929           if ($file[0] === 
'@') {
 
 7931                $imgdata = substr($file, 1);
 
 7933                $fp = fopen($file, 
'w');
 
 7934                fwrite(
$fp, $imgdata);
 
 7937                $imsize = @getimagesize($file);
 
 7938                if ($imsize === FALSE) {
 
 7941                     $this->cached_files[] = $file;
 
 7944                if ($file{0} === 
'*') {
 
 7946                     $file = substr($file, 1);
 
 7950                if (!@file_exists($file)) {
 
 7952                     $file = str_replace(
' ', 
'%20', $file);
 
 7954                if (@file_exists($file)) {
 
 7956                     $imsize = @getimagesize($file);
 
 7960                if ($imsize === FALSE) {
 
 7961                     if (function_exists(
'curl_init')) {
 
 7964                          curl_setopt($cs, CURLOPT_URL, $file);
 
 7965                          curl_setopt($cs, CURLOPT_BINARYTRANSFER, 
true);
 
 7966                          curl_setopt($cs, CURLOPT_FAILONERROR, 
true);
 
 7967                          curl_setopt($cs, CURLOPT_RETURNTRANSFER, 
true);
 
 7968                          if ((ini_get(
'open_basedir') == 
'') AND (!ini_get(
'safe_mode'))) {
 
 7969                               curl_setopt($cs, CURLOPT_FOLLOWLOCATION, 
true);
 
 7971                          curl_setopt($cs, CURLOPT_CONNECTTIMEOUT, 5);
 
 7972                          curl_setopt($cs, CURLOPT_TIMEOUT, 30);
 
 7973                          curl_setopt($cs, CURLOPT_SSL_VERIFYPEER, 
false);
 
 7974                          curl_setopt($cs, CURLOPT_SSL_VERIFYHOST, 
false);
 
 7975                          curl_setopt($cs, CURLOPT_USERAGENT, 
'TCPDF');
 
 7976                          $imgdata = curl_exec($cs);
 
 7978                          if ($imgdata !== FALSE) {
 
 7981                               $fp = fopen($file, 
'w');
 
 7982                               fwrite(
$fp, $imgdata);
 
 7985                               $imsize = @getimagesize($file);
 
 7986                               if ($imsize === FALSE) {
 
 7989                                    $this->cached_files[] = $file;
 
 7996                          $imsize = array($pw, $ph);
 
 8000           if ($imsize === FALSE) {
 
 8005                     $imsize = array($pw, $ph);
 
 8007                     $this->
Error(
'[Image] Unable to get image: '.$file);
 
 8011           $filehash = md5($this->file_id.$file);
 
 8013           list($pixw, $pixh) = $imsize;
 
 8015           if ((
$w <= 0) AND (
$h <= 0)) {
 
 8020                $w = 
$h * $pixw / $pixh;
 
 8022                $h = 
$w * $pixh / $pixw;
 
 8023           } 
elseif (($fitbox !== 
false) AND (
$w > 0) AND (
$h > 0)) {
 
 8024                if (strlen($fitbox) !== 2) {
 
 8029                if (((
$w * $pixh) / (
$h * $pixw)) < 1) {
 
 8033                     $h = 
$w * $pixh / $pixw;
 
 8035                     $hdiff = ($oldh - 
$h);
 
 8037                     switch (strtoupper($fitbox{1})) {
 
 8054                     $w = 
$h * $pixw / $pixh;
 
 8056                     $wdiff = ($oldw - 
$w);
 
 8058                     switch (strtoupper($fitbox{0})) {
 
 8085           $neww = round(
$w * $this->k * 
$dpi / $this->dpi);
 
 8086           $newh = round(
$h * $this->k * 
$dpi / $this->dpi);
 
 8088           $newsize = ($neww * $newh);
 
 8089           $pixsize = ($pixw * $pixh);
 
 8090           if (intval($resize) == 2) {
 
 8092           } 
elseif ($newsize >= $pixsize) {
 
 8097           if (in_array($file, $this->imagekeys)) {
 
 8103                     $oldsize = ($info[
'w'] * $info[
'h']);
 
 8104                     if ((($oldsize < $newsize) AND ($resize)) OR (($oldsize < $pixsize) AND (!$resize))) {
 
 8112                if (in_array($tempfile_plain, $this->imagekeys)) {
 
 8116                     $oldsize = ($info[
'w'] * $info[
'h']);
 
 8117                     if ((($oldsize < $newsize) AND ($resize)) OR (($oldsize < $pixsize) AND (!$resize))) {
 
 8122                          $imgmask = $this->
Image($tempfile_alpha, 
$x, 
$y, 
$w, 
$h, 
'PNG', 
'', 
'', $resize, 
$dpi, 
'', 
true, 
false);
 
 8124                          return $this->
Image($tempfile_plain, 
$x, 
$y, 
$w, 
$h, $type, $link, $align, $resize, 
$dpi, $palign, 
false, $imgmask);
 
 8130                $type = strtolower($type);
 
 8133                } 
elseif ($type == 
'jpg') {
 
 8139                $mtd = 
'_parse'.$type;
 
 8141                $gdfunction = 
'imagecreatefrom'.$type;
 
 8143                if ((method_exists($this, $mtd)) AND (!($resize AND (function_exists($gdfunction) OR extension_loaded(
'imagick'))))) {
 
 8145                     $info = $this->$mtd($file);
 
 8146                     if ($info == 
'pngalpha') {
 
 8147                          return $this->
ImagePngAlpha($file, 
$x, 
$y, $pixw, $pixh, 
$w, 
$h, 
'PNG', $link, $align, $resize, 
$dpi, $palign, $filehash);
 
 8151                     if (function_exists($gdfunction)) {
 
 8153                          $img = $gdfunction($file);
 
 8155                               $imgr = imagecreatetruecolor($neww, $newh);
 
 8156                               if (($type == 
'gif') OR ($type == 
'png')) {
 
 8159                               imagecopyresampled($imgr, $img, 0, 0, 0, 0, $neww, $newh, $pixw, $pixh);
 
 8160                               if (($type == 
'gif') OR ($type == 
'png')) {
 
 8161                                    $info = $this->
_toPNG($imgr);
 
 8163                                    $info = $this->
_toJPEG($imgr);
 
 8166                               if (($type == 
'gif') OR ($type == 
'png')) {
 
 8167                                    $info = $this->
_toPNG($img);
 
 8172                     } 
elseif (extension_loaded(
'imagick')) {
 
 8174                          $img = 
new Imagick();
 
 8175                          if ($type == 
'SVG') {
 
 8177                               $svgimg = file_get_contents($file);
 
 8180                               if (preg_match(
'/<svg([^>]*)>/si', $svgimg, $regs)) {
 
 8183                                    if (preg_match(
'/[\s]+width[\s]*=[\s]*"([^"]*)"/si', $svgtag, $tmp)) {
 
 8185                                         $owu = sprintf(
'%F', ($ow * 
$dpi / 72)).$this->pdfunit;
 
 8186                                         $svgtag = preg_replace(
'/[\s]+width[\s]*=[\s]*"[^"]*"/si', 
' width="'.$owu.
'"', $svgtag, 1);
 
 8191                                    if (preg_match(
'/[\s]+height[\s]*=[\s]*"([^"]*)"/si', $svgtag, $tmp)) {
 
 8193                                         $ohu = sprintf(
'%F', ($oh * 
$dpi / 72)).$this->pdfunit;
 
 8194                                         $svgtag = preg_replace(
'/[\s]+height[\s]*=[\s]*"[^"]*"/si', 
' height="'.$ohu.
'"', $svgtag, 1);
 
 8199                                    if (!preg_match(
'/[\s]+viewBox[\s]*=[\s]*"[\s]*([0-9\.]+)[\s]+([0-9\.]+)[\s]+([0-9\.]+)[\s]+([0-9\.]+)[\s]*"/si', $svgtag, $tmp)) {
 
 8200                                         $vbw = ($ow * $this->imgscale * 
$this->k);
 
 8201                                         $vbh = ($oh * $this->imgscale * 
$this->k);
 
 8202                                         $vbox = sprintf(
' viewBox="0 0 %F %F" ', $vbw, $vbh);
 
 8203                                         $svgtag = $vbox.$svgtag;
 
 8205                                    $svgimg = preg_replace(
'/<svg([^>]*)>/si', 
'<svg'.$svgtag.
'>', $svgimg, 1);
 
 8207                               $img->readImageBlob($svgimg);
 
 8209                               $img->readImage($file);
 
 8212                               $img->resizeImage($neww, $newh, 10, 1, 
false);
 
 8214                          $img->setCompressionQuality($this->jpeg_quality);
 
 8215                          $img->setImageFormat(
'jpeg');
 
 8217                          $img->writeImage($tempname);
 
 8225                if ($info === 
false) {
 
 8232                     $info[
'cs'] = 
'DeviceGray';
 
 8234                if ($imgmask !== 
false) {
 
 8235                     $info[
'masked'] = $imgmask;
 
 8237                if (!empty($exurl)) {
 
 8238                     $info[
'exurl'] = $exurl;
 
 8241                $info[
'altimgs'] = $altimgs;
 
 8246           $this->img_rb_y = 
$y + 
$h;
 
 8249                if ($palign == 
'L') {
 
 8251                } 
elseif ($palign == 
'C') {
 
 8252                     $ximg = ($this->w + $this->lMargin - $this->rMargin - 
$w) / 2;
 
 8253                } 
elseif ($palign == 
'R') {
 
 8254                     $ximg = $this->w - $this->rMargin - 
$w;
 
 8258                $this->img_rb_x = $ximg;
 
 8260                if ($palign == 
'L') {
 
 8262                } 
elseif ($palign == 
'C') {
 
 8263                     $ximg = ($this->w + $this->lMargin - $this->rMargin - 
$w) / 2;
 
 8264                } 
elseif ($palign == 
'R') {
 
 8265                     $ximg = $this->w - $this->rMargin - 
$w;
 
 8269                $this->img_rb_x = $ximg + 
$w;
 
 8271           if ($ismask OR $hidden) {
 
 8278                $this->
_out(sprintf(
'q %F 0 0 %F %F %F cm /I%u Do Q', (
$w * $this->k), ($h * $this->k), $xkimg, (($this->h - (
$y + $h)) * $this->k), $info[
'i']));
 
 8280           if (!empty($border)) {
 
 8288                $this->
Cell(
$w, $h, 
'', $border, 0, 
'', 0, 
'', 0, 
true);
 
 8293                $this->
Link($ximg, 
$y, 
$w, $h, $link, 0);
 
 8303                     $this->y = 
$y + round($h/2);
 
 8313                     $this->
SetY($this->img_rb_y);
 
 8321           if ($this->inxobj) {
 
 8334           if (!defined(
'PHP_VERSION_ID')) {
 
 8335                $version = PHP_VERSION;
 
 8336                define(
'PHP_VERSION_ID', (($version{0} * 10000) + ($version{2} * 100) + $version{4}));
 
 8338           if (PHP_VERSION_ID < 50300) {
 
 8339                @set_magic_quotes_runtime($mqr);
 
 8349           if (!defined(
'PHP_VERSION_ID')) {
 
 8350                $version = PHP_VERSION;
 
 8351                define(
'PHP_VERSION_ID', (($version{0} * 10000) + ($version{2} * 100) + $version{4}));
 
 8353           if (PHP_VERSION_ID < 50300) {
 
 8354                return @get_magic_quotes_runtime();
 
 8368           imagejpeg($image, $tempname, $this->jpeg_quality);
 
 8369           imagedestroy($image);
 
 8388           imageinterlace($image, 0);
 
 8390           imagepng($image, $tempname);
 
 8392           imagedestroy($image);
 
 8410           $tid = imagecolortransparent($image);
 
 8412           $tcol = array(
'red' => 255, 
'green' => 255, 
'blue' => 255);
 
 8415                $tcol = imagecolorsforindex($image, $tid);
 
 8417           $tid = imagecolorallocate($new_image, $tcol[
'red'], $tcol[
'green'], $tcol[
'blue']);
 
 8418           imagefill($new_image, 0, 0, $tid);
 
 8419           imagecolortransparent($new_image, $tid);
 
 8430           $a = getimagesize($file);
 
 8432                $this->
Error(
'Missing or incorrect image file: '.$file);
 
 8435                $this->
Error(
'Not a JPEG file: '.$file);
 
 8438           $bpc = isset($a[
'bits']) ? intval($a[
'bits']) : 8;
 
 8440           if (!isset($a[
'channels'])) {
 
 8443                $channels = intval($a[
'channels']);
 
 8446           switch ($channels) {
 
 8448                     $colspace = 
'DeviceGray';
 
 8452                     $colspace = 
'DeviceRGB';
 
 8456                     $colspace = 
'DeviceCMYK';
 
 8461                     $colspace = 
'DeviceRGB';
 
 8466           $data = file_get_contents($file);
 
 8470           while (($pos = strpos(
$data, 
"ICC_PROFILE\0", $offset)) !== 
false) {
 
 8474                $msn = max(1, ord(
$data[($pos + 12)]));
 
 8476                $nom = max(1, ord(
$data[($pos + 13)]));
 
 8478                $icc[($msn - 1)] = substr(
$data, ($pos + 14), $length);
 
 8480                $offset = ($pos + 14 + $length);
 
 8483           if (count($icc) > 0) {
 
 8485                $icc = implode(
'', $icc);
 
 8486                if ((ord($icc{36}) != 0x61) OR (ord($icc{37}) != 0x63) OR (ord($icc{38}) != 0x73) OR (ord($icc{39}) != 0x70)) {
 
 8493           return array(
'w' => $a[0], 
'h' => $a[1], 
'ch' => $channels, 
'icc' => $icc, 
'cs' => $colspace, 
'bpc' => $bpc, 
'f' => 
'DCTDecode', 
'data' => 
$data);
 
 8503           $f = fopen($file, 
'rb');
 
 8505                $this->
Error(
'Can\'t open image file: '.$file);
 
 8508           if (fread($f, 8) != chr(137).
'PNG'.chr(13).chr(10).chr(26).chr(10)) {
 
 8509                $this->
Error(
'Not a PNG file: '.$file);
 
 8513           if (fread($f, 4) != 
'IHDR') {
 
 8514                $this->
Error(
'Incorrect PNG file: '.$file);
 
 8518           $bpc = ord(fread($f, 1));
 
 8524           $ct = ord(fread($f, 1));
 
 8526                $colspace = 
'DeviceGray';
 
 8528                $colspace = 
'DeviceRGB';
 
 8530                $colspace = 
'Indexed';
 
 8536           if (ord(fread($f, 1)) != 0) {
 
 8541           if (ord(fread($f, 1)) != 0) {
 
 8546           if (ord(fread($f, 1)) != 0) {
 
 8552           $channels = ($ct == 2 ? 3 : 1);
 
 8553           $parms = 
'/DecodeParms << /Predictor 15 /Colors '.$channels.
' /BitsPerComponent '.$bpc.
' /Columns '.
$w.
' >>';
 
 8561                $type = fread($f, 4);
 
 8562                if ($type == 
'PLTE') {
 
 8566                } 
elseif ($type == 
'tRNS') {
 
 8570                          $trns = array(ord($t{1}));
 
 8572                          $trns = array(ord($t{1}), ord($t{3}), ord($t{5}));
 
 8574                          $pos = strpos($t, chr(0));
 
 8575                          if ($pos !== 
false) {
 
 8576                               $trns = array($pos);
 
 8580                } 
elseif ($type == 
'IDAT') {
 
 8584                } 
elseif ($type == 
'iCCP') {
 
 8587                     while ((ord(fread($f, 1)) > 0) AND ($len < 80)) {
 
 8593                     if (ord(fread($f, 1)) != 0) {
 
 8599                     $icc = $this->
rfread($f, (
$n - $len - 2));
 
 8601                     $icc = gzuncompress($icc);
 
 8603                } 
elseif ($type == 
'IEND') {
 
 8609           if (($colspace == 
'Indexed') AND (empty($pal))) {
 
 8615           return array(
'w' => 
$w, 
'h' => 
$h, 
'ch' => $channels, 
'icc' => $icc, 
'cs' => $colspace, 
'bpc' => $bpc, 
'f' => 
'FlateDecode', 
'parms' => $parms, 
'pal' => $pal, 
'trns' => $trns, 
'data' => 
$data);
 
 8628      protected function rfread($handle, $length) {
 
 8629           $data = fread($handle, $length);
 
 8630           if (
$data === 
false) {
 
 8633           $rest = $length - strlen(
$data);
 
 8661      protected function ImagePngAlpha($file, 
$x, 
$y, $wpx, $hpx, 
$w, 
$h, $type, $link, $align, $resize, 
$dpi, $palign, $filehash=
'') {
 
 8662           if (empty($filehash)) {
 
 8663                $filehash = md5($this->file_id.$file);
 
 8669           if (extension_loaded(
'imagick')) { 
 
 8671                $img = 
new Imagick();
 
 8672                $img->readImage($file);
 
 8676                $img->separateImageChannel(8); 
 
 8677                $img->negateImage(
true);
 
 8678                $img->setImageFormat(
'png');
 
 8679                $img->writeImage($tempfile_alpha);
 
 8681                $imga->separateImageChannel(39); 
 
 8682                $imga->setImageFormat(
'png');
 
 8683                $imga->writeImage($tempfile_plain);
 
 8684           } 
elseif (function_exists(
'imagecreatefrompng')) { 
 
 8686                $img = imagecreatefrompng($file);
 
 8687                $imgalpha = imagecreate($wpx, $hpx);
 
 8689                for ($c = 0; $c < 256; ++$c) {
 
 8690                     ImageColorAllocate($imgalpha, $c, $c, $c);
 
 8693                for ($xpx = 0; $xpx < $wpx; ++$xpx) {
 
 8694                     for ($ypx = 0; $ypx < $hpx; ++$ypx) {
 
 8695                          $color = imagecolorat($img, $xpx, $ypx);
 
 8697                          imagesetpixel($imgalpha, $xpx, $ypx, 
$alpha);
 
 8700                imagepng($imgalpha, $tempfile_alpha);
 
 8701                imagedestroy($imgalpha);
 
 8703                $imgplain = imagecreatetruecolor($wpx, $hpx);
 
 8704                imagecopy($imgplain, $img, 0, 0, 0, 0, $wpx, $hpx);
 
 8705                imagepng($imgplain, $tempfile_plain);
 
 8706                imagedestroy($imgplain);
 
 8708                $this->
Error(
'TCPDF requires the Imagick or GD extension to handle PNG images with alpha channel.');
 
 8711           $imgmask = $this->
Image($tempfile_alpha, 
$x, 
$y, 
$w, 
$h, 
'PNG', 
'', 
'', $resize, 
$dpi, 
'', 
true, 
false);
 
 8713           $this->
Image($tempfile_plain, 
$x, 
$y, 
$w, 
$h, $type, $link, $align, $resize, 
$dpi, $palign, 
false, $imgmask);
 
 8715           unlink($tempfile_alpha);
 
 8716           unlink($tempfile_plain);
 
 8726           if (!isset($this->gdgammacache[
"'".$c.
"'"])) {
 
 8733                $this->gdgammacache[
"'".$c.
"'"] = (pow((
$alpha / 255), 2.2) * 255);
 
 8735                if (count($this->gdgammacache) > 8) {
 
 8737                     array_shift($this->gdgammacache);
 
 8740           return $this->gdgammacache[
"'".$c.
"'"];
 
 8752      public function Ln(
$h=
'', $cell=
false) {
 
 8753           if (($this->num_columns > 1) AND ($this->y == $this->columns[$this->current_column][
'y']) AND isset($this->columns[$this->current_column][
'x']) AND ($this->x == $this->columns[$this->current_column][
'x'])) {
 
 8759                     $cellpadding = $this->cell_padding[
'R'];
 
 8761                     $cellpadding = $this->cell_padding[
'L'];
 
 8767                $this->x = $this->w - $this->rMargin - $cellpadding;
 
 8769                $this->x = $this->lMargin + $cellpadding;
 
 8771           if (is_string(
$h)) {
 
 8776           $this->newline = 
true;
 
 8790                return ($this->w - $this->x);
 
 8829           if (!$rtloff AND $this->rtl) {
 
 8831                     $this->x = $this->w - 
$x;
 
 8839                     $this->x = $this->w + 
$x;
 
 8845           if ($this->x > $this->w) {
 
 8860      public function SetY(
$y, $resetx=
true, $rtloff=
false) {
 
 8864                if (!$rtloff AND $this->rtl) {
 
 8873                $this->y = $this->h + 
$y;
 
 8878           if ($this->y > $this->h) {
 
 8894           $this->
SetY(
$y, 
false, $rtloff);
 
 8895           $this->
SetX(
$x, $rtloff);
 
 8906           $this->x = floatval(
$x);
 
 8917           $this->y = floatval(
$y);
 
 8941           if (!isset($_SERVER[
'HTTP_ACCEPT_ENCODING']) OR empty($_SERVER[
'HTTP_ACCEPT_ENCODING'])) {
 
 8943                header(
'Content-Length: '.$length);
 
 8958      public function Output($name=
'doc.pdf', $dest=
'I') {
 
 8961           if ($this->state < 3) {
 
 8965           if (is_bool($dest)) {
 
 8966                $dest = $dest ? 
'D' : 
'F';
 
 8968           $dest = strtoupper($dest);
 
 8969           if ($dest{0} != 
'F') {
 
 8970                $name = preg_replace(
'/[\s]+/', 
'_', $name);
 
 8971                $name = preg_replace(
'/[^a-zA-Z0-9_\.-]/', 
'', $name);
 
 8978                $pdfdoc = substr($pdfdoc, 0, -1);
 
 8980                if (isset($this->diskcache) AND $this->diskcache) {
 
 8982                     unlink($this->buffer);
 
 8984                unset($this->buffer);
 
 8986                $byterange_string_len = strlen($this->byterange_string);
 
 8988                $byte_range = array();
 
 8990                $byte_range[1] = strpos($pdfdoc, $this->byterange_string) + $byterange_string_len + 10;
 
 8991                $byte_range[2] = $byte_range[1] + $this->signature_max_length + 2;
 
 8992                $byte_range[3] = strlen($pdfdoc) - $byte_range[2];
 
 8993                $pdfdoc = substr($pdfdoc, 0, $byte_range[1]).substr($pdfdoc, $byte_range[2]);
 
 8995                $byterange = sprintf(
'/ByteRange[0 %u %u %u]', $byte_range[1], $byte_range[2], $byte_range[3]);
 
 8996                $byterange .= str_repeat(
' ', ($byterange_string_len - strlen($byterange)));
 
 8997                $pdfdoc = str_replace($this->byterange_string, $byterange, $pdfdoc);
 
 9000                $f = fopen($tempdoc, 
'wb');
 
 9002                     $this->
Error(
'Unable to create temporary file: '.$tempdoc);
 
 9004                $pdfdoc_length = strlen($pdfdoc);
 
 9005                fwrite($f, $pdfdoc, $pdfdoc_length);
 
 9009                if (empty($this->signature_data[
'extracerts'])) {
 
 9010                     openssl_pkcs7_sign($tempdoc, $tempsign, $this->signature_data[
'signcert'], array($this->signature_data[
'privkey'], $this->signature_data[
'password']), array(), PKCS7_BINARY | PKCS7_DETACHED);
 
 9012                     openssl_pkcs7_sign($tempdoc, $tempsign, $this->signature_data[
'signcert'], array($this->signature_data[
'privkey'], $this->signature_data[
'password']), array(), PKCS7_BINARY | PKCS7_DETACHED, $this->signature_data[
'extracerts']);
 
 9016                $signature = file_get_contents($tempsign);
 
 9019                $signature = substr($signature, $pdfdoc_length);
 
 9020                $signature = substr($signature, (strpos($signature, 
"%%EOF\n\n------") + 13));
 
 9021                $tmparr = explode(
"\n\n", $signature);
 
 9022                $signature = $tmparr[1];
 
 9025                $signature = base64_decode(trim($signature));
 
 9027                $signature = current(unpack(
'H*', $signature));
 
 9028                $signature = str_pad($signature, $this->signature_max_length, 
'0');
 
 9030                $this->diskcache = 
false;
 
 9032                $this->buffer = substr($pdfdoc, 0, $byte_range[1]).
'<'.$signature.
'>'.substr($pdfdoc, $byte_range[1]);
 
 9033                $this->bufferlen = strlen($this->buffer);
 
 9038                     if (ob_get_contents()) {
 
 9039                          $this->
Error(
'Some data has already been output, can\'t send PDF file');
 
 9041                     if (php_sapi_name() != 
'cli') {
 
 9043                          header(
'Content-Type: application/pdf');
 
 9044                          if (headers_sent()) {
 
 9045                               $this->
Error(
'Some data has already been output to browser, can\'t send PDF file');
 
 9047                          header(
'Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1');
 
 9049                          header(
'Pragma: public');
 
 9050                          header(
'Expires: Sat, 26 Jul 1997 05:00:00 GMT'); 
 
 9051                          header(
'Last-Modified: '.gmdate(
'D, d M Y H:i:s').
' GMT');
 
 9052                          header(
'Content-Disposition: inline; filename="'.basename($name).
'"');
 
 9061                     if (ob_get_contents()) {
 
 9062                          $this->
Error(
'Some data has already been output, can\'t send PDF file');
 
 9064                     header(
'Content-Description: File Transfer');
 
 9065                     if (headers_sent()) {
 
 9066                          $this->
Error(
'Some data has already been output to browser, can\'t send PDF file');
 
 9068                     header(
'Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1');
 
 9070                     header(
'Pragma: public');
 
 9071                     header(
'Expires: Sat, 26 Jul 1997 05:00:00 GMT'); 
 
 9072                     header(
'Last-Modified: '.gmdate(
'D, d M Y H:i:s').
' GMT');
 
 9074                     if (strpos(php_sapi_name(), 
'cgi') === 
false) {
 
 9075                          header(
'Content-Type: application/force-download');
 
 9076                          header(
'Content-Type: application/octet-stream', 
false);
 
 9077                          header(
'Content-Type: application/download', 
false);
 
 9078                          header(
'Content-Type: application/pdf', 
false);
 
 9080                          header(
'Content-Type: application/pdf');
 
 9083                     header(
'Content-Disposition: attachment; filename="'.basename($name).
'"');
 
 9084                     header(
'Content-Transfer-Encoding: binary');
 
 9092                     if ($this->diskcache) {
 
 9093                          copy($this->buffer, $name);
 
 9095                          $f = fopen($name, 
'wb');
 
 9097                               $this->
Error(
'Unable to create output file: '.$name);
 
 9099                          fwrite($f, $this->
getBuffer(), $this->bufferlen);
 
 9102                     if ($dest == 
'FI') {
 
 9104                          header(
'Content-Type: application/pdf');
 
 9105                          header(
'Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1');
 
 9107                          header(
'Pragma: public');
 
 9108                          header(
'Expires: Sat, 26 Jul 1997 05:00:00 GMT'); 
 
 9109                          header(
'Last-Modified: '.gmdate(
'D, d M Y H:i:s').
' GMT');
 
 9110                          header(
'Content-Disposition: inline; filename="'.basename($name).
'"');
 
 9111                          $this->
sendOutputData(file_get_contents($name), filesize($name));
 
 9112                     } 
elseif ($dest == 
'FD') {
 
 9114                          if (ob_get_contents()) {
 
 9115                               $this->
Error(
'Some data has already been output, can\'t send PDF file');
 
 9117                          header(
'Content-Description: File Transfer');
 
 9118                          if (headers_sent()) {
 
 9119                               $this->
Error(
'Some data has already been output to browser, can\'t send PDF file');
 
 9121                          header(
'Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1');
 
 9122                          header(
'Pragma: public');
 
 9123                          header(
'Expires: Sat, 26 Jul 1997 05:00:00 GMT'); 
 
 9124                          header(
'Last-Modified: '.gmdate(
'D, d M Y H:i:s').
' GMT');
 
 9126                          if (strpos(php_sapi_name(), 
'cgi') === 
false) {
 
 9127                               header(
'Content-Type: application/force-download');
 
 9128                               header(
'Content-Type: application/octet-stream', 
false);
 
 9129                               header(
'Content-Type: application/download', 
false);
 
 9130                               header(
'Content-Type: application/pdf', 
false);
 
 9132                               header(
'Content-Type: application/pdf');
 
 9135                          header(
'Content-Disposition: attachment; filename="'.basename($name).
'"');
 
 9136                          header(
'Content-Transfer-Encoding: binary');
 
 9137                          $this->
sendOutputData(file_get_contents($name), filesize($name));
 
 9143                     $retval = 
'Content-Type: application/pdf;'.
"\r\n";
 
 9144                     $retval .= 
' name="'.$name.
'"'.
"\r\n";
 
 9145                     $retval .= 
'Content-Transfer-Encoding: base64'.
"\r\n";
 
 9146                     $retval .= 
'Content-Disposition: attachment;'.
"\r\n";
 
 9147                     $retval .= 
' filename="'.$name.
'"'.
"\r\n\r\n";
 
 9148                     $retval .= chunk_split(base64_encode($this->
getBuffer()), 76, 
"\r\n");
 
 9156                     $this->
Error(
'Incorrect output destination: '.$dest);
 
 9169      public function _destroy($destroyall=
false, $preserve_objcopy=
false) {
 
 9170           if ($destroyall AND isset($this->diskcache) AND $this->diskcache AND (!$preserve_objcopy) AND (!$this->
empty_string($this->buffer))) {
 
 9172                unlink($this->buffer);
 
 9174           if ($destroyall AND isset($this->cached_files) AND !empty($this->cached_files)) {
 
 9176                foreach ($this->cached_files as $cachefile) {
 
 9177                     if (is_file($cachefile)) {
 
 9181                unset($this->cached_files);
 
 9183           foreach (array_keys(get_object_vars($this)) as $val) {
 
 9184                if ($destroyall OR (
 
 9185                     ($val != 
'internal_encoding')
 
 9186                     AND ($val != 
'state')
 
 9187                     AND ($val != 
'bufferlen')
 
 9188                     AND ($val != 
'buffer')
 
 9189                     AND ($val != 
'diskcache')
 
 9190                     AND ($val != 
'cached_files')
 
 9191                     AND ($val != 
'sign')
 
 9192                     AND ($val != 
'signature_data')
 
 9193                     AND ($val != 
'signature_max_length')
 
 9194                     AND ($val != 
'byterange_string')
 
 9196                     if ((!$preserve_objcopy OR ($val != 
'objcopy')) AND isset($this->$val)) {
 
 9210                $this->
Error(
'Don\'t alter the locale before including class file');
 
 9213           if (sprintf(
'%.1F', 1.0) != 
'1.0') {
 
 9214                setlocale(LC_NUMERIC, 
'C');
 
 9224           if (!defined(
'K_PATH_FONTS') AND is_dir(dirname(__FILE__).
'/fonts')) {
 
 9225                define(
'K_PATH_FONTS', dirname(__FILE__).
'/fonts/');
 
 9239           $alias = array(
'u' => array(), 
'a' => array());
 
 9241           $alias[
'u'][] = $this->
_escape($u);
 
 9242           if ($this->isunicode) {
 
 9248           $alias[
'a'][] = $this->
_escape($a);
 
 9258           $basic_alias = array($this->alias_tot_pages, $this->alias_num_page, $this->alias_group_tot_pages, $this->alias_group_num_page, $this->alias_right_shift);
 
 9260           foreach($basic_alias as 
$k => $a) {
 
 9275           foreach ($replace as $rep) {
 
 9276                foreach ($rep[3] as $a) {
 
 9277                     if (strpos(
$page, $a) !== 
false) {
 
 9279                          $diff += ($rep[2] - $rep[1]);
 
 9283           return array(
$page, $diff);
 
 9296           foreach ($aliases as $type => $alias) {
 
 9297                foreach ($alias as $a) {
 
 9299                     $startnum = (strpos($a, 
':') + 1);
 
 9300                     $a = substr($a, 0, $startnum);
 
 9301                     if (($pos = strpos(
$page, $a)) !== 
false) {
 
 9303                          $endnum = strpos(
$page, 
'}', $pos);
 
 9305                          $aa = substr(
$page, $pos, ($endnum - $pos + 1));
 
 9307                          $ratio = substr(
$page, ($pos + $startnum), ($endnum - $pos - $startnum));
 
 9308                          $ratio = preg_replace(
'/[^0-9\.]/', 
'', $ratio);
 
 9309                          $ratio = floatval($ratio);
 
 9311                               $chrdiff = floor(($diff + 12) * $ratio);
 
 9312                               $shift = str_repeat(
' ', $chrdiff);
 
 9315                               $chrdiff = floor(($diff + 11) * $ratio);
 
 9316                               $shift = str_repeat(
' ', $chrdiff);
 
 9331           $validboxes = array(
'MediaBox', 
'CropBox', 
'BleedBox', 
'TrimBox', 
'ArtBox');
 
 9332           $this->page_boxes = array();
 
 9333           foreach ($boxes as $box) {
 
 9334                if (in_array($box, $validboxes)) {
 
 9335                     $this->page_boxes[] = $box;
 
 9349           $ptpa = $this->
formatPageNumber(($this->starting_page_number + $num_pages - 1));
 
 9356           for (
$n = 1; 
$n <= $num_pages; ++
$n) {
 
 9366                if (!empty($this->pagegroups)) {
 
 9367                     if (isset($this->newpagegroup[
$n])) {
 
 9380                     $replace[] = array($ptgu, $ptg_num_chars, 9, $pnalias[2][
'u']);
 
 9381                     $replace[] = array($ptga, $ptg_num_chars, 7, $pnalias[2][
'a']);
 
 9382                     $replace[] = array($pngu, $png_num_chars, 9, $pnalias[3][
'u']);
 
 9383                     $replace[] = array($pnga, $png_num_chars, 7, $pnalias[3][
'a']);
 
 9388                $replace[] = array($ptpu, $ptp_num_chars, 9, $pnalias[0][
'u']);
 
 9389                $replace[] = array($ptpa, $ptp_num_chars, 7, $pnalias[0][
'a']);
 
 9390                $replace[] = array($pnpu, $pnp_num_chars, 9, $pnalias[1][
'u']);
 
 9391                $replace[] = array($pnpa, $pnp_num_chars, 7, $pnalias[1][
'a']);
 
 9396                $temppage = str_replace($this->epsmarker, 
'', $temppage);
 
 9398                $this->page_obj_id[
$n] = $this->
_newobj();
 
 9400                $out .= 
' /Type /Page';
 
 9401                $out .= 
' /Parent 1 0 R';
 
 9402                $out .= 
' /LastModified '.$this->_datestring(0, $this->doc_modification_timestamp);
 
 9403                $out .= 
' /Resources 2 0 R';
 
 9404                foreach ($this->page_boxes as $box) {
 
 9406                     $out .= sprintf(
' [%F %F %F %F]', $this->pagedim[
$n][$box][
'llx'], $this->pagedim[
$n][$box][
'lly'], $this->pagedim[
$n][$box][
'urx'], $this->pagedim[
$n][$box][
'ury']);
 
 9408                if (isset($this->pagedim[
$n][
'BoxColorInfo']) AND !empty($this->pagedim[$n][
'BoxColorInfo'])) {
 
 9409                     $out .= 
' /BoxColorInfo <<';
 
 9410                     foreach ($this->page_boxes as $box) {
 
 9411                          if (isset($this->pagedim[$n][
'BoxColorInfo'][$box])) {
 
 9412                               $out .= 
' /'.$box.
' <<';
 
 9413                               if (isset($this->pagedim[$n][
'BoxColorInfo'][$box][
'C'])) {
 
 9414                                    $color = $this->pagedim[
$n][
'BoxColorInfo'][$box][
'C'];
 
 9416                                    $out .= sprintf(
' %F %F %F', ($color[0] / 255), ($color[1] / 255), ($color[2] / 255));
 
 9419                               if (isset($this->pagedim[$n][
'BoxColorInfo'][$box][
'W'])) {
 
 9420                                    $out .= 
' /W '.($this->pagedim[
$n][
'BoxColorInfo'][$box][
'W'] * 
$this->k);
 
 9422                               if (isset($this->pagedim[$n][
'BoxColorInfo'][$box][
'S'])) {
 
 9423                                    $out .= 
' /S /'.$this->pagedim[
$n][
'BoxColorInfo'][$box][
'S'];
 
 9425                               if (isset($this->pagedim[$n][
'BoxColorInfo'][$box][
'D'])) {
 
 9426                                    $dashes = $this->pagedim[
$n][
'BoxColorInfo'][$box][
'D'];
 
 9428                                    foreach ($dashes as $dash) {
 
 9429                                         $out .= sprintf(
' %F', ($dash * $this->k));
 
 9438                $out .= 
' /Contents '.($this->n + 1).
' 0 R';
 
 9439                $out .= 
' /Rotate '.$this->pagedim[
$n][
'Rotate'];
 
 9440                if (!$this->pdfa_mode) {
 
 9441                     $out .= 
' /Group << /Type /Group /S /Transparency /CS /DeviceRGB >>';
 
 9443                if (isset($this->pagedim[$n][
'trans']) AND !empty($this->pagedim[$n][
'trans'])) {
 
 9445                     if (isset($this->pagedim[$n][
'trans'][
'Dur'])) {
 
 9446                          $out .= 
' /Dur '.$this->pagedim[
$n][
'trans'][
'Dur'];
 
 9448                     $out .= 
' /Trans <<';
 
 9449                     $out .= 
' /Type /Trans';
 
 9450                     if (isset($this->pagedim[$n][
'trans'][
'S'])) {
 
 9451                          $out .= 
' /S /'.$this->pagedim[
$n][
'trans'][
'S'];
 
 9453                     if (isset($this->pagedim[$n][
'trans'][
'D'])) {
 
 9454                          $out .= 
' /D '.$this->pagedim[
$n][
'trans'][
'D'];
 
 9456                     if (isset($this->pagedim[$n][
'trans'][
'Dm'])) {
 
 9457                          $out .= 
' /Dm /'.$this->pagedim[
$n][
'trans'][
'Dm'];
 
 9459                     if (isset($this->pagedim[$n][
'trans'][
'M'])) {
 
 9460                          $out .= 
' /M /'.$this->pagedim[
$n][
'trans'][
'M'];
 
 9462                     if (isset($this->pagedim[$n][
'trans'][
'Di'])) {
 
 9463                          $out .= 
' /Di '.$this->pagedim[
$n][
'trans'][
'Di'];
 
 9465                     if (isset($this->pagedim[$n][
'trans'][
'SS'])) {
 
 9466                          $out .= 
' /SS '.$this->pagedim[
$n][
'trans'][
'SS'];
 
 9468                     if (isset($this->pagedim[$n][
'trans'][
'B'])) {
 
 9469                          $out .= 
' /B '.$this->pagedim[
$n][
'trans'][
'B'];
 
 9474                $out .= 
' /PZ '.$this->pagedim[
$n][
'PZ'];
 
 9476                $out .= 
"\n".
'endobj';
 
 9482                $this->
_out(
'<<'.$filter.
'/Length '.strlen($p).
'>> stream'.
"\n".$p.
"\n".
'endstream'.
"\n".
'endobj');
 
 9483                if ($this->diskcache) {
 
 9485                     unlink($this->pages[$n]);
 
 9489           $out = $this->
_getobj(1).
"\n";
 
 9490           $out .= 
'<< /Type /Pages /Kids [';
 
 9491           foreach($this->page_obj_id as $page_obj) {
 
 9492                $out .= 
' '.$page_obj.
' 0 R';
 
 9494           $out .= 
' ] /Count '.$num_pages.
' >>';
 
 9495           $out .= 
"\n".
'endobj';
 
 9520           if (!(isset($this->PageAnnots[
$n]) OR ($this->sign AND isset($this->signature_data[
'cert_type'])))) {
 
 9523           $out = 
' /Annots [';
 
 9524           if (isset($this->PageAnnots[$n])) {
 
 9525                foreach ($this->PageAnnots[$n] as $key => $val) {
 
 9526                     if (!in_array($val[
'n'], $this->radio_groups)) {
 
 9527                          $out .= 
' '.$val[
'n'].
' 0 R';
 
 9531                if (isset($this->radiobutton_groups[$n])) {
 
 9532                     foreach ($this->radiobutton_groups[$n] as $key => 
$data) {
 
 9533                          if (isset(
$data[
'n'])) {
 
 9534                               $out .= 
' '.$data[
'n'].
' 0 R';
 
 9539           if ($this->sign AND ($n == $this->signature_appearance[
'page']) AND isset($this->signature_data[
'cert_type'])) {
 
 9541                $out .= 
' '.$this->sig_obj_id.
' 0 R';
 
 9543           if (!empty($this->empty_signature_appearance)) {
 
 9544                foreach ($this->empty_signature_appearance as $esa) {
 
 9545                     if ($esa[
'page'] == $n) {
 
 9547                          $out .= 
' '.$esa[
'objid'].
' 0 R';
 
 9566                if (isset($this->PageAnnots[
$n])) {
 
 9568                     foreach ($this->PageAnnots[$n] as $key => $pl) {
 
 9569                          $annot_obj_id = $this->PageAnnots[
$n][$key][
'n'];
 
 9571                          if (isset($this->radiobutton_groups[$n][$pl[
'txt']]) AND is_array($this->radiobutton_groups[$n][$pl[
'txt']])) {
 
 9572                               $radio_button_obj_id = $this->radiobutton_groups[
$n][$pl[
'txt']][
'n'];
 
 9574                               $annots .= 
' /Type /Annot';
 
 9575                               $annots .= 
' /Subtype /Widget';
 
 9576                               $annots .= 
' /Rect [0 0 0 0]';
 
 9577                               if ($this->radiobutton_groups[$n][$pl[
'txt']][
'#readonly#']) {
 
 9579                                    $annots .= 
' /F 68';
 
 9580                                    $annots .= 
' /Ff 49153';
 
 9583                                    $annots .= 
' /Ff 49152';
 
 9585                               $annots .= 
' /T '.$this->_datastring($pl[
'txt'], $radio_button_obj_id);
 
 9586                               if (isset($pl[
'opt'][
'tu']) AND is_string($pl[
'opt'][
'tu'])) {
 
 9587                                    $annots .= 
' /TU '.$this->_datastring($pl[
'opt'][
'tu'], $radio_button_obj_id);
 
 9589                               $annots .= 
' /FT /Btn';
 
 9590                               $annots .= 
' /Kids [';
 
 9592                               foreach ($this->radiobutton_groups[$n][$pl[
'txt']] as $key => 
$data) {
 
 9593                                    if (isset(
$data[
'kid'])) {
 
 9594                                         $annots .= 
' '.$data[
'kid'].
' 0 R';
 
 9595                                         if (
$data[
'def'] !== 
'Off') {
 
 9596                                              $defval = 
$data[
'def'];
 
 9601                               if (!empty($defval)) {
 
 9602                                    $annots .= 
' /V /'.$defval;
 
 9605                               $this->
_out($this->
_getobj($radio_button_obj_id).
"\n".$annots.
"\n".
'endobj');
 
 9606                               $this->form_obj_id[] = $radio_button_obj_id;
 
 9608                               $this->radiobutton_groups[
$n][$pl[
'txt']] = $radio_button_obj_id;
 
 9611                          $pl[
'opt'] = array_change_key_case($pl[
'opt'], CASE_LOWER);
 
 9613                          $b = $this->pagedim[
$n][
'h'] - (($pl[
'y'] + $pl[
'h']) * $this->k);
 
 9616                          $rect = sprintf(
'%F %F %F %F', $a, $b, $a+$c, $b+$d);
 
 9618                          $annots = 
'<</Type /Annot';
 
 9619                          $annots .= 
' /Subtype /'.$pl[
'opt'][
'subtype'];
 
 9620                          $annots .= 
' /Rect ['.$rect.
']';
 
 9621                          $ft = array(
'Btn', 
'Tx', 
'Ch', 
'Sig');
 
 9622                          if (isset($pl[
'opt'][
'ft']) AND in_array($pl[
'opt'][
'ft'], $ft)) {
 
 9623                               $annots .= 
' /FT /'.$pl[
'opt'][
'ft'];
 
 9626                          $annots .= 
' /Contents '.$this->_textstring($pl[
'txt'], $annot_obj_id);
 
 9627                          $annots .= 
' /P '.$this->page_obj_id[
$n].
' 0 R';
 
 9628                          $annots .= 
' /NM '.$this->_datastring(sprintf(
'%04u-%04u', $n, $key), $annot_obj_id);
 
 9629                          $annots .= 
' /M '.$this->_datestring($annot_obj_id, $this->doc_modification_timestamp);
 
 9630                          if (isset($pl[
'opt'][
'f'])) {
 
 9632                               if (is_array($pl[
'opt'][
'f'])) {
 
 9633                                    foreach ($pl[
'opt'][
'f'] as $f) {
 
 9634                                         switch (strtolower($f)) {
 
 9667                                              case 'togglenoview': {
 
 9671                                              case 'lockedcontents': {
 
 9681                                    $fval = intval($pl[
'opt'][
'f']);
 
 9686                          if ($this->pdfa_mode) {
 
 9690                          $annots .= 
' /F '.intval($fval);
 
 9691                          if (isset($pl[
'opt'][
'as']) AND is_string($pl[
'opt'][
'as'])) {
 
 9692                               $annots .= 
' /AS /'.$pl[
'opt'][
'as'];
 
 9694                          if (isset($pl[
'opt'][
'ap'])) {
 
 9696                               $annots .= 
' /AP <<';
 
 9697                               if (is_array($pl[
'opt'][
'ap'])) {
 
 9698                                    foreach ($pl[
'opt'][
'ap'] as $apmode => $apdef) {
 
 9700                                         $annots .= 
' /'.strtoupper($apmode);
 
 9701                                         if (is_array($apdef)) {
 
 9703                                              foreach ($apdef as $apstate => $stream) {
 
 9706                                                   $annots .= 
' /'.$apstate.
' '.$apsobjid.
' 0 R';
 
 9712                                              $annots .= 
' '.$apsobjid.
' 0 R';
 
 9716                                    $annots .= $pl[
'opt'][
'ap'];
 
 9720                          if (isset($pl[
'opt'][
'bs']) AND (is_array($pl[
'opt'][
'bs']))) {
 
 9721                               $annots .= 
' /BS <<';
 
 9722                               $annots .= 
' /Type /Border';
 
 9723                               if (isset($pl[
'opt'][
'bs'][
'w'])) {
 
 9724                                    $annots .= 
' /W '.intval($pl[
'opt'][
'bs'][
'w']);
 
 9726                               $bstyles = array(
'S', 
'D', 
'B', 
'I', 
'U');
 
 9727                               if (isset($pl[
'opt'][
'bs'][
's']) AND in_array($pl[
'opt'][
'bs'][
's'], $bstyles)) {
 
 9728                                    $annots .= 
' /S /'.$pl[
'opt'][
'bs'][
's'];
 
 9730                               if (isset($pl[
'opt'][
'bs'][
'd']) AND (is_array($pl[
'opt'][
'bs'][
'd']))) {
 
 9732                                    foreach ($pl[
'opt'][
'bs'][
'd'] as $cord) {
 
 9733                                         $annots .= 
' '.intval($cord);
 
 9739                               $annots .= 
' /Border [';
 
 9740                               if (isset($pl[
'opt'][
'border']) AND (count($pl[
'opt'][
'border']) >= 3)) {
 
 9741                                    $annots .= intval($pl[
'opt'][
'border'][0]).
' ';
 
 9742                                    $annots .= intval($pl[
'opt'][
'border'][1]).
' ';
 
 9743                                    $annots .= intval($pl[
'opt'][
'border'][2]);
 
 9744                                    if (isset($pl[
'opt'][
'border'][3]) AND is_array($pl[
'opt'][
'border'][3])) {
 
 9746                                         foreach ($pl[
'opt'][
'border'][3] as $dash) {
 
 9747                                              $annots .= intval($dash).
' ';
 
 9756                          if (isset($pl[
'opt'][
'be']) AND (is_array($pl[
'opt'][
'be']))) {
 
 9757                               $annots .= 
' /BE <<';
 
 9758                               $bstyles = array(
'S', 
'C');
 
 9759                               if (isset($pl[
'opt'][
'be'][
's']) AND in_array($pl[
'opt'][
'be'][
's'], $bstyles)) {
 
 9760                                    $annots .= 
' /S /'.$pl[
'opt'][
'bs'][
's'];
 
 9762                                    $annots .= 
' /S /S';
 
 9764                               if (isset($pl[
'opt'][
'be'][
'i']) AND ($pl[
'opt'][
'be'][
'i'] >= 0) AND ($pl[
'opt'][
'be'][
'i'] <= 2)) {
 
 9765                                    $annots .= 
' /I '.sprintf(
' %F', $pl[
'opt'][
'be'][
'i']);
 
 9769                          if (isset($pl[
'opt'][
'c']) AND (is_array($pl[
'opt'][
'c'])) AND !empty($pl[
'opt'][
'c'])) {
 
 9770                               $annots .= 
' /C '.$this->getColorStringFromArray($pl[
'opt'][
'c']);
 
 9774                          $markups = array(
'text', 
'freetext', 
'line', 
'square', 
'circle', 
'polygon', 
'polyline', 
'highlight', 
'underline', 
'squiggly', 
'strikeout', 
'stamp', 
'caret', 
'ink', 
'fileattachment', 
'sound');
 
 9775                          if (in_array(strtolower($pl[
'opt'][
'subtype']), $markups)) {
 
 9777                               if (isset($pl[
'opt'][
't']) AND is_string($pl[
'opt'][
't'])) {
 
 9778                                    $annots .= 
' /T '.$this->_textstring($pl[
'opt'][
't'], $annot_obj_id);
 
 9781                               if (isset($pl[
'opt'][
'ca'])) {
 
 9782                                    $annots .= 
' /CA '.sprintf(
'%F', floatval($pl[
'opt'][
'ca']));
 
 9784                               if (isset($pl[
'opt'][
'rc'])) {
 
 9785                                    $annots .= 
' /RC '.$this->_textstring($pl[
'opt'][
'rc'], $annot_obj_id);
 
 9787                               $annots .= 
' /CreationDate '.$this->_datestring($annot_obj_id, $this->doc_creation_timestamp);
 
 9789                               if (isset($pl[
'opt'][
'subj'])) {
 
 9790                                    $annots .= 
' /Subj '.$this->_textstring($pl[
'opt'][
'subj'], $annot_obj_id);
 
 9796                          $lineendings = array(
'Square', 
'Circle', 
'Diamond', 
'OpenArrow', 
'ClosedArrow', 
'None', 
'Butt', 
'ROpenArrow', 
'RClosedArrow', 
'Slash');
 
 9798                          switch (strtolower($pl[
'opt'][
'subtype'])) {
 
 9800                                    if (isset($pl[
'opt'][
'open'])) {
 
 9801                                         $annots .= 
' /Open '. (strtolower($pl[
'opt'][
'open']) == 
'true' ? 
'true' : 
'false');
 
 9803                                    $iconsapp = array(
'Comment', 
'Help', 
'Insert', 
'Key', 
'NewParagraph', 
'Note', 
'Paragraph');
 
 9804                                    if (isset($pl[
'opt'][
'name']) AND in_array($pl[
'opt'][
'name'], $iconsapp)) {
 
 9805                                         $annots .= 
' /Name /'.$pl[
'opt'][
'name'];
 
 9807                                         $annots .= 
' /Name /Note';
 
 9809                                    $statemodels = array(
'Marked', 
'Review');
 
 9810                                    if (isset($pl[
'opt'][
'statemodel']) AND in_array($pl[
'opt'][
'statemodel'], $statemodels)) {
 
 9811                                         $annots .= 
' /StateModel /'.$pl[
'opt'][
'statemodel'];
 
 9813                                         $pl[
'opt'][
'statemodel'] = 
'Marked';
 
 9814                                         $annots .= 
' /StateModel /'.$pl[
'opt'][
'statemodel'];
 
 9816                                    if ($pl[
'opt'][
'statemodel'] == 
'Marked') {
 
 9817                                         $states = array(
'Accepted', 
'Unmarked');
 
 9819                                         $states = array(
'Accepted', 
'Rejected', 
'Cancelled', 
'Completed', 
'None');
 
 9821                                    if (isset($pl[
'opt'][
'state']) AND in_array($pl[
'opt'][
'state'], $states)) {
 
 9822                                         $annots .= 
' /State /'.$pl[
'opt'][
'state'];
 
 9824                                         if ($pl[
'opt'][
'statemodel'] == 
'Marked') {
 
 9825                                              $annots .= 
' /State /Unmarked';
 
 9827                                              $annots .= 
' /State /None';
 
 9833                                    if (is_string($pl[
'txt'])) {
 
 9834                                         if ($pl[
'txt'][0] == 
'#') {
 
 9836                                              $annots .= 
' /Dest /'.$this->encodeNameObject(substr($pl[
'txt'], 1));
 
 9839                                              $annots .= 
' /A <</S /URI /URI '.$this->_datastring($this->
unhtmlentities($pl[
'txt']), $annot_obj_id).
'>>';
 
 9843                                         if (isset($this->links[$pl[
'txt']])) {
 
 9844                                              $l = $this->links[$pl[
'txt']];
 
 9845                                              if (isset($this->page_obj_id[(
$l[0])])) {
 
 9846                                                   $annots .= sprintf(
' /Dest [%u 0 R /XYZ 0 %F null]', $this->page_obj_id[(
$l[0])], ($this->pagedim[
$l[0]][
'h'] - (
$l[1] * $this->k)));
 
 9850                                    $hmodes = array(
'N', 
'I', 
'O', 
'P');
 
 9851                                    if (isset($pl[
'opt'][
'h']) AND in_array($pl[
'opt'][
'h'], $hmodes)) {
 
 9852                                         $annots .= 
' /H /'.$pl[
'opt'][
'h'];
 
 9854                                         $annots .= 
' /H /I';
 
 9861                                    if (isset($pl[
'opt'][
'da']) AND !empty($pl[
'opt'][
'da'])) {
 
 9862                                         $annots .= 
' /DA ('.$pl[
'opt'][
'da'].
')';
 
 9864                                    if (isset($pl[
'opt'][
'q']) AND ($pl[
'opt'][
'q'] >= 0) AND ($pl[
'opt'][
'q'] <= 2)) {
 
 9865                                         $annots .= 
' /Q '.intval($pl[
'opt'][
'q']);
 
 9867                                    if (isset($pl[
'opt'][
'rc'])) {
 
 9868                                         $annots .= 
' /RC '.$this->_textstring($pl[
'opt'][
'rc'], $annot_obj_id);
 
 9870                                    if (isset($pl[
'opt'][
'ds'])) {
 
 9871                                         $annots .= 
' /DS '.$this->_textstring($pl[
'opt'][
'ds'], $annot_obj_id);
 
 9873                                    if (isset($pl[
'opt'][
'cl']) AND is_array($pl[
'opt'][
'cl'])) {
 
 9874                                         $annots .= 
' /CL [';
 
 9875                                         foreach ($pl[
'opt'][
'cl'] as $cl) {
 
 9876                                              $annots .= sprintf(
'%F ', $cl * $this->k);
 
 9880                                    $tfit = array(
'FreeText', 
'FreeTextCallout', 
'FreeTextTypeWriter');
 
 9881                                    if (isset($pl[
'opt'][
'it']) AND in_array($pl[
'opt'][
'it'], $tfit)) {
 
 9882                                         $annots .= 
' /IT /'.$pl[
'opt'][
'it'];
 
 9884                                    if (isset($pl[
'opt'][
'rd']) AND is_array($pl[
'opt'][
'rd'])) {
 
 9886                                         $r = $pl[
'opt'][
'rd'][1] * 
$this->k;
 
 9887                                         $t = $pl[
'opt'][
'rd'][2] * 
$this->k;
 
 9888                                         $b = $pl[
'opt'][
'rd'][3] * 
$this->k;
 
 9889                                         $annots .= 
' /RD ['.sprintf(
'%F %F %F %F', 
$l, $r, $t, $b).
']';
 
 9891                                    if (isset($pl[
'opt'][
'le']) AND in_array($pl[
'opt'][
'le'], $lineendings)) {
 
 9892                                         $annots .= 
' /LE /'.$pl[
'opt'][
'le'];
 
 9935                               case 'fileattachment': {
 
 9936                                    if ($this->pdfa_mode) {
 
 9940                                    if (!isset($pl[
'opt'][
'fs'])) {
 
 9944                                    if (isset($this->embeddedfiles[
$filename][
'n'])) {
 
 9945                                         $annots .= 
' /FS <</Type /Filespec /F '.$this->_datastring($filename, $annot_obj_id).
' /EF <</F '.$this->embeddedfiles[
$filename][
'n'].
' 0 R>> >>';
 
 9946                                         $iconsapp = array(
'Graph', 
'Paperclip', 
'PushPin', 
'Tag');
 
 9947                                         if (isset($pl[
'opt'][
'name']) AND in_array($pl[
'opt'][
'name'], $iconsapp)) {
 
 9948                                              $annots .= 
' /Name /'.$pl[
'opt'][
'name'];
 
 9950                                              $annots .= 
' /Name /PushPin';
 
 9956                                    if (!isset($pl[
'opt'][
'fs'])) {
 
 9960                                    if (isset($this->embeddedfiles[
$filename][
'n'])) {
 
 9963                                         $annots .= 
' /Sound <</Type /Filespec /F '.$this->_datastring($filename, $annot_obj_id).
' /EF <</F '.$this->embeddedfiles[
$filename][
'n'].
' 0 R>> >>';
 
 9964                                         $iconsapp = array(
'Speaker', 
'Mic');
 
 9965                                         if (isset($pl[
'opt'][
'name']) AND in_array($pl[
'opt'][
'name'], $iconsapp)) {
 
 9966                                              $annots .= 
' /Name /'.$pl[
'opt'][
'name'];
 
 9968                                              $annots .= 
' /Name /Speaker';
 
 9977                                    $hmode = array(
'N', 
'I', 
'O', 
'P', 
'T');
 
 9978                                    if (isset($pl[
'opt'][
'h']) AND in_array($pl[
'opt'][
'h'], $hmode)) {
 
 9979                                         $annots .= 
' /H /'.$pl[
'opt'][
'h'];
 
 9981                                    if (isset($pl[
'opt'][
'mk']) AND (is_array($pl[
'opt'][
'mk'])) AND !empty($pl[
'opt'][
'mk'])) {
 
 9982                                         $annots .= 
' /MK <<';
 
 9983                                         if (isset($pl[
'opt'][
'mk'][
'r'])) {
 
 9984                                              $annots .= 
' /R '.$pl[
'opt'][
'mk'][
'r'];
 
 9986                                         if (isset($pl[
'opt'][
'mk'][
'bc']) AND (is_array($pl[
'opt'][
'mk'][
'bc']))) {
 
 9987                                              $annots .= 
' /BC '.$this->getColorStringFromArray($pl[
'opt'][
'mk'][
'bc']);
 
 9989                                         if (isset($pl[
'opt'][
'mk'][
'bg']) AND (is_array($pl[
'opt'][
'mk'][
'bg']))) {
 
 9990                                              $annots .= 
' /BG '.$this->getColorStringFromArray($pl[
'opt'][
'mk'][
'bg']);
 
 9992                                         if (isset($pl[
'opt'][
'mk'][
'ca'])) {
 
 9993                                              $annots .= 
' /CA '.$pl[
'opt'][
'mk'][
'ca'];
 
 9995                                         if (isset($pl[
'opt'][
'mk'][
'rc'])) {
 
 9996                                              $annots .= 
' /RC '.$pl[
'opt'][
'mk'][
'rc'];
 
 9998                                         if (isset($pl[
'opt'][
'mk'][
'ac'])) {
 
 9999                                              $annots .= 
' /AC '.$pl[
'opt'][
'mk'][
'ac'];
 
10001                                         if (isset($pl[
'opt'][
'mk'][
'i'])) {
 
10003                                              if ($info !== 
false) {
 
10004                                                   $annots .= 
' /I '.$info[
'n'].
' 0 R';
 
10007                                         if (isset($pl[
'opt'][
'mk'][
'ri'])) {
 
10009                                              if ($info !== 
false) {
 
10010                                                   $annots .= 
' /RI '.$info[
'n'].
' 0 R';
 
10013                                         if (isset($pl[
'opt'][
'mk'][
'ix'])) {
 
10015                                              if ($info !== 
false) {
 
10016                                                   $annots .= 
' /IX '.$info[
'n'].
' 0 R';
 
10019                                         if (isset($pl[
'opt'][
'mk'][
'if']) AND (is_array($pl[
'opt'][
'mk'][
'if'])) AND !empty($pl[
'opt'][
'mk'][
'if'])) {
 
10020                                              $annots .= 
' /IF <<';
 
10021                                              $if_sw = array(
'A', 
'B', 
'S', 
'N');
 
10022                                              if (isset($pl[
'opt'][
'mk'][
'if'][
'sw']) AND in_array($pl[
'opt'][
'mk'][
'if'][
'sw'], $if_sw)) {
 
10023                                                   $annots .= 
' /SW /'.$pl[
'opt'][
'mk'][
'if'][
'sw'];
 
10025                                              $if_s = array(
'A', 
'P');
 
10026                                              if (isset($pl[
'opt'][
'mk'][
'if'][
's']) AND in_array($pl[
'opt'][
'mk'][
'if'][
's'], $if_s)) {
 
10027                                                   $annots .= 
' /S /'.$pl[
'opt'][
'mk'][
'if'][
's'];
 
10029                                              if (isset($pl[
'opt'][
'mk'][
'if'][
'a']) AND (is_array($pl[
'opt'][
'mk'][
'if'][
'a'])) AND !empty($pl[
'opt'][
'mk'][
'if'][
'a'])) {
 
10030                                                   $annots .= sprintf(
' /A [%F %F]', $pl[
'opt'][
'mk'][
'if'][
'a'][0], $pl[
'opt'][
'mk'][
'if'][
'a'][1]);
 
10032                                              if (isset($pl[
'opt'][
'mk'][
'if'][
'fb']) AND ($pl[
'opt'][
'mk'][
'if'][
'fb'])) {
 
10033                                                   $annots .= 
' /FB true';
 
10037                                         if (isset($pl[
'opt'][
'mk'][
'tp']) AND ($pl[
'opt'][
'mk'][
'tp'] >= 0) AND ($pl[
'opt'][
'mk'][
'tp'] <= 6)) {
 
10038                                              $annots .= 
' /TP '.intval($pl[
'opt'][
'mk'][
'tp']);
 
10043                                    if (isset($this->radiobutton_groups[$n][$pl[
'txt']])) {
 
10045                                         $annots .= 
' /Parent '.$this->radiobutton_groups[
$n][$pl[
'txt']].
' 0 R';
 
10047                                    if (isset($pl[
'opt'][
't']) AND is_string($pl[
'opt'][
't'])) {
 
10048                                         $annots .= 
' /T '.$this->_datastring($pl[
'opt'][
't'], $annot_obj_id);
 
10050                                    if (isset($pl[
'opt'][
'tu']) AND is_string($pl[
'opt'][
'tu'])) {
 
10051                                         $annots .= 
' /TU '.$this->_datastring($pl[
'opt'][
'tu'], $annot_obj_id);
 
10053                                    if (isset($pl[
'opt'][
'tm']) AND is_string($pl[
'opt'][
'tm'])) {
 
10054                                         $annots .= 
' /TM '.$this->_datastring($pl[
'opt'][
'tm'], $annot_obj_id);
 
10056                                    if (isset($pl[
'opt'][
'ff'])) {
 
10057                                         if (is_array($pl[
'opt'][
'ff'])) {
 
10060                                              foreach($pl[
'opt'][
'ff'] as $val) {
 
10061                                                   $flag += 1 << ($val - 1);
 
10064                                              $flag = intval($pl[
'opt'][
'ff']);
 
10066                                         $annots .= 
' /Ff '.$flag;
 
10068                                    if (isset($pl[
'opt'][
'maxlen'])) {
 
10069                                         $annots .= 
' /MaxLen '.intval($pl[
'opt'][
'maxlen']);
 
10071                                    if (isset($pl[
'opt'][
'v'])) {
 
10073                                         if (is_array($pl[
'opt'][
'v'])) {
 
10074                                              foreach ($pl[
'opt'][
'v'] AS $optval) {
 
10075                                                   if (is_float($optval)) {
 
10076                                                        $optval = sprintf(
'%F', $optval);
 
10078                                                   $annots .= 
' '.$optval;
 
10081                                              $annots .= 
' '.$this->_textstring($pl[
'opt'][
'v'], $annot_obj_id);
 
10084                                    if (isset($pl[
'opt'][
'dv'])) {
 
10086                                         if (is_array($pl[
'opt'][
'dv'])) {
 
10087                                              foreach ($pl[
'opt'][
'dv'] AS $optval) {
 
10088                                                   if (is_float($optval)) {
 
10089                                                        $optval = sprintf(
'%F', $optval);
 
10091                                                   $annots .= 
' '.$optval;
 
10094                                              $annots .= 
' '.$this->_textstring($pl[
'opt'][
'dv'], $annot_obj_id);
 
10097                                    if (isset($pl[
'opt'][
'rv'])) {
 
10099                                         if (is_array($pl[
'opt'][
'rv'])) {
 
10100                                              foreach ($pl[
'opt'][
'rv'] AS $optval) {
 
10101                                                   if (is_float($optval)) {
 
10102                                                        $optval = sprintf(
'%F', $optval);
 
10104                                                   $annots .= 
' '.$optval;
 
10107                                              $annots .= 
' '.$this->_textstring($pl[
'opt'][
'rv'], $annot_obj_id);
 
10110                                    if (isset($pl[
'opt'][
'a']) AND !empty($pl[
'opt'][
'a'])) {
 
10111                                         $annots .= 
' /A << '.$pl[
'opt'][
'a'].
' >>';
 
10113                                    if (isset($pl[
'opt'][
'aa']) AND !empty($pl[
'opt'][
'aa'])) {
 
10114                                         $annots .= 
' /AA << '.$pl[
'opt'][
'aa'].
' >>';
 
10116                                    if (isset($pl[
'opt'][
'da']) AND !empty($pl[
'opt'][
'da'])) {
 
10117                                         $annots .= 
' /DA ('.$pl[
'opt'][
'da'].
')';
 
10119                                    if (isset($pl[
'opt'][
'q']) AND ($pl[
'opt'][
'q'] >= 0) AND ($pl[
'opt'][
'q'] <= 2)) {
 
10120                                         $annots .= 
' /Q '.intval($pl[
'opt'][
'q']);
 
10122                                    if (isset($pl[
'opt'][
'opt']) AND (is_array($pl[
'opt'][
'opt'])) AND !empty($pl[
'opt'][
'opt'])) {
 
10123                                         $annots .= 
' /Opt [';
 
10124                                         foreach($pl[
'opt'][
'opt'] AS $copt) {
 
10125                                              if (is_array($copt)) {
 
10126                                                   $annots .= 
' ['.$this->_textstring($copt[0], $annot_obj_id).
' '.$this->
_textstring($copt[1], $annot_obj_id).
']';
 
10128                                                   $annots .= 
' '.$this->_textstring($copt, $annot_obj_id);
 
10133                                    if (isset($pl[
'opt'][
'ti'])) {
 
10134                                         $annots .= 
' /TI '.intval($pl[
'opt'][
'ti']);
 
10136                                    if (isset($pl[
'opt'][
'i']) AND (is_array($pl[
'opt'][
'i'])) AND !empty($pl[
'opt'][
'i'])) {
 
10137                                         $annots .= 
' /I [';
 
10138                                         foreach($pl[
'opt'][
'i'] AS $copt) {
 
10139                                              $annots .= intval($copt).
' ';
 
10148                               case 'printermark': {
 
10154                               case 'watermark': {
 
10166                          $this->
_out($this->
_getobj($annot_obj_id).
"\n".$annots.
"\n".
'endobj');
 
10167                          if ($formfield AND !isset($this->radiobutton_groups[$n][$pl[
'txt']])) {
 
10169                               $this->form_obj_id[] = $annot_obj_id;
 
10186           $stream = trim($stream);
 
10187           $out = $this->
_getobj().
"\n";
 
10188           $this->xobjects[
'AX'.$this->n] = array(
'n' => $this->n);
 
10190           $out .= 
' /Type /XObject';
 
10191           $out .= 
' /Subtype /Form';
 
10192           $out .= 
' /FormType 1';
 
10193           if ($this->compress) {
 
10194                $stream = gzcompress($stream);
 
10195                $out .= 
' /Filter /FlateDecode';
 
10197           $rect = sprintf(
'%F %F', 
$w, 
$h);
 
10198           $out .= 
' /BBox [0 0 '.$rect.
']';
 
10199           $out .= 
' /Matrix [1 0 0 1 0 0]';
 
10200           $out .= 
' /Resources 2 0 R';
 
10202           $out .= 
' /Length '.strlen($stream);
 
10204           $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
10205           $out .= 
"\n".
'endobj';
 
10220           $v = unpack(
'Ni', substr($str, $offset, 4));
 
10234           $v = unpack(
'ni', substr($str, $offset, 2));
 
10248           $v = unpack(
'si', substr($str, $offset, 2));
 
10296           $f = $this->
_getUSHORT($str, ($offset + 2));
 
10297           $v = floatval(
''.$m.
'.'.$f.
'');
 
10311           $v = unpack(
'Ci', substr($str, $offset, 1));
 
10325           if (($cid >= 0) AND ($cid <= 0xFFFF) AND ($gid >= 0)) {
 
10326                if ($gid > 0xFFFF) {
 
10329                $map[($cid * 2)] = chr($gid >> 8);
 
10330                $map[(($cid * 2) + 1)] = chr($gid & 0xFF);
 
10350      public function addTTFfont($fontfile, $fonttype=
'', $enc=
'', $flags=32, $outpath=
'', $platid=3, $encid=1, $addcbbox=
false) {
 
10351           if (!file_exists($fontfile)) {
 
10352                $this->
Error(
'Could not find file: '.$fontfile.
'');
 
10355           $fmetric = array();
 
10357           $font_path_parts = pathinfo($fontfile);
 
10358           if (!isset($font_path_parts[
'filename'])) {
 
10359                $font_path_parts[
'filename'] = substr($font_path_parts[
'basename'], 0, -(strlen($font_path_parts[
'extension']) + 1));
 
10361           $font_name = strtolower($font_path_parts[
'filename']);
 
10362           $font_name = preg_replace(
'/[^a-z0-9_]/', 
'', $font_name);
 
10363           $search  = array(
'bold', 
'oblique', 
'italic', 
'regular');
 
10364           $replace = array(
'b', 
'i', 
'i', 
'');
 
10365           $font_name = str_replace(
$search, $replace, $font_name);
 
10366           if (empty($font_name)) {
 
10368                $font_name = 
'tcpdffont';
 
10371           if (empty($outpath)) {
 
10375           if (file_exists($outpath.$font_name.
'.php')) {
 
10379           $fmetric[
'file'] = $font_name.
'.z';
 
10380           $fmetric[
'ctg'] = $font_name.
'.ctg.z';
 
10382           $font = file_get_contents($fontfile);
 
10383           $fmetric[
'originalsize'] = strlen($font);
 
10385           if (empty($fonttype)) {
 
10386                if ($this->
_getULONG($font, 0) == 0x10000) {
 
10388                     $fonttype = 
'TrueTypeUnicode';
 
10389                } 
elseif (substr($font, 0, 4) == 
'OTTO') {
 
10391                     $this->
Error(
'Unsupported font format: OpenType with CFF data.');
 
10394                     $fonttype = 
'Type1';
 
10398           switch ($fonttype) {
 
10403                     $fmetric[
'type'] = 
'cidfont0';
 
10407                     $fmetric[
'type'] = 
'Type1';
 
10408                     if (empty($enc) AND (($flags & 4) == 0)) {
 
10414                     $fmetric[
'type'] = 
'TrueType';
 
10417                case 'TrueTypeUnicode':
 
10419                     $fmetric[
'type'] = 
'TrueTypeUnicode';
 
10424           $fmetric[
'enc'] = preg_replace(
'/[^A-Za-z0-9_\-]/', 
'', $enc);
 
10425           $fmetric[
'diff'] = 
'';
 
10426           if (($fmetric[
'type'] == 
'TrueType') OR ($fmetric[
'type'] == 
'Type1')) {
 
10427                if (!empty($enc) AND ($enc != 
'cp1252') AND isset($this->encmaps->encmap[$enc])) {
 
10429                     $enc_ref = $this->encmaps->encmap[
'cp1252'];
 
10430                     $enc_target = $this->encmaps->encmap[$enc];
 
10432                     for (
$i = 32; 
$i <= 255; ++
$i) {
 
10433                          if ($enc_target != $enc_ref[
$i]) {
 
10434                               if ($i != ($last + 1)) {
 
10435                                    $fmetric[
'diff'] .= $i.
' ';
 
10438                               $fmetric[
'diff'] .= 
'/'.$enc_target[
$i].
' ';
 
10444           if ($fmetric[
'type'] == 
'Type1') {
 
10447                $a = unpack(
'Cmarker/Ctype/Vsize', substr($font, 0, 6));
 
10448                if ($a[
'marker'] != 128) {
 
10449                     $this->
Error(
'Font file is not a valid binary Type1');
 
10451                $fmetric[
'size1'] = $a[
'size'];
 
10452                $data = substr($font, 6, $fmetric[
'size1']);
 
10454                $a = unpack(
'Cmarker/Ctype/Vsize', substr($font, (6 + $fmetric[
'size1']), 6));
 
10455                if ($a[
'marker'] != 128) {
 
10456                     $this->
Error(
'Font file is not a valid binary Type1');
 
10458                $fmetric[
'size2'] = $a[
'size'];
 
10459                $encrypted = substr($font, (12 + $fmetric[
'size1']), $fmetric[
'size2']);
 
10462                $fp = fopen($outpath.$fmetric[
'file'], 
'wb');
 
10466                $fmetric[
'Flags'] = $flags;
 
10467                preg_match (
'#/FullName[\s]*\(([^\)]*)#', $font, $matches);
 
10468                $fmetric[
'name'] = preg_replace(
'/[^a-zA-Z0-9_\-]/', 
'', $matches[1]);
 
10469                preg_match(
'#/FontBBox[\s]*{([^}]*)#', $font, $matches);
 
10470                $fmetric[
'bbox'] = trim($matches[1]);
 
10471                $bv = explode(
' ', $fmetric[
'bbox']);
 
10472                $fmetric[
'Ascent'] = intval($bv[3]);
 
10473                $fmetric[
'Descent'] = intval($bv[1]);
 
10474                preg_match(
'#/ItalicAngle[\s]*([0-9\+\-]*)#', $font, $matches);
 
10475                $fmetric[
'italicAngle'] = intval($matches[1]);
 
10476                if ($fmetric[
'italicAngle'] != 0) {
 
10477                     $fmetric[
'Flags'] |= 64;
 
10479                preg_match(
'#/UnderlinePosition[\s]*([0-9\+\-]*)#', $font, $matches);
 
10480                $fmetric[
'underlinePosition'] = intval($matches[1]);
 
10481                preg_match(
'#/UnderlineThickness[\s]*([0-9\+\-]*)#', $font, $matches);
 
10482                $fmetric[
'underlineThickness'] = intval($matches[1]);
 
10483                preg_match(
'#/isFixedPitch[\s]*([^\s]*)#', $font, $matches);
 
10484                if ($matches[1] == 
'true') {
 
10485                     $fmetric[
'Flags'] |= 1;
 
10489                if (preg_match_all(
'#dup[\s]([0-9]+)[\s]*/([^\s]*)[\s]put#sU', $font, $fmap, PREG_SET_ORDER) > 0) {
 
10490                     foreach ($fmap as $v) {
 
10491                          $imap[$v[2]] = $v[1];
 
10500                for (
$i = 0; 
$i < $elen; ++
$i) {
 
10502                     $eplain .= chr($chr ^ ($r >> 8));
 
10503                     $r = ((($chr + $r) * $c1 + $c2) % 65536);
 
10505                if (preg_match(
'#/ForceBold[\s]*([^\s]*)#', $eplain, $matches) > 0) {
 
10506                     if ($matches[1] == 
'true') {
 
10507                          $fmetric[
'Flags'] |= 0x40000;
 
10510                if (preg_match(
'#/StdVW[\s]*\[([^\]]*)#', $eplain, $matches) > 0) {
 
10511                     $fmetric[
'StemV'] = intval($matches[1]);
 
10513                     $fmetric[
'StemV'] = 70;
 
10515                if (preg_match(
'#/StdHW[\s]*\[([^\]]*)#', $eplain, $matches) > 0) {
 
10516                     $fmetric[
'StemH'] = intval($matches[1]);
 
10518                     $fmetric[
'StemH'] = 30;
 
10520                if (preg_match(
'#/BlueValues[\s]*\[([^\]]*)#', $eplain, $matches) > 0) {
 
10521                     $bv = explode(
' ', $matches[1]);
 
10522                     if (count($bv) >= 6) {
 
10523                          $v1 = intval($bv[2]);
 
10524                          $v2 = intval($bv[4]);
 
10526                               $fmetric[
'XHeight'] = $v1;
 
10527                               $fmetric[
'CapHeight'] = $v2;
 
10529                               $fmetric[
'XHeight'] = $v2;
 
10530                               $fmetric[
'CapHeight'] = $v1;
 
10533                          $fmetric[
'XHeight'] = 450;
 
10534                          $fmetric[
'CapHeight'] = 700;
 
10537                     $fmetric[
'XHeight'] = 450;
 
10538                     $fmetric[
'CapHeight'] = 700;
 
10541                if (preg_match(
'#/lenIV[\s]*([0-9]*)#', $eplain, $matches) > 0) {
 
10542                     $lenIV = intval($matches[1]);
 
10546                $fmetric[
'Leading'] = 0;
 
10548                $eplain = substr($eplain, (strpos($eplain, 
'/CharStrings') + 1));
 
10549                preg_match_all(
'#/([A-Za-z0-9\.]*)[\s][0-9]+[\s]RD[\s](.*)[\s]ND#sU', $eplain, $matches, PREG_SET_ORDER);
 
10550                if (!empty($enc) AND isset($this->encmaps->encmap[$enc])) {
 
10551                     $enc_map = $this->encmaps->encmap[$enc];
 
10555                $fmetric[
'cw'] = 
'';
 
10556                $fmetric[
'MaxWidth'] = 0;
 
10557                $cwidths = array();
 
10558                foreach ($matches as 
$k => $v) {
 
10560                     if (isset($imap[$v[1]])) {
 
10561                          $cid = $imap[$v[1]];
 
10562                     } 
elseif ($enc_map !== 
false) {
 
10563                          $cid = array_search($v[1], $enc_map);
 
10564                          if ($cid === 
false) {
 
10566                          } 
elseif ($cid > 1000) {
 
10575                     $clen = strlen($cd);
 
10577                     for (
$i = 0; 
$i < $clen; ++
$i) {
 
10578                          $chr = ord($cd[
$i]);
 
10579                          $ccom[] = ($chr ^ ($r >> 8));
 
10580                          $r = ((($chr + $r) * $c1 + $c2) % 65536);
 
10586                     while (
$i < $clen) {
 
10587                          if ($ccom[
$i] < 32) {
 
10588                               $cdec[$ck] = $ccom[
$i];
 
10589                               if (($ck > 0) AND ($cdec[$ck] == 13)) {
 
10591                                    $cwidths[$cid] = $cdec[($ck - 1)];
 
10594                          } 
elseif (($ccom[
$i] >= 32) AND ($ccom[
$i] <= 246)) {
 
10595                               $cdec[$ck] = ($ccom[
$i] - 139);
 
10597                          } 
elseif (($ccom[
$i] >= 247) AND ($ccom[
$i] <= 250)) {
 
10598                               $cdec[$ck] = ((($ccom[
$i] - 247) * 256) + $ccom[(
$i + 1)] + 108);
 
10600                          } 
elseif (($ccom[
$i] >= 251) AND ($ccom[
$i] <= 254)) {
 
10601                               $cdec[$ck] = ((-($ccom[
$i] - 251) * 256) - $ccom[(
$i + 1)] - 108);
 
10604                               $sval = chr($ccom[(
$i + 1)]).chr($ccom[(
$i + 2)]).chr($ccom[(
$i + 3)]).chr($ccom[(
$i + 4)]);
 
10605                               $vsval = unpack(
'li', $sval);
 
10606                               $cdec[$ck] = $vsval[
'i'];
 
10612                $fmetric[
'MissingWidth'] = $cwidths[0];
 
10613                $fmetric[
'MaxWidth'] = $fmetric[
'MissingWidth'];
 
10614                $fmetric[
'AvgWidth'] = 0;
 
10616                for ($cid = 0; $cid <= 255; ++$cid) {
 
10617                     if (isset($cwidths[$cid])) {
 
10618                          if ($cwidths[$cid] > $fmetric[
'MaxWidth']) {
 
10619                               $fmetric[
'MaxWidth'] = $cwidths[$cid];
 
10621                          $fmetric[
'AvgWidth'] += $cwidths[$cid];
 
10622                          $fmetric[
'cw'] .= 
','.$cid.
'=>'.$cwidths[$cid];
 
10624                          $fmetric[
'cw'] .= 
','.$cid.
'=>'.$fmetric[
'MissingWidth'];
 
10627                $fmetric[
'AvgWidth'] = round($fmetric[
'AvgWidth'] / count($cwidths));
 
10630                if ($fmetric[
'type'] != 
'cidfont0') {
 
10632                     $fp = fopen($outpath.$fmetric[
'file'], 
'wb');
 
10633                     fwrite(
$fp, gzcompress($font));
 
10637                if ($this->
_getULONG($font, $offset) != 0x10000) {
 
10643                $numTables = $this->
_getUSHORT($font, $offset);
 
10650                for (
$i = 0; 
$i < $numTables; ++
$i) {
 
10652                     $tag = substr($font, $offset, 4);
 
10654                     $table[$tag] = array();
 
10655                     $table[$tag][
'checkSum'] = $this->
_getULONG($font, $offset);
 
10657                     $table[$tag][
'offset'] = $this->
_getULONG($font, $offset);
 
10659                     $table[$tag][
'length'] = $this->
_getULONG($font, $offset);
 
10663                $offset = $table[
'head'][
'offset'] + 12;
 
10664                if ($this->
_getULONG($font, $offset) != 0x5F0F3CF5) {
 
10671                $fmetric[
'unitsPerEm'] = $this->
_getUSHORT($font, $offset);
 
10674                $urk = (1000 / $fmetric[
'unitsPerEm']);
 
10676                $xMin = round($this->
_getFWORD($font, $offset) * $urk);
 
10678                $yMin = round($this->
_getFWORD($font, $offset) * $urk);
 
10680                $xMax = round($this->
_getFWORD($font, $offset) * $urk);
 
10682                $yMax = round($this->
_getFWORD($font, $offset) * $urk);
 
10684                $fmetric[
'bbox'] = 
''.$xMin.
' '.$yMin.
' '.$xMax.
' '.$yMax.
'';
 
10685                $macStyle = $this->
_getUSHORT($font, $offset);
 
10688                $fmetric[
'Flags'] = $flags;
 
10689                if (($macStyle & 2) == 2) {
 
10691                     $fmetric[
'Flags'] |= 64;
 
10694                $offset = $table[
'head'][
'offset'] + 50;
 
10695                $short_offset = ($this->
_getSHORT($font, $offset) == 0);
 
10698                $indexToLoc = array();
 
10699                $offset = $table[
'loca'][
'offset'];
 
10700                if ($short_offset) {
 
10702                     $tot_num_glyphs = ($table[
'loca'][
'length'] / 2); 
 
10703                     for (
$i = 0; 
$i < $tot_num_glyphs; ++
$i) {
 
10704                          $indexToLoc[
$i] = $this->
_getUSHORT($font, $offset) * 2;
 
10709                     $tot_num_glyphs = ($table[
'loca'][
'length'] / 4); 
 
10710                     for (
$i = 0; 
$i < $tot_num_glyphs; ++
$i) {
 
10711                          $indexToLoc[
$i] = $this->
_getULONG($font, $offset);
 
10716                $offset = $table[
'cmap'][
'offset'] + 2;
 
10717                $numEncodingTables = $this->
_getUSHORT($font, $offset);
 
10719                $encodingTables = array();
 
10720                for (
$i = 0; 
$i < $numEncodingTables; ++
$i) {
 
10721                     $encodingTables[
$i][
'platformID'] = $this->
_getUSHORT($font, $offset);
 
10723                     $encodingTables[
$i][
'encodingID'] = $this->
_getUSHORT($font, $offset);
 
10725                     $encodingTables[
$i][
'offset'] = $this->
_getULONG($font, $offset);
 
10729                $offset = $table[
'OS/2'][
'offset'];
 
10732                $fmetric[
'AvgWidth'] = round($this->
_getFWORD($font, $offset) * $urk);
 
10735                $usWeightClass = round($this->
_getUFWORD($font, $offset) * $urk);
 
10737                $fmetric[
'StemV'] = round((70 * $usWeightClass) / 400);
 
10738                $fmetric[
'StemH'] = round((30 * $usWeightClass) / 400);
 
10741                $fsType = $this->
_getSHORT($font, $offset);
 
10743                if ($fsType == 2) {
 
10744                     $this->
Error(
'This Font cannot be modified, embedded or exchanged in any manner without first obtaining permission of the legal owner.');
 
10747                $fmetric[
'name'] = 
'';
 
10748                $offset = $table[
'name'][
'offset'];
 
10751                $numNameRecords = $this->
_getUSHORT($font, $offset);
 
10754                $stringStorageOffset = $this->
_getUSHORT($font, $offset);
 
10756                for (
$i = 0; 
$i < $numNameRecords; ++
$i) {
 
10759                     $nameID = $this->
_getUSHORT($font, $offset);
 
10761                     if ($nameID == 6) {
 
10763                          $stringLength = $this->
_getUSHORT($font, $offset);
 
10766                          $stringOffset = $this->
_getUSHORT($font, $offset);
 
10768                          $offset = ($table[
'name'][
'offset'] + $stringStorageOffset + $stringOffset);
 
10769                          $fmetric[
'name'] = substr($font, $offset, $stringLength);
 
10770                          $fmetric[
'name'] = preg_replace(
'/[^a-zA-Z0-9_\-]/', 
'', $fmetric[
'name']);
 
10776                if (empty($fmetric[
'name'])) {
 
10777                     $fmetric[
'name'] = $font_name;
 
10780                $offset = $table[
'post'][
'offset'];
 
10782                $fmetric[
'italicAngle'] = $this->
_getFIXED($font, $offset);
 
10784                $fmetric[
'underlinePosition'] = round($this->
_getFWORD($font, $offset) * $urk);
 
10786                $fmetric[
'underlineThickness'] = round($this->
_getFWORD($font, $offset) * $urk);
 
10788                $isFixedPitch = ($this->
_getULONG($font, $offset) == 0) ? 
false : 
true;
 
10790                if ($isFixedPitch) {
 
10791                     $fmetric[
'Flags'] |= 1;
 
10794                $offset = $table[
'hhea'][
'offset'];
 
10797                $fmetric[
'Ascent'] = round($this->
_getFWORD($font, $offset) * $urk);
 
10800                $fmetric[
'Descent'] = round($this->
_getFWORD($font, $offset) * $urk);
 
10803                $fmetric[
'Leading'] = round($this->
_getFWORD($font, $offset) * $urk);
 
10806                $fmetric[
'MaxWidth'] = round($this->
_getUFWORD($font, $offset) * $urk);
 
10810                $numberOfHMetrics = $this->
_getUSHORT($font, $offset);
 
10812                $offset = $table[
'maxp'][
'offset'];
 
10815                $numGlyphs = $this->
_getUSHORT($font, $offset);
 
10818                foreach ($encodingTables as $enctable) {
 
10820                     if (($enctable[
'platformID'] == $platid) AND ($enctable[
'encodingID'] == $encid)) {
 
10821                          $offset = $table[
'cmap'][
'offset'] + $enctable[
'offset'];
 
10822                          $format = $this->
_getUSHORT($font, $offset);
 
10827                                    for ($c = 0; $c < 256; ++$c) {
 
10828                                         $g = $this->
_getBYTE($font, $offset);
 
10836                                    $numSubHeaders = 0;
 
10837                                    for (
$i = 0; 
$i < 256; ++
$i) {
 
10839                                         $subHeaderKeys[
$i] = ($this->
_getUSHORT($font, $offset) / 8);
 
10841                                         if ($numSubHeaders < $subHeaderKeys[
$i]) {
 
10842                                              $numSubHeaders = $subHeaderKeys[
$i];
 
10848                                    $subHeaders = array();
 
10849                                    $numGlyphIndexArray = 0;
 
10850                                    for (
$k = 0; 
$k < $numSubHeaders; ++
$k) {
 
10851                                         $subHeaders[
$k][
'firstCode'] = $this->
_getUSHORT($font, $offset);
 
10853                                         $subHeaders[
$k][
'entryCount'] = $this->
_getUSHORT($font, $offset);
 
10855                                         $subHeaders[
$k][
'idDelta'] = $this->
_getUSHORT($font, $offset);
 
10857                                         $subHeaders[
$k][
'idRangeOffset'] = $this->
_getUSHORT($font, $offset);
 
10859                                         $subHeaders[
$k][
'idRangeOffset'] -= (2 + (($numSubHeaders - 
$k - 1) * 8));
 
10860                                         $subHeaders[
$k][
'idRangeOffset'] /= 2;
 
10861                                         $numGlyphIndexArray += $subHeaders[
$k][
'entryCount'];
 
10863                                    for (
$k = 0; 
$k < $numGlyphIndexArray; ++
$k) {
 
10864                                         $glyphIndexArray[
$k] = $this->
_getUSHORT($font, $offset);
 
10867                                    for (
$i = 0; 
$i < 256; ++
$i) {
 
10868                                         $k = $subHeaderKeys[
$i];
 
10872                                              $g = $glyphIndexArray[0];
 
10876                                              $start_byte = $subHeaders[
$k][
'firstCode'];
 
10877                                              $end_byte = $start_byte + $subHeaders[
$k][
'entryCount'];
 
10878                                              for ($j = $start_byte; $j < $end_byte; ++$j) {
 
10880                                                   $c = ((
$i << 8) + $j);
 
10881                                                   $idRangeOffset = ($subHeaders[
$k][
'idRangeOffset'] + $j - $subHeaders[
$k][
'firstCode']);
 
10882                                                   $g = ($glyphIndexArray[$idRangeOffset] + $idDelta[
$k]) % 65536;
 
10893                                    $length = $this->
_getUSHORT($font, $offset);
 
10896                                    $segCount = ($this->
_getUSHORT($font, $offset) / 2);
 
10899                                    $endCount = array(); 
 
10900                                    for (
$k = 0; 
$k < $segCount; ++
$k) {
 
10905                                    $startCount = array(); 
 
10906                                    for (
$k = 0; 
$k < $segCount; ++
$k) {
 
10910                                    $idDelta = array(); 
 
10911                                    for (
$k = 0; 
$k < $segCount; ++
$k) {
 
10915                                    $idRangeOffset = array(); 
 
10916                                    for (
$k = 0; 
$k < $segCount; ++
$k) {
 
10917                                         $idRangeOffset[
$k] = $this->
_getUSHORT($font, $offset);
 
10920                                    $gidlen = ($length / 2) - 8 - (4 * $segCount);
 
10921                                    $glyphIdArray = array(); 
 
10922                                    for (
$k = 0; 
$k < $gidlen; ++
$k) {
 
10923                                         $glyphIdArray[
$k] = $this->
_getUSHORT($font, $offset);
 
10926                                    for (
$k = 0; 
$k < $segCount; ++
$k) {
 
10927                                         for ($c = $startCount[
$k]; $c <= $endCount[
$k]; ++$c) {
 
10928                                              if ($idRangeOffset[
$k] == 0) {
 
10929                                                   $g = ($idDelta[
$k] + $c) % 65536;
 
10931                                                   $gid = (($idRangeOffset[
$k] / 2) + ($c - $startCount[
$k]) - ($segCount - 
$k));
 
10932                                                   $g = ($glyphIdArray[$gid] + $idDelta[
$k]) % 65536;
 
10944                                    $firstCode = $this->
_getUSHORT($font, $offset);
 
10946                                    $entryCount = $this->
_getUSHORT($font, $offset);
 
10948                                    for (
$k = 0; 
$k < $entryCount; ++
$k) {
 
10949                                         $c = (
$k + $firstCode);
 
10958                                    for (
$k = 0; 
$k < 8192; ++
$k) {
 
10959                                         $is32[
$k] = $this->
_getBYTE($font, $offset);
 
10962                                    $nGroups = $this->
_getULONG($font, $offset);
 
10964                                    for (
$i = 0; 
$i < $nGroups; ++
$i) {
 
10965                                         $startCharCode = $this->
_getULONG($font, $offset);
 
10967                                         $endCharCode = $this->
_getULONG($font, $offset);
 
10969                                         $startGlyphID = $this->
_getULONG($font, $offset);
 
10971                                         for (
$k = $startCharCode; 
$k <= $endCharCode; ++
$k) {
 
10972                                              $is32idx = floor($c / 8);
 
10973                                              if ((isset($is32[$is32idx])) AND (($is32[$is32idx] & (1 << (7 - ($c % 8)))) == 0)) {
 
10980                                                   $c = ((55232 + (
$k >> 10)) << 10) + (0xDC00 + (
$k & 0x3FF)) -56613888;
 
10990                                    $startCharCode = $this->
_getULONG($font, $offset);
 
10992                                    $numChars = $this->
_getULONG($font, $offset);
 
10994                                    for (
$k = 0; 
$k < $numChars; ++
$k) {
 
10995                                         $c = (
$k + $startCharCode);
 
11004                                    $nGroups = $this->
_getULONG($font, $offset);
 
11006                                    for (
$k = 0; 
$k < $nGroups; ++
$k) {
 
11007                                         $startCharCode = $this->
_getULONG($font, $offset);
 
11009                                         $endCharCode = $this->
_getULONG($font, $offset);
 
11011                                         $startGlyphCode = $this->
_getULONG($font, $offset);
 
11013                                         for ($c = $startCharCode; $c <= $endCharCode; ++$c) {
 
11014                                              $ctg[$c] = $startGlyphCode;
 
11031                if (!isset($ctg[0])) {
 
11035                $offset = ($table[
'glyf'][
'offset'] + $indexToLoc[$ctg[120]] + 4);
 
11036                $yMin = $this->
_getFWORD($font, $offset);
 
11038                $yMax = $this->
_getFWORD($font, $offset);
 
11040                $fmetric[
'XHeight'] = round(($yMax - $yMin) * $urk);
 
11042                $offset = ($table[
'glyf'][
'offset'] + $indexToLoc[$ctg[72]] + 4);
 
11043                $yMin = $this->
_getFWORD($font, $offset);
 
11045                $yMax = $this->
_getFWORD($font, $offset);
 
11047                $fmetric[
'CapHeight'] = round(($yMax - $yMin) * $urk);
 
11050                $offset = $table[
'hmtx'][
'offset'];
 
11051                for (
$i = 0 ; 
$i < $numberOfHMetrics; ++
$i) {
 
11052                     $cw[
$i] = round($this->
_getUFWORD($font, $offset) * $urk);
 
11055                if ($numberOfHMetrics < $numGlyphs) {
 
11057                     $cw = array_pad($cw, $numGlyphs, $cw[($numberOfHMetrics - 1)]);
 
11059                $fmetric[
'MissingWidth'] = $cw[0];
 
11060                $fmetric[
'cw'] = 
'';
 
11061                for ($cid = 0; $cid <= 65535; ++$cid) {
 
11062                     if (isset($ctg[$cid])) {
 
11063                          if (isset($cw[$ctg[$cid]])) {
 
11064                               $fmetric[
'cw'] .= 
','.$cid.
'=>'.$cw[$ctg[$cid]];
 
11066                          if ($addcbbox AND isset($indexToLoc[$ctg[$cid]])) {
 
11067                               $offset = ($table[
'glyf'][
'offset'] + $indexToLoc[$ctg[$cid]]);
 
11068                               $xMin = round($this->
_getFWORD($font, $offset + 2)) * $urk;
 
11069                               $yMin = round($this->
_getFWORD($font, $offset + 4)) * $urk;
 
11070                               $xMax = round($this->
_getFWORD($font, $offset + 6)) * $urk;
 
11071                               $yMax = round($this->
_getFWORD($font, $offset + 8)) * $urk;
 
11072                               $fmetric[
'cbbox'] .= 
','.$cid.
'=>array('.$xMin.
','.$yMin.
','.$xMax.
','.$yMax.
')';
 
11077           if (($fmetric[
'type'] == 
'TrueTypeUnicode') AND (count($ctg) == 256)) {
 
11078                $fmetric[
'type'] == 
'TrueType';
 
11081           $pfile = 
'<'.
'?'.
'php'.
"\n";
 
11082           $pfile .= 
'// TCPDF FONT FILE DESCRIPTION'.
"\n";
 
11083           $pfile .= 
'$type=\''.$fmetric[
'type'].
'\';
'."\n"; 
11084           $pfile .= '$name=\
''.$fmetric[
'name'].
'\';
'."\n"; 
11085           $pfile .= '$up=
'.$fmetric['underlinePosition
'].';
'."\n"; 
11086           $pfile .= '$ut=
'.$fmetric['underlineThickness
'].';
'."\n"; 
11087           if ($fmetric['MissingWidth
'] > 0) { 
11088                $pfile .= '$dw=
'.$fmetric['MissingWidth
'].';
'."\n"; 
11090                $pfile .= '$dw=
'.$fmetric['AvgWidth
'].';
'."\n"; 
11092           $pfile .= '$diff=\
''.$fmetric[
'diff'].
'\';
'."\n"; 
11093           if ($fmetric['type
'] == 'Type1
') { 
11095                $pfile .= '$enc=\
''.$fmetric[
'enc'].
'\';
'."\n"; 
11096                $pfile .= '$file=\
''.$fmetric[
'file'].
'\';
'."\n"; 
11097                $pfile .= '$size1=
'.$fmetric['size1
'].';
'."\n"; 
11098                $pfile .= '$size2=
'.$fmetric['size2
'].';
'."\n"; 
11100                $pfile .= '$originalsize=
'.$fmetric['originalsize
'].';
'."\n"; 
11101                if ($fmetric['type
'] == 'cidfont0
') { 
11103                     switch ($fonttype) { 
11106                               $pfile .= 
'$enc=\'UniJIS-UTF16-H\';'.
"\n";
 
11107                               $pfile .= 
'$cidinfo=array(\'Registry\'=>\'Adobe\', \'Ordering\'=>\'Japan1\',\'Supplement\'=>5);'.
"\n";
 
11108                               $pfile .= 
'include(dirname(__FILE__).\'/uni2cid_aj16.php\');'.
"\n";
 
11112                               $pfile .= 
'// Korean'.
"\n";
 
11113                               $pfile .= 
'$enc=\'UniKS-UTF16-H\';'.
"\n";
 
11114                               $pfile .= 
'$cidinfo=array(\'Registry\'=>\'Adobe\', \'Ordering\'=>\'Korea1\',\'Supplement\'=>0);'.
"\n";
 
11115                               $pfile .= 
'include(dirname(__FILE__).\'/uni2cid_ak12.php\');'.
"\n";
 
11119                               $pfile .= 
'// Chinese Simplified'.
"\n";
 
11120                               $pfile .= 
'$enc=\'UniGB-UTF16-H\';'.
"\n";
 
11121                               $pfile .= 
'$cidinfo=array(\'Registry\'=>\'Adobe\', \'Ordering\'=>\'GB1\',\'Supplement\'=>2);'.
"\n";
 
11122                               $pfile .= 
'include(dirname(__FILE__).\'/uni2cid_ag15.php\');'.
"\n";
 
11127                               $pfile .= 
'// Chinese Traditional'.
"\n";
 
11128                               $pfile .= 
'$enc=\'UniCNS-UTF16-H\';'.
"\n";
 
11129                               $pfile .= 
'$cidinfo=array(\'Registry\'=>\'Adobe\', \'Ordering\'=>\'CNS1\',\'Supplement\'=>0);'.
"\n";
 
11130                               $pfile .= 
'include(dirname(__FILE__).\'/uni2cid_aj16.php\');'.
"\n";
 
11136                     $pfile .= 
'$enc=\''.$fmetric[
'enc'].
'\';
'."\n"; 
11137                     $pfile .= '$file=\
''.$fmetric[
'file'].
'\';
'."\n"; 
11138                     $pfile .= '$ctg=\
''.$fmetric[
'ctg'].
'\';
'."\n"; 
11139                     // create CIDToGIDMap 
11140                     $cidtogidmap = str_pad('', 131072, "\x00"); // (256 * 256 * 2) = 131072 
11141                     foreach ($ctg as $cid => $gid) { 
11142                          $cidtogidmap = $this->updateCIDtoGIDmap($cidtogidmap, $cid, $ctg[$cid]); 
11144                     // store compressed CIDToGIDMap 
11145                     $fp = fopen($outpath.$fmetric['ctg
'], 'wb
'); 
11146                     fwrite($fp, gzcompress($cidtogidmap)); 
11150           $pfile .= '$desc=array(
'; 
11151           $pfile .= '\
'Flags\'=>'.$fmetric[
'Flags'].
',';
 
11152           $pfile .= 
'\'FontBBox\
'=>\'['.$fmetric[
'bbox'].
']\',';
 
11153           $pfile .= 
'\'ItalicAngle\
'=>'.$fmetric[
'italicAngle'].
',';
 
11154           $pfile .= 
'\'Ascent\
'=>'.$fmetric[
'Ascent'].
',';
 
11155           $pfile .= 
'\'Descent\
'=>'.$fmetric[
'Descent'].
',';
 
11156           $pfile .= 
'\'Leading\
'=>'.$fmetric[
'Leading'].
',';
 
11157           $pfile .= 
'\'CapHeight\
'=>'.$fmetric[
'CapHeight'].
',';
 
11158           $pfile .= 
'\'XHeight\
'=>'.$fmetric[
'XHeight'].
',';
 
11159           $pfile .= 
'\'StemV\
'=>'.$fmetric[
'StemV'].
',';
 
11160           $pfile .= 
'\'StemH\
'=>'.$fmetric[
'StemH'].
',';
 
11161           $pfile .= 
'\'AvgWidth\
'=>'.$fmetric[
'AvgWidth'].
',';
 
11162           $pfile .= 
'\'MaxWidth\
'=>'.$fmetric[
'MaxWidth'].
',';
 
11163           $pfile .= 
'\'MissingWidth\
'=>'.$fmetric[
'MissingWidth'].
'';
 
11164           $pfile .= 
');'.
"\n";
 
11165           if (isset($fmetric[
'cbbox'])) {
 
11166                $pfile .= 
'$cbbox=array('.substr($fmetric[
'cbbox'], 1).
');'.
"\n";
 
11168           $pfile .= 
'$cw=array('.substr($fmetric[
'cw'], 1).
');'.
"\n";
 
11169           $pfile .= 
'// --- EOF ---'.
"\n";
 
11171           $fp = fopen($outpath.$font_name.
'.php', 
'w');
 
11172           fwrite(
$fp, $pfile);
 
11188           ksort($subsetchars);
 
11190           if ($this->_getULONG($font, $offset) != 0x10000) {
 
11196           $numTables = $this->_getUSHORT($font, $offset);
 
11203           for (
$i = 0; 
$i < $numTables; ++
$i) {
 
11205                $tag = substr($font, $offset, 4);
 
11207                $table[$tag] = array();
 
11208                $table[$tag][
'checkSum'] = $this->_getULONG($font, $offset);
 
11210                $table[$tag][
'offset'] = $this->_getULONG($font, $offset);
 
11212                $table[$tag][
'length'] = $this->_getULONG($font, $offset);
 
11216           $offset = $table[
'head'][
'offset'] + 12;
 
11217           if ($this->_getULONG($font, $offset) != 0x5F0F3CF5) {
 
11223           $offset = $table[
'head'][
'offset'] + 50;
 
11224           $short_offset = ($this->_getSHORT($font, $offset) == 0);
 
11227           $indexToLoc = array();
 
11228           $offset = $table[
'loca'][
'offset'];
 
11229           if ($short_offset) {
 
11231                $tot_num_glyphs = ($table[
'loca'][
'length'] / 2); 
 
11232                for (
$i = 0; 
$i < $tot_num_glyphs; ++
$i) {
 
11233                     $indexToLoc[
$i] = $this->_getUSHORT($font, $offset) * 2;
 
11238                $tot_num_glyphs = ($table[
'loca'][
'length'] / 4); 
 
11239                for (
$i = 0; 
$i < $tot_num_glyphs; ++
$i) {
 
11240                     $indexToLoc[
$i] = $this->_getULONG($font, $offset);
 
11245           $subsetglyphs = array(); 
 
11246           $subsetglyphs[0] = 
true; 
 
11247           $offset = $table[
'cmap'][
'offset'] + 2;
 
11248           $numEncodingTables = $this->_getUSHORT($font, $offset);
 
11250           $encodingTables = array();
 
11251           for (
$i = 0; 
$i < $numEncodingTables; ++
$i) {
 
11252                $encodingTables[
$i][
'platformID'] = $this->_getUSHORT($font, $offset);
 
11254                $encodingTables[
$i][
'encodingID'] = $this->_getUSHORT($font, $offset);
 
11256                $encodingTables[
$i][
'offset'] = $this->_getULONG($font, $offset);
 
11259           foreach ($encodingTables as $enctable) {
 
11261                $offset = $table[
'cmap'][
'offset'] + $enctable[
'offset'];
 
11262                $format = $this->_getUSHORT($font, $offset);
 
11267                          for ($c = 0; $c < 256; ++$c) {
 
11268                               if (isset($subsetchars[$c])) {
 
11269                                    $g = $this->_getBYTE($font, $offset);
 
11270                                    $subsetglyphs[$g] = 
true;
 
11278                          $numSubHeaders = 0;
 
11279                          for (
$i = 0; 
$i < 256; ++
$i) {
 
11281                               $subHeaderKeys[
$i] = ($this->_getUSHORT($font, $offset) / 8);
 
11283                               if ($numSubHeaders < $subHeaderKeys[
$i]) {
 
11284                                    $numSubHeaders = $subHeaderKeys[
$i];
 
11290                          $subHeaders = array();
 
11291                          $numGlyphIndexArray = 0;
 
11292                          for ($k = 0; $k < $numSubHeaders; ++$k) {
 
11293                               $subHeaders[$k][
'firstCode'] = $this->_getUSHORT($font, $offset);
 
11295                               $subHeaders[$k][
'entryCount'] = $this->_getUSHORT($font, $offset);
 
11297                               $subHeaders[$k][
'idDelta'] = $this->_getUSHORT($font, $offset);
 
11299                               $subHeaders[$k][
'idRangeOffset'] = $this->_getUSHORT($font, $offset);
 
11301                               $subHeaders[$k][
'idRangeOffset'] -= (2 + (($numSubHeaders - $k - 1) * 8));
 
11302                               $subHeaders[$k][
'idRangeOffset'] /= 2;
 
11303                               $numGlyphIndexArray += $subHeaders[$k][
'entryCount'];
 
11305                          for ($k = 0; $k < $numGlyphIndexArray; ++$k) {
 
11306                               $glyphIndexArray[$k] = $this->_getUSHORT($font, $offset);
 
11309                          for (
$i = 0; 
$i < 256; ++
$i) {
 
11310                               $k = $subHeaderKeys[
$i];
 
11314                                    if (isset($subsetchars[$c])) {
 
11315                                         $g = $glyphIndexArray[0];
 
11316                                         $subsetglyphs[$g] = 
true;
 
11320                                    $start_byte = $subHeaders[$k][
'firstCode'];
 
11321                                    $end_byte = $start_byte + $subHeaders[$k][
'entryCount'];
 
11322                                    for ($j = $start_byte; $j < $end_byte; ++$j) {
 
11324                                         $c = ((
$i << 8) + $j);
 
11325                                         if (isset($subsetchars[$c])) {
 
11326                                              $idRangeOffset = ($subHeaders[$k][
'idRangeOffset'] + $j - $subHeaders[$k][
'firstCode']);
 
11327                                              $g = ($glyphIndexArray[$idRangeOffset] + $idDelta[$k]) % 65536;
 
11331                                              $subsetglyphs[$g] = 
true;
 
11339                          $length = $this->_getUSHORT($font, $offset);
 
11342                          $segCount = ($this->_getUSHORT($font, $offset) / 2);
 
11345                          $endCount = array(); 
 
11346                          for ($k = 0; $k < $segCount; ++$k) {
 
11347                               $endCount[$k] = $this->_getUSHORT($font, $offset);
 
11351                          $startCount = array(); 
 
11352                          for ($k = 0; $k < $segCount; ++$k) {
 
11353                               $startCount[$k] = $this->_getUSHORT($font, $offset);
 
11356                          $idDelta = array(); 
 
11357                          for ($k = 0; $k < $segCount; ++$k) {
 
11358                               $idDelta[$k] = $this->_getUSHORT($font, $offset);
 
11361                          $idRangeOffset = array(); 
 
11362                          for ($k = 0; $k < $segCount; ++$k) {
 
11363                               $idRangeOffset[$k] = $this->_getUSHORT($font, $offset);
 
11366                          $gidlen = ($length / 2) - 8 - (4 * $segCount);
 
11367                          $glyphIdArray = array(); 
 
11368                          for ($k = 0; $k < $gidlen; ++$k) {
 
11369                               $glyphIdArray[$k] = $this->_getUSHORT($font, $offset);
 
11372                          for ($k = 0; $k < $segCount; ++$k) {
 
11373                               for ($c = $startCount[$k]; $c <= $endCount[$k]; ++$c) {
 
11374                                    if (isset($subsetchars[$c])) {
 
11375                                         if ($idRangeOffset[$k] == 0) {
 
11376                                              $g = ($idDelta[$k] + $c) % 65536;
 
11378                                              $gid = (($idRangeOffset[$k] / 2) + ($c - $startCount[$k]) - ($segCount - $k));
 
11379                                              $g = ($glyphIdArray[$gid] + $idDelta[$k]) % 65536;
 
11384                                         $subsetglyphs[$g] = 
true;
 
11392                          $firstCode = $this->_getUSHORT($font, $offset);
 
11394                          $entryCount = $this->_getUSHORT($font, $offset);
 
11396                          for ($k = 0; $k < $entryCount; ++$k) {
 
11397                               $c = ($k + $firstCode);
 
11398                               if (isset($subsetchars[$c])) {
 
11399                                    $g = $this->_getUSHORT($font, $offset);
 
11400                                    $subsetglyphs[$g] = 
true;
 
11408                          for ($k = 0; $k < 8192; ++$k) {
 
11409                               $is32[$k] = $this->_getBYTE($font, $offset);
 
11412                          $nGroups = $this->_getULONG($font, $offset);
 
11414                          for (
$i = 0; 
$i < $nGroups; ++
$i) {
 
11415                               $startCharCode = $this->_getULONG($font, $offset);
 
11417                               $endCharCode = $this->_getULONG($font, $offset);
 
11419                               $startGlyphID = $this->_getULONG($font, $offset);
 
11421                               for ($k = $startCharCode; $k <= $endCharCode; ++$k) {
 
11422                                    $is32idx = floor($c / 8);
 
11423                                    if ((isset($is32[$is32idx])) AND (($is32[$is32idx] & (1 << (7 - ($c % 8)))) == 0)) {
 
11430                                         $c = ((55232 + ($k >> 10)) << 10) + (0xDC00 + ($k & 0x3FF)) -56613888;
 
11432                                    if (isset($subsetchars[$c])) {
 
11433                                         $subsetglyphs[$startGlyphID] = 
true;
 
11442                          $startCharCode = $this->_getULONG($font, $offset);
 
11444                          $numChars = $this->_getULONG($font, $offset);
 
11446                          for ($k = 0; $k < $numChars; ++$k) {
 
11447                               $c = ($k + $startCharCode);
 
11448                               if (isset($subsetchars[$c])) {
 
11449                                    $g = $this->_getUSHORT($font, $offset);
 
11450                                    $subsetglyphs[$g] = 
true;
 
11458                          $nGroups = $this->_getULONG($font, $offset);
 
11460                          for ($k = 0; $k < $nGroups; ++$k) {
 
11461                               $startCharCode = $this->_getULONG($font, $offset);
 
11463                               $endCharCode = $this->_getULONG($font, $offset);
 
11465                               $startGlyphCode = $this->_getULONG($font, $offset);
 
11467                               for ($c = $startCharCode; $c <= $endCharCode; ++$c) {
 
11468                                    if (isset($subsetchars[$c])) {
 
11469                                         $subsetglyphs[$startGlyphCode] = 
true;
 
11487           $new_sga = $subsetglyphs;
 
11488           while (!empty($new_sga)) {
 
11490                $new_sga = array();
 
11491                foreach ($sga as $key => $val) {
 
11492                     if (isset($indexToLoc[$key])) {
 
11493                          $offset = ($table[
'glyf'][
'offset'] + $indexToLoc[$key]);
 
11494                          $numberOfContours = $this->_getSHORT($font, $offset);
 
11496                          if ($numberOfContours < 0) { 
 
11499                                    $flags = $this->_getUSHORT($font, $offset);
 
11501                                    $glyphIndex = $this->_getUSHORT($font, $offset);
 
11503                                    if (!isset($subsetglyphs[$glyphIndex])) {
 
11505                                         $new_sga[$glyphIndex] = 
true;
 
11515                                    } 
elseif ($flags & 64) {
 
11517                                    } 
elseif ($flags & 128) {
 
11520                               } 
while ($flags & 32);
 
11524                $subsetglyphs += $new_sga;
 
11527           ksort($subsetglyphs);
 
11532           $glyf_offset = $table[
'glyf'][
'offset'];
 
11533           for (
$i = 0; 
$i < $tot_num_glyphs; ++
$i) {
 
11534                if (isset($subsetglyphs[
$i])) {
 
11535                     $length = ($indexToLoc[($i + 1)] - $indexToLoc[$i]);
 
11536                     $glyf .= substr($font, ($glyf_offset + $indexToLoc[$i]), $length);
 
11540                if ($short_offset) {
 
11541                     $loca .= pack(
'n', ($offset / 2));
 
11543                     $loca .= pack(
'N', $offset);
 
11545                $offset += $length;
 
11549           $table_names = array (
'head', 
'hhea', 
'hmtx', 
'maxp', 
'cvt ', 
'fpgm', 
'prep'); 
 
11552           foreach ($table as $tag => $val) {
 
11553                if (in_array($tag, $table_names)) {
 
11554                     $table[$tag][
'data'] = substr($font, $table[$tag][
'offset'], $table[$tag][
'length']);
 
11555                     if ($tag == 
'head') {
 
11557                          $table[$tag][
'data'] = substr($table[$tag][
'data'], 0, 8).
"\x0\x0\x0\x0".substr($table[$tag][
'data'], 12);
 
11559                     $pad = 4 - ($table[$tag][
'length'] % 4);
 
11562                          $table[$tag][
'length'] += $pad;
 
11563                          $table[$tag][
'data'] .= str_repeat(
"\x0", $pad);
 
11565                     $table[$tag][
'offset'] = $offset;
 
11566                     $offset += $table[$tag][
'length'];
 
11570                     unset($table[$tag]);
 
11574           $table[
'loca'][
'data'] = $loca;
 
11575           $table[
'loca'][
'length'] = strlen($loca);
 
11576           $pad = 4 - ($table[
'loca'][
'length'] % 4);
 
11579                $table[
'loca'][
'length'] += $pad;
 
11580                $table[
'loca'][
'data'] .= str_repeat(
"\x0", $pad);
 
11582           $table[
'loca'][
'offset'] = $offset;
 
11583           $table[
'loca'][
'checkSum'] = $this->_getTTFtableChecksum($table[
'loca'][
'data'], $table[
'loca'][
'length']);
 
11584           $offset += $table[
'loca'][
'length'];
 
11586           $table[
'glyf'][
'data'] = $glyf;
 
11587           $table[
'glyf'][
'length'] = strlen($glyf);
 
11588           $pad = 4 - ($table[
'glyf'][
'length'] % 4);
 
11591                $table[
'glyf'][
'length'] += $pad;
 
11592                $table[
'glyf'][
'data'] .= str_repeat(
"\x0", $pad);
 
11594           $table[
'glyf'][
'offset'] = $offset;
 
11595           $table[
'glyf'][
'checkSum'] = $this->_getTTFtableChecksum($table[
'glyf'][
'data'], $table[
'glyf'][
'length']);
 
11598           $font .= pack(
'N', 0x10000); 
 
11599           $numTables = count($table);
 
11600           $font .= pack(
'n', $numTables); 
 
11601           $entrySelector = floor(log($numTables, 2));
 
11602           $searchRange = pow(2, $entrySelector) * 16;
 
11603           $rangeShift = ($numTables * 16) - $searchRange;
 
11604           $font .= pack(
'n', $searchRange); 
 
11605           $font .= pack(
'n', $entrySelector); 
 
11606           $font .= pack(
'n', $rangeShift); 
 
11607           $offset = ($numTables * 16);
 
11608           foreach ($table as $tag => 
$data) {
 
11610                $font .= pack(
'N', 
$data[
'checkSum']); 
 
11611                $font .= pack(
'N', (
$data[
'offset'] + $offset)); 
 
11612                $font .= pack(
'N', 
$data[
'length']); 
 
11614           foreach ($table as 
$data) {
 
11615                $font .= $data[
'data'];
 
11618           $checkSumAdjustment = 0xB1B0AFBA - $this->_getTTFtableChecksum($font, strlen($font));
 
11619           $font = substr($font, 0, $table[
'head'][
'offset'] + 8).pack(
'N', $checkSumAdjustment).substr($font, $table[
'head'][
'offset'] + 12);
 
11634           $tlen = ($length / 4);
 
11636           for (
$i = 0; 
$i < $tlen; ++
$i) {
 
11637                $v = unpack(
'Ni', substr($table, $offset, 4));
 
11641           $sum = unpack(
'Ni', pack(
'N', $sum));
 
11655           ksort($font[
'cw']);
 
11662           foreach ($font[
'cw'] as $cid => $width) {
 
11663                $cid -= $cidoffset;
 
11664                if ($font[
'subset'] AND (!isset($font[
'subsetchars'][$cid]))) {
 
11668                if ($width != $font[
'dw']) {
 
11669                     if ($cid == ($prevcid + 1)) {
 
11671                          if ($width == $prevwidth) {
 
11672                               if ($width == $range[$rangeid][0]) {
 
11673                                    $range[$rangeid][] = $width;
 
11675                                    array_pop($range[$rangeid]);
 
11677                                    $rangeid = $prevcid;
 
11678                                    $range[$rangeid] = array();
 
11679                                    $range[$rangeid][] = $prevwidth;
 
11680                                    $range[$rangeid][] = $width;
 
11683                               $range[$rangeid][
'interval'] = 
true;
 
11688                                    $range[$rangeid] = array();
 
11689                                    $range[$rangeid][] = $width;
 
11691                                    $range[$rangeid][] = $width;
 
11698                          $range[$rangeid] = array();
 
11699                          $range[$rangeid][] = $width;
 
11703                     $prevwidth = $width;
 
11710           foreach ($range as $k => $ws) {
 
11712                if (($k == $nextk) AND (!$prevint) AND ((!isset($ws[
'interval'])) OR ($cws < 4))) {
 
11713                     if (isset($range[$k][
'interval'])) {
 
11714                          unset($range[$k][
'interval']);
 
11716                     $range[$prevk] = array_merge($range[$prevk], $range[$k]);
 
11721                $nextk = $k + $cws;
 
11722                if (isset($ws[
'interval'])) {
 
11728                     if (isset($range[$k][
'interval'])) {
 
11729                          unset($range[$k][
'interval']);
 
11738           foreach ($range as $k => $ws) {
 
11739                if (count(array_count_values($ws)) == 1) {
 
11741                     $w .= 
' '.$k.
' '.($k + count($ws) - 1).
' '.$ws[0];
 
11744                     $w .= 
' '.$k.
' [ '.implode(
' ', $ws).
' ]';
 
11747           return '/W ['.$w.
' ]';
 
11757           foreach ($this->diffs as $diff) {
 
11760                $this->_out(
'<< /Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.
'] >>'.
"\n".
'endobj');
 
11762           $mqr = $this->get_mqr();
 
11763           $this->set_mqr(
false);
 
11764           foreach ($this->FontFiles as $file => $info) {
 
11766                $fontdir = $info[
'fontdir'];
 
11767                $file = strtolower($file);
 
11770                if (($fontdir !== 
false) AND file_exists($fontdir.$file)) {
 
11771                     $fontfile = $fontdir.$file;
 
11772                } 
elseif (file_exists($this->_getfontpath().$file)) {
 
11773                     $fontfile = $this->_getfontpath().$file;
 
11774                } 
elseif (file_exists($file)) {
 
11777                if (!$this->empty_string($fontfile)) {
 
11778                     $font = file_get_contents($fontfile);
 
11779                     $compressed = (substr($file, -2) == 
'.z');
 
11780                     if ((!$compressed) AND (isset($info[
'length2']))) {
 
11781                          $header = (ord($font{0}) == 128);
 
11784                               $font = substr($font, 6);
 
11786                          if ($header AND (ord($font[$info[
'length1']]) == 128)) {
 
11788                               $font = substr($font, 0, $info[
'length1']).substr($font, ($info[
'length1'] + 6));
 
11790                     } 
elseif ($info[
'subset'] AND ((!$compressed) OR ($compressed AND function_exists(
'gzcompress')))) {
 
11793                               $font = gzuncompress($font);
 
11796                          $subsetchars = array(); 
 
11797                          foreach ($info[
'fontkeys'] as $fontkey) {
 
11798                               $fontinfo = $this->getFontBuffer($fontkey);
 
11799                               $subsetchars += $fontinfo[
'subsetchars'];
 
11802                          $font = $this->_getTrueTypeFontSubset($font, $subsetchars);
 
11804                          $info[
'length1'] = strlen($font);
 
11807                               $font = gzcompress($font);
 
11811                     $this->FontFiles[$file][
'n'] = $this->n;
 
11812                     $stream = $this->_getrawstream($font);
 
11813                     $out = 
'<< /Length '.strlen($stream);
 
11815                          $out .= 
' /Filter /FlateDecode';
 
11817                     $out .= 
' /Length1 '.$info[
'length1'];
 
11818                     if (isset($info[
'length2'])) {
 
11819                          $out .= 
' /Length2 '.$info[
'length2'].
' /Length3 0';
 
11822                     $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
11823                     $out .= 
"\n".
'endobj';
 
11827           $this->set_mqr($mqr);
 
11828           foreach ($this->fontkeys as $k) {
 
11830                $font = $this->getFontBuffer($k);
 
11831                $type = $font[
'type'];
 
11832                $name = $font[
'name'];
 
11833                if ($type == 
'core') {
 
11835                     $out = $this->_getobj($this->font_obj_ids[$k]).
"\n";
 
11836                     $out .= 
'<</Type /Font';
 
11837                     $out .= 
' /Subtype /Type1';
 
11838                     $out .= 
' /BaseFont /'.$name;
 
11839                     $out .= 
' /Name /F'.$font[
'i'];
 
11840                     if ((strtolower($name) != 
'symbol') AND (strtolower($name) != 
'zapfdingbats')) {
 
11841                          $out .= 
' /Encoding /WinAnsiEncoding';
 
11843                     if ($k == 
'helvetica') {
 
11845                          $this->annotation_fonts[$k] = $font[
'i'];
 
11848                     $out .= 
"\n".
'endobj';
 
11850                } 
elseif (($type == 
'Type1') OR ($type == 
'TrueType')) {
 
11852                     $out = $this->_getobj($this->font_obj_ids[$k]).
"\n";
 
11853                     $out .= 
'<</Type /Font';
 
11854                     $out .= 
' /Subtype /'.$type;
 
11855                     $out .= 
' /BaseFont /'.$name;
 
11856                     $out .= 
' /Name /F'.$font[
'i'];
 
11857                     $out .= 
' /FirstChar 32 /LastChar 255';
 
11858                     $out .= 
' /Widths '.($this->n + 1).
' 0 R';
 
11859                     $out .= 
' /FontDescriptor '.($this->n + 2).
' 0 R';
 
11860                     if ($font[
'enc']) {
 
11861                          if (isset($font[
'diff'])) {
 
11862                               $out .= 
' /Encoding '.($nf + $font[
'diff']).
' 0 R';
 
11864                               $out .= 
' /Encoding /WinAnsiEncoding';
 
11868                     $out .= 
"\n".
'endobj';
 
11873                     for (
$i = 32; 
$i < 256; ++
$i) {
 
11874                          if (isset($font[
'cw'][
$i])) {
 
11875                               $s .= $font[
'cw'][
$i].
' ';
 
11877                               $s .= $font[
'dw'].
' ';
 
11881                     $s .= 
"\n".
'endobj';
 
11885                     $s = 
'<</Type /FontDescriptor /FontName /'.$name;
 
11886                     foreach ($font[
'desc'] as $fdk => $fdv) {
 
11887                          if (is_float($fdv)) {
 
11888                               $fdv = sprintf(
'%F', $fdv);
 
11890                          $s .= 
' /'.$fdk.
' '.$fdv.
'';
 
11892                     if (!$this->empty_string($font[
'file'])) {
 
11893                          $s .= 
' /FontFile'.($type == 
'Type1' ? 
'' : 
'2').
' '.$this->FontFiles[$font[
'file']][
'n'].
' 0 R';
 
11896                     $s .= 
"\n".
'endobj';
 
11900                     $mtd = 
'_put'.strtolower($type);
 
11901                     if (!method_exists($this, $mtd)) {
 
11902                          $this->Error(
'Unsupported font type: '.$type);
 
11904                     $this->$mtd($font);
 
11919           if ($font[
'subset']) {
 
11921                $subtag = sprintf(
'%06u', $font[
'i']);
 
11922                $subtag = strtr($subtag, 
'0123456789', 
'ABCDEFGHIJ');
 
11923                $fontname .= $subtag.
'+';
 
11925           $fontname .= $font[
'name'];
 
11928           $out = $this->_getobj($this->font_obj_ids[$font[
'fontkey']]).
"\n";
 
11929           $out .= 
'<< /Type /Font';
 
11930           $out .= 
' /Subtype /Type0';
 
11931           $out .= 
' /BaseFont /'.$fontname;
 
11932           $out .= 
' /Name /F'.$font[
'i'];
 
11933           $out .= 
' /Encoding /'.$font[
'enc'];
 
11934           $out .= 
' /ToUnicode '.($this->n + 1).
' 0 R';
 
11935           $out .= 
' /DescendantFonts ['.($this->n + 2).
' 0 R]';
 
11937           $out .= 
"\n".
'endobj';
 
11940           $stream = 
"/CIDInit /ProcSet findresource begin\n";
 
11941           $stream .= 
"12 dict begin\n";
 
11942           $stream .= 
"begincmap\n";
 
11943           $stream .= 
"/CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def\n";
 
11944           $stream .= 
"/CMapName /Adobe-Identity-UCS def\n";
 
11945           $stream .= 
"/CMapType 2 def\n";
 
11946           $stream .= 
"/WMode 0 def\n";
 
11947           $stream .= 
"1 begincodespacerange\n";
 
11948           $stream .= 
"<0000> <FFFF>\n";
 
11949           $stream .= 
"endcodespacerange\n";
 
11950           $stream .= 
"100 beginbfrange\n";
 
11951           $stream .= 
"<0000> <00ff> <0000>\n";
 
11952           $stream .= 
"<0100> <01ff> <0100>\n";
 
11953           $stream .= 
"<0200> <02ff> <0200>\n";
 
11954           $stream .= 
"<0300> <03ff> <0300>\n";
 
11955           $stream .= 
"<0400> <04ff> <0400>\n";
 
11956           $stream .= 
"<0500> <05ff> <0500>\n";
 
11957           $stream .= 
"<0600> <06ff> <0600>\n";
 
11958           $stream .= 
"<0700> <07ff> <0700>\n";
 
11959           $stream .= 
"<0800> <08ff> <0800>\n";
 
11960           $stream .= 
"<0900> <09ff> <0900>\n";
 
11961           $stream .= 
"<0a00> <0aff> <0a00>\n";
 
11962           $stream .= 
"<0b00> <0bff> <0b00>\n";
 
11963           $stream .= 
"<0c00> <0cff> <0c00>\n";
 
11964           $stream .= 
"<0d00> <0dff> <0d00>\n";
 
11965           $stream .= 
"<0e00> <0eff> <0e00>\n";
 
11966           $stream .= 
"<0f00> <0fff> <0f00>\n";
 
11967           $stream .= 
"<1000> <10ff> <1000>\n";
 
11968           $stream .= 
"<1100> <11ff> <1100>\n";
 
11969           $stream .= 
"<1200> <12ff> <1200>\n";
 
11970           $stream .= 
"<1300> <13ff> <1300>\n";
 
11971           $stream .= 
"<1400> <14ff> <1400>\n";
 
11972           $stream .= 
"<1500> <15ff> <1500>\n";
 
11973           $stream .= 
"<1600> <16ff> <1600>\n";
 
11974           $stream .= 
"<1700> <17ff> <1700>\n";
 
11975           $stream .= 
"<1800> <18ff> <1800>\n";
 
11976           $stream .= 
"<1900> <19ff> <1900>\n";
 
11977           $stream .= 
"<1a00> <1aff> <1a00>\n";
 
11978           $stream .= 
"<1b00> <1bff> <1b00>\n";
 
11979           $stream .= 
"<1c00> <1cff> <1c00>\n";
 
11980           $stream .= 
"<1d00> <1dff> <1d00>\n";
 
11981           $stream .= 
"<1e00> <1eff> <1e00>\n";
 
11982           $stream .= 
"<1f00> <1fff> <1f00>\n";
 
11983           $stream .= 
"<2000> <20ff> <2000>\n";
 
11984           $stream .= 
"<2100> <21ff> <2100>\n";
 
11985           $stream .= 
"<2200> <22ff> <2200>\n";
 
11986           $stream .= 
"<2300> <23ff> <2300>\n";
 
11987           $stream .= 
"<2400> <24ff> <2400>\n";
 
11988           $stream .= 
"<2500> <25ff> <2500>\n";
 
11989           $stream .= 
"<2600> <26ff> <2600>\n";
 
11990           $stream .= 
"<2700> <27ff> <2700>\n";
 
11991           $stream .= 
"<2800> <28ff> <2800>\n";
 
11992           $stream .= 
"<2900> <29ff> <2900>\n";
 
11993           $stream .= 
"<2a00> <2aff> <2a00>\n";
 
11994           $stream .= 
"<2b00> <2bff> <2b00>\n";
 
11995           $stream .= 
"<2c00> <2cff> <2c00>\n";
 
11996           $stream .= 
"<2d00> <2dff> <2d00>\n";
 
11997           $stream .= 
"<2e00> <2eff> <2e00>\n";
 
11998           $stream .= 
"<2f00> <2fff> <2f00>\n";
 
11999           $stream .= 
"<3000> <30ff> <3000>\n";
 
12000           $stream .= 
"<3100> <31ff> <3100>\n";
 
12001           $stream .= 
"<3200> <32ff> <3200>\n";
 
12002           $stream .= 
"<3300> <33ff> <3300>\n";
 
12003           $stream .= 
"<3400> <34ff> <3400>\n";
 
12004           $stream .= 
"<3500> <35ff> <3500>\n";
 
12005           $stream .= 
"<3600> <36ff> <3600>\n";
 
12006           $stream .= 
"<3700> <37ff> <3700>\n";
 
12007           $stream .= 
"<3800> <38ff> <3800>\n";
 
12008           $stream .= 
"<3900> <39ff> <3900>\n";
 
12009           $stream .= 
"<3a00> <3aff> <3a00>\n";
 
12010           $stream .= 
"<3b00> <3bff> <3b00>\n";
 
12011           $stream .= 
"<3c00> <3cff> <3c00>\n";
 
12012           $stream .= 
"<3d00> <3dff> <3d00>\n";
 
12013           $stream .= 
"<3e00> <3eff> <3e00>\n";
 
12014           $stream .= 
"<3f00> <3fff> <3f00>\n";
 
12015           $stream .= 
"<4000> <40ff> <4000>\n";
 
12016           $stream .= 
"<4100> <41ff> <4100>\n";
 
12017           $stream .= 
"<4200> <42ff> <4200>\n";
 
12018           $stream .= 
"<4300> <43ff> <4300>\n";
 
12019           $stream .= 
"<4400> <44ff> <4400>\n";
 
12020           $stream .= 
"<4500> <45ff> <4500>\n";
 
12021           $stream .= 
"<4600> <46ff> <4600>\n";
 
12022           $stream .= 
"<4700> <47ff> <4700>\n";
 
12023           $stream .= 
"<4800> <48ff> <4800>\n";
 
12024           $stream .= 
"<4900> <49ff> <4900>\n";
 
12025           $stream .= 
"<4a00> <4aff> <4a00>\n";
 
12026           $stream .= 
"<4b00> <4bff> <4b00>\n";
 
12027           $stream .= 
"<4c00> <4cff> <4c00>\n";
 
12028           $stream .= 
"<4d00> <4dff> <4d00>\n";
 
12029           $stream .= 
"<4e00> <4eff> <4e00>\n";
 
12030           $stream .= 
"<4f00> <4fff> <4f00>\n";
 
12031           $stream .= 
"<5000> <50ff> <5000>\n";
 
12032           $stream .= 
"<5100> <51ff> <5100>\n";
 
12033           $stream .= 
"<5200> <52ff> <5200>\n";
 
12034           $stream .= 
"<5300> <53ff> <5300>\n";
 
12035           $stream .= 
"<5400> <54ff> <5400>\n";
 
12036           $stream .= 
"<5500> <55ff> <5500>\n";
 
12037           $stream .= 
"<5600> <56ff> <5600>\n";
 
12038           $stream .= 
"<5700> <57ff> <5700>\n";
 
12039           $stream .= 
"<5800> <58ff> <5800>\n";
 
12040           $stream .= 
"<5900> <59ff> <5900>\n";
 
12041           $stream .= 
"<5a00> <5aff> <5a00>\n";
 
12042           $stream .= 
"<5b00> <5bff> <5b00>\n";
 
12043           $stream .= 
"<5c00> <5cff> <5c00>\n";
 
12044           $stream .= 
"<5d00> <5dff> <5d00>\n";
 
12045           $stream .= 
"<5e00> <5eff> <5e00>\n";
 
12046           $stream .= 
"<5f00> <5fff> <5f00>\n";
 
12047           $stream .= 
"<6000> <60ff> <6000>\n";
 
12048           $stream .= 
"<6100> <61ff> <6100>\n";
 
12049           $stream .= 
"<6200> <62ff> <6200>\n";
 
12050           $stream .= 
"<6300> <63ff> <6300>\n";
 
12051           $stream .= 
"endbfrange\n";
 
12052           $stream .= 
"100 beginbfrange\n";
 
12053           $stream .= 
"<6400> <64ff> <6400>\n";
 
12054           $stream .= 
"<6500> <65ff> <6500>\n";
 
12055           $stream .= 
"<6600> <66ff> <6600>\n";
 
12056           $stream .= 
"<6700> <67ff> <6700>\n";
 
12057           $stream .= 
"<6800> <68ff> <6800>\n";
 
12058           $stream .= 
"<6900> <69ff> <6900>\n";
 
12059           $stream .= 
"<6a00> <6aff> <6a00>\n";
 
12060           $stream .= 
"<6b00> <6bff> <6b00>\n";
 
12061           $stream .= 
"<6c00> <6cff> <6c00>\n";
 
12062           $stream .= 
"<6d00> <6dff> <6d00>\n";
 
12063           $stream .= 
"<6e00> <6eff> <6e00>\n";
 
12064           $stream .= 
"<6f00> <6fff> <6f00>\n";
 
12065           $stream .= 
"<7000> <70ff> <7000>\n";
 
12066           $stream .= 
"<7100> <71ff> <7100>\n";
 
12067           $stream .= 
"<7200> <72ff> <7200>\n";
 
12068           $stream .= 
"<7300> <73ff> <7300>\n";
 
12069           $stream .= 
"<7400> <74ff> <7400>\n";
 
12070           $stream .= 
"<7500> <75ff> <7500>\n";
 
12071           $stream .= 
"<7600> <76ff> <7600>\n";
 
12072           $stream .= 
"<7700> <77ff> <7700>\n";
 
12073           $stream .= 
"<7800> <78ff> <7800>\n";
 
12074           $stream .= 
"<7900> <79ff> <7900>\n";
 
12075           $stream .= 
"<7a00> <7aff> <7a00>\n";
 
12076           $stream .= 
"<7b00> <7bff> <7b00>\n";
 
12077           $stream .= 
"<7c00> <7cff> <7c00>\n";
 
12078           $stream .= 
"<7d00> <7dff> <7d00>\n";
 
12079           $stream .= 
"<7e00> <7eff> <7e00>\n";
 
12080           $stream .= 
"<7f00> <7fff> <7f00>\n";
 
12081           $stream .= 
"<8000> <80ff> <8000>\n";
 
12082           $stream .= 
"<8100> <81ff> <8100>\n";
 
12083           $stream .= 
"<8200> <82ff> <8200>\n";
 
12084           $stream .= 
"<8300> <83ff> <8300>\n";
 
12085           $stream .= 
"<8400> <84ff> <8400>\n";
 
12086           $stream .= 
"<8500> <85ff> <8500>\n";
 
12087           $stream .= 
"<8600> <86ff> <8600>\n";
 
12088           $stream .= 
"<8700> <87ff> <8700>\n";
 
12089           $stream .= 
"<8800> <88ff> <8800>\n";
 
12090           $stream .= 
"<8900> <89ff> <8900>\n";
 
12091           $stream .= 
"<8a00> <8aff> <8a00>\n";
 
12092           $stream .= 
"<8b00> <8bff> <8b00>\n";
 
12093           $stream .= 
"<8c00> <8cff> <8c00>\n";
 
12094           $stream .= 
"<8d00> <8dff> <8d00>\n";
 
12095           $stream .= 
"<8e00> <8eff> <8e00>\n";
 
12096           $stream .= 
"<8f00> <8fff> <8f00>\n";
 
12097           $stream .= 
"<9000> <90ff> <9000>\n";
 
12098           $stream .= 
"<9100> <91ff> <9100>\n";
 
12099           $stream .= 
"<9200> <92ff> <9200>\n";
 
12100           $stream .= 
"<9300> <93ff> <9300>\n";
 
12101           $stream .= 
"<9400> <94ff> <9400>\n";
 
12102           $stream .= 
"<9500> <95ff> <9500>\n";
 
12103           $stream .= 
"<9600> <96ff> <9600>\n";
 
12104           $stream .= 
"<9700> <97ff> <9700>\n";
 
12105           $stream .= 
"<9800> <98ff> <9800>\n";
 
12106           $stream .= 
"<9900> <99ff> <9900>\n";
 
12107           $stream .= 
"<9a00> <9aff> <9a00>\n";
 
12108           $stream .= 
"<9b00> <9bff> <9b00>\n";
 
12109           $stream .= 
"<9c00> <9cff> <9c00>\n";
 
12110           $stream .= 
"<9d00> <9dff> <9d00>\n";
 
12111           $stream .= 
"<9e00> <9eff> <9e00>\n";
 
12112           $stream .= 
"<9f00> <9fff> <9f00>\n";
 
12113           $stream .= 
"<a000> <a0ff> <a000>\n";
 
12114           $stream .= 
"<a100> <a1ff> <a100>\n";
 
12115           $stream .= 
"<a200> <a2ff> <a200>\n";
 
12116           $stream .= 
"<a300> <a3ff> <a300>\n";
 
12117           $stream .= 
"<a400> <a4ff> <a400>\n";
 
12118           $stream .= 
"<a500> <a5ff> <a500>\n";
 
12119           $stream .= 
"<a600> <a6ff> <a600>\n";
 
12120           $stream .= 
"<a700> <a7ff> <a700>\n";
 
12121           $stream .= 
"<a800> <a8ff> <a800>\n";
 
12122           $stream .= 
"<a900> <a9ff> <a900>\n";
 
12123           $stream .= 
"<aa00> <aaff> <aa00>\n";
 
12124           $stream .= 
"<ab00> <abff> <ab00>\n";
 
12125           $stream .= 
"<ac00> <acff> <ac00>\n";
 
12126           $stream .= 
"<ad00> <adff> <ad00>\n";
 
12127           $stream .= 
"<ae00> <aeff> <ae00>\n";
 
12128           $stream .= 
"<af00> <afff> <af00>\n";
 
12129           $stream .= 
"<b000> <b0ff> <b000>\n";
 
12130           $stream .= 
"<b100> <b1ff> <b100>\n";
 
12131           $stream .= 
"<b200> <b2ff> <b200>\n";
 
12132           $stream .= 
"<b300> <b3ff> <b300>\n";
 
12133           $stream .= 
"<b400> <b4ff> <b400>\n";
 
12134           $stream .= 
"<b500> <b5ff> <b500>\n";
 
12135           $stream .= 
"<b600> <b6ff> <b600>\n";
 
12136           $stream .= 
"<b700> <b7ff> <b700>\n";
 
12137           $stream .= 
"<b800> <b8ff> <b800>\n";
 
12138           $stream .= 
"<b900> <b9ff> <b900>\n";
 
12139           $stream .= 
"<ba00> <baff> <ba00>\n";
 
12140           $stream .= 
"<bb00> <bbff> <bb00>\n";
 
12141           $stream .= 
"<bc00> <bcff> <bc00>\n";
 
12142           $stream .= 
"<bd00> <bdff> <bd00>\n";
 
12143           $stream .= 
"<be00> <beff> <be00>\n";
 
12144           $stream .= 
"<bf00> <bfff> <bf00>\n";
 
12145           $stream .= 
"<c000> <c0ff> <c000>\n";
 
12146           $stream .= 
"<c100> <c1ff> <c100>\n";
 
12147           $stream .= 
"<c200> <c2ff> <c200>\n";
 
12148           $stream .= 
"<c300> <c3ff> <c300>\n";
 
12149           $stream .= 
"<c400> <c4ff> <c400>\n";
 
12150           $stream .= 
"<c500> <c5ff> <c500>\n";
 
12151           $stream .= 
"<c600> <c6ff> <c600>\n";
 
12152           $stream .= 
"<c700> <c7ff> <c700>\n";
 
12153           $stream .= 
"endbfrange\n";
 
12154           $stream .= 
"56 beginbfrange\n";
 
12155           $stream .= 
"<c800> <c8ff> <c800>\n";
 
12156           $stream .= 
"<c900> <c9ff> <c900>\n";
 
12157           $stream .= 
"<ca00> <caff> <ca00>\n";
 
12158           $stream .= 
"<cb00> <cbff> <cb00>\n";
 
12159           $stream .= 
"<cc00> <ccff> <cc00>\n";
 
12160           $stream .= 
"<cd00> <cdff> <cd00>\n";
 
12161           $stream .= 
"<ce00> <ceff> <ce00>\n";
 
12162           $stream .= 
"<cf00> <cfff> <cf00>\n";
 
12163           $stream .= 
"<d000> <d0ff> <d000>\n";
 
12164           $stream .= 
"<d100> <d1ff> <d100>\n";
 
12165           $stream .= 
"<d200> <d2ff> <d200>\n";
 
12166           $stream .= 
"<d300> <d3ff> <d300>\n";
 
12167           $stream .= 
"<d400> <d4ff> <d400>\n";
 
12168           $stream .= 
"<d500> <d5ff> <d500>\n";
 
12169           $stream .= 
"<d600> <d6ff> <d600>\n";
 
12170           $stream .= 
"<d700> <d7ff> <d700>\n";
 
12171           $stream .= 
"<d800> <d8ff> <d800>\n";
 
12172           $stream .= 
"<d900> <d9ff> <d900>\n";
 
12173           $stream .= 
"<da00> <daff> <da00>\n";
 
12174           $stream .= 
"<db00> <dbff> <db00>\n";
 
12175           $stream .= 
"<dc00> <dcff> <dc00>\n";
 
12176           $stream .= 
"<dd00> <ddff> <dd00>\n";
 
12177           $stream .= 
"<de00> <deff> <de00>\n";
 
12178           $stream .= 
"<df00> <dfff> <df00>\n";
 
12179           $stream .= 
"<e000> <e0ff> <e000>\n";
 
12180           $stream .= 
"<e100> <e1ff> <e100>\n";
 
12181           $stream .= 
"<e200> <e2ff> <e200>\n";
 
12182           $stream .= 
"<e300> <e3ff> <e300>\n";
 
12183           $stream .= 
"<e400> <e4ff> <e400>\n";
 
12184           $stream .= 
"<e500> <e5ff> <e500>\n";
 
12185           $stream .= 
"<e600> <e6ff> <e600>\n";
 
12186           $stream .= 
"<e700> <e7ff> <e700>\n";
 
12187           $stream .= 
"<e800> <e8ff> <e800>\n";
 
12188           $stream .= 
"<e900> <e9ff> <e900>\n";
 
12189           $stream .= 
"<ea00> <eaff> <ea00>\n";
 
12190           $stream .= 
"<eb00> <ebff> <eb00>\n";
 
12191           $stream .= 
"<ec00> <ecff> <ec00>\n";
 
12192           $stream .= 
"<ed00> <edff> <ed00>\n";
 
12193           $stream .= 
"<ee00> <eeff> <ee00>\n";
 
12194           $stream .= 
"<ef00> <efff> <ef00>\n";
 
12195           $stream .= 
"<f000> <f0ff> <f000>\n";
 
12196           $stream .= 
"<f100> <f1ff> <f100>\n";
 
12197           $stream .= 
"<f200> <f2ff> <f200>\n";
 
12198           $stream .= 
"<f300> <f3ff> <f300>\n";
 
12199           $stream .= 
"<f400> <f4ff> <f400>\n";
 
12200           $stream .= 
"<f500> <f5ff> <f500>\n";
 
12201           $stream .= 
"<f600> <f6ff> <f600>\n";
 
12202           $stream .= 
"<f700> <f7ff> <f700>\n";
 
12203           $stream .= 
"<f800> <f8ff> <f800>\n";
 
12204           $stream .= 
"<f900> <f9ff> <f900>\n";
 
12205           $stream .= 
"<fa00> <faff> <fa00>\n";
 
12206           $stream .= 
"<fb00> <fbff> <fb00>\n";
 
12207           $stream .= 
"<fc00> <fcff> <fc00>\n";
 
12208           $stream .= 
"<fd00> <fdff> <fd00>\n";
 
12209           $stream .= 
"<fe00> <feff> <fe00>\n";
 
12210           $stream .= 
"<ff00> <ffff> <ff00>\n";
 
12211           $stream .= 
"endbfrange\n";
 
12212           $stream .= 
"endcmap\n";
 
12213           $stream .= 
"CMapName currentdict /CMap defineresource pop\n";
 
12214           $stream .= 
"end\n";
 
12218           $stream = ($this->compress) ? gzcompress($stream) : $stream;
 
12219           $filter = ($this->compress) ? 
'/Filter /FlateDecode ' : 
'';
 
12220           $stream = $this->_getrawstream($stream);
 
12221           $this->_out(
'<<'.$filter.
'/Length '.strlen($stream).
'>> stream'.
"\n".$stream.
"\n".
'endstream'.
"\n".
'endobj');
 
12224           $oid = $this->_newobj();
 
12225           $out = 
'<< /Type /Font';
 
12226           $out .= 
' /Subtype /CIDFontType2';
 
12227           $out .= 
' /BaseFont /'.$fontname;
 
12229           $cidinfo = 
'/Registry '.$this->_datastring($font[
'cidinfo'][
'Registry'], $oid);
 
12230           $cidinfo .= 
' /Ordering '.$this->_datastring($font[
'cidinfo'][
'Ordering'], $oid);
 
12231           $cidinfo .= 
' /Supplement '.$font[
'cidinfo'][
'Supplement'];
 
12232           $out .= 
' /CIDSystemInfo << '.$cidinfo.
' >>';
 
12233           $out .= 
' /FontDescriptor '.($this->n + 1).
' 0 R';
 
12234           $out .= 
' /DW '.$font[
'dw']; 
 
12235           $out .= 
"\n".$this->_putfontwidths($font, 0);
 
12236           if (isset($font[
'ctg']) AND (!$this->empty_string($font[
'ctg']))) {
 
12237                $out .= 
"\n".
'/CIDToGIDMap '.($this->n + 2).
' 0 R';
 
12240           $out .= 
"\n".
'endobj';
 
12245           $out = 
'<< /Type /FontDescriptor';
 
12246           $out .= 
' /FontName /'.$fontname;
 
12247           foreach ($font[
'desc'] as $key => $value) {
 
12248                if (is_float($value)) {
 
12249                     $value = sprintf(
'%F', $value);
 
12251                $out .= 
' /'.$key.
' '.$value;
 
12254           if (!$this->empty_string($font[
'file'])) {
 
12256                $out .= 
' /FontFile2 '.$this->FontFiles[$font[
'file']][
'n'].
' 0 R';
 
12257                $fontdir = $this->FontFiles[$font[
'file']][
'fontdir'];
 
12260           $out .= 
"\n".
'endobj';
 
12262           if (isset($font[
'ctg']) AND (!$this->empty_string($font[
'ctg']))) {
 
12267                $ctgfile = strtolower($font[
'ctg']);
 
12271                if (($fontdir !== 
false) AND file_exists($fontdir.$ctgfile)) {
 
12272                     $fontfile = $fontdir.$ctgfile;
 
12273                } 
elseif (file_exists($this->_getfontpath().$ctgfile)) {
 
12274                     $fontfile = $this->_getfontpath().$ctgfile;
 
12275                } 
elseif (file_exists($ctgfile)) {
 
12276                     $fontfile = $ctgfile;
 
12278                if ($this->empty_string($fontfile)) {
 
12279                     $this->Error(
'Font file not found: '.$ctgfile);
 
12281                $stream = $this->_getrawstream(file_get_contents($fontfile));
 
12282                $out = 
'<< /Length '.strlen($stream).
'';
 
12283                if (substr($fontfile, -2) == 
'.z') { 
 
12287                     $out .= 
' /Filter /FlateDecode';
 
12290                $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
12291                $out .= 
"\n".
'endobj';
 
12306           if (!isset($font[
'cw'][1])) {
 
12309           if (isset($font[
'cidinfo'][
'uni2cid'])) {
 
12311                $uni2cid = $font[
'cidinfo'][
'uni2cid'];
 
12313                foreach ($font[
'cw'] as $uni => $width) {
 
12314                     if (isset($uni2cid[$uni])) {
 
12315                          $cw[($uni2cid[$uni] + $cidoffset)] = $width;
 
12317                          $cw[$uni] = $width;
 
12320                $font = array_merge($font, array(
'cw' => $cw));
 
12322           $name = $font[
'name'];
 
12323           $enc = $font[
'enc'];
 
12325                $longname = $name.
'-'.$enc;
 
12329           $out = $this->_getobj($this->font_obj_ids[$font[
'fontkey']]).
"\n";
 
12330           $out .= 
'<</Type /Font';
 
12331           $out .= 
' /Subtype /Type0';
 
12332           $out .= 
' /BaseFont /'.$longname;
 
12333           $out .= 
' /Name /F'.$font[
'i'];
 
12335                $out .= 
' /Encoding /'.$enc;
 
12337           $out .= 
' /DescendantFonts ['.($this->n + 1).
' 0 R]';
 
12339           $out .= 
"\n".
'endobj';
 
12341           $oid = $this->_newobj();
 
12342           $out = 
'<</Type /Font';
 
12343           $out .= 
' /Subtype /CIDFontType0';
 
12344           $out .= 
' /BaseFont /'.$name;
 
12345           $cidinfo = 
'/Registry '.$this->_datastring($font[
'cidinfo'][
'Registry'], $oid);
 
12346           $cidinfo .= 
' /Ordering '.$this->_datastring($font[
'cidinfo'][
'Ordering'], $oid);
 
12347           $cidinfo .= 
' /Supplement '.$font[
'cidinfo'][
'Supplement'];
 
12348           $out .= 
' /CIDSystemInfo <<'.$cidinfo.
'>>';
 
12349           $out .= 
' /FontDescriptor '.($this->n + 1).
' 0 R';
 
12350           $out .= 
' /DW '.$font[
'dw'];
 
12351           $out .= 
"\n".$this->_putfontwidths($font, $cidoffset);
 
12353           $out .= 
"\n".
'endobj';
 
12356           $s = 
'<</Type /FontDescriptor /FontName /'.$name;
 
12357           foreach ($font[
'desc'] as $k => $v) {
 
12358                if ($k != 
'Style') {
 
12359                     if (is_float($v)) {
 
12360                          $v = sprintf(
'%F', $v);
 
12362                     $s .= 
' /'.$k.
' '.$v.
'';
 
12366           $s .= 
"\n".
'endobj';
 
12375           $filter = ($this->compress) ? 
'/Filter /FlateDecode ' : 
'';
 
12376           foreach ($this->imagekeys as $file) {
 
12377                $info = $this->getImageBuffer($file);
 
12379                if ((!$this->pdfa_mode) AND isset($info[
'altimgs']) AND !empty($info[
'altimgs'])) {
 
12380                     $altoid = $this->_newobj();
 
12382                     foreach ($info[
'altimgs'] as $altimage) {
 
12383                          if (isset($this->xobjects[
'I'.$altimage[0]][
'n'])) {
 
12384                               $out .= 
' << /Image '.$this->xobjects[
'I'.$altimage[0]][
'n'].
' 0 R';
 
12385                               $out .= 
' /DefaultForPrinting';
 
12386                               if ($altimage[1] === 
true) {
 
12395                     $out .= 
"\n".
'endobj';
 
12399                $oid = $this->_newobj();
 
12400                $this->xobjects[
'I'.$info[
'i']] = array(
'n' => $oid);
 
12401                $this->setImageSubBuffer($file, 
'n', $this->n);
 
12402                $out = 
'<</Type /XObject';
 
12403                $out .= 
' /Subtype /Image';
 
12404                $out .= 
' /Width '.$info[
'w'];
 
12405                $out .= 
' /Height '.$info[
'h'];
 
12406                if (array_key_exists(
'masked', $info)) {
 
12407                     $out .= 
' /SMask '.($this->n - 1).
' 0 R';
 
12411                if (isset($info[
'icc']) AND ($info[
'icc'] !== 
false)) {
 
12414                     $out .= 
' /ColorSpace [/ICCBased '.($this->n + 1).
' 0 R]';
 
12415                } 
elseif ($info[
'cs'] == 
'Indexed') {
 
12417                     $out .= 
' /ColorSpace [/Indexed /DeviceRGB '.((strlen($info[
'pal']) / 3) - 1).
' '.($this->n + 1).
' 0 R]';
 
12420                     $out .= 
' /ColorSpace /'.$info[
'cs'];
 
12422                if ($info[
'cs'] == 
'DeviceCMYK') {
 
12423                     $out .= 
' /Decode [1 0 1 0 1 0 1 0]';
 
12425                $out .= 
' /BitsPerComponent '.$info[
'bpc'];
 
12426                if (isset($altoid) AND ($altoid > 0)) {
 
12428                     $out .= 
' /Alternates '.$altoid.
' 0 R';
 
12430                if (isset($info[
'exurl']) AND !empty($info[
'exurl'])) {
 
12432                     $out .= 
' /Length 0';
 
12433                     $out .= 
' /F << /FS /URL /F '.$this->_datastring($info[
'exurl'], $oid).
' >>';
 
12434                     if (isset($info[
'f'])) {
 
12435                          $out .= 
' /FFilter /'.$info[
'f'];
 
12438                     $out .= 
' stream'.
"\n".
'endstream';
 
12440                     if (isset($info[
'f'])) {
 
12441                          $out .= 
' /Filter /'.$info[
'f'];
 
12443                     if (isset($info[
'parms'])) {
 
12444                          $out .= 
' '.$info[
'parms'];
 
12446                     if (isset($info[
'trns']) AND is_array($info[
'trns'])) {
 
12448                          $count_info = count($info[
'trns']);
 
12449                          for (
$i=0; 
$i < $count_info; ++
$i) {
 
12450                               $trns .= $info[
'trns'][
$i].
' '.$info[
'trns'][
$i].
' ';
 
12452                          $out .= 
' /Mask ['.$trns.
']';
 
12454                     $stream = $this->_getrawstream($info[
'data']);
 
12455                     $out .= 
' /Length '.strlen($stream).
' >>';
 
12456                     $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
12458                $out .= 
"\n".
'endobj';
 
12463                     $icc = ($this->compress) ? gzcompress($info[
'icc']) : $info[
'icc'];
 
12464                     $icc = $this->_getrawstream($icc);
 
12465                     $this->_out(
'<</N '.$info[
'ch'].
' /Alternate /'.$info[
'cs'].
' '.$filter.
'/Length '.strlen($icc).
'>> stream'.
"\n".$icc.
"\n".
'endstream'.
"\n".
'endobj');
 
12466                } 
elseif ($info[
'cs'] == 
'Indexed') {
 
12469                     $pal = ($this->compress) ? gzcompress($info[
'pal']) : $info[
'pal'];
 
12470                     $pal = $this->_getrawstream($pal);
 
12471                     $this->_out(
'<<'.$filter.
'/Length '.strlen($pal).
'>> stream'.
"\n".$pal.
"\n".
'endstream'.
"\n".
'endobj');
 
12484           foreach ($this->xobjects as $key => 
$data) {
 
12485                if (isset(
$data[
'outdata'])) {
 
12486                     $stream = trim(
$data[
'outdata']);
 
12487                     $out = $this->_getobj(
$data[
'n']).
"\n";
 
12489                     $out .= 
' /Type /XObject';
 
12490                     $out .= 
' /Subtype /Form';
 
12491                     $out .= 
' /FormType 1';
 
12492                     if ($this->compress) {
 
12493                          $stream = gzcompress($stream);
 
12494                          $out .= 
' /Filter /FlateDecode';
 
12496                     $out .= sprintf(
' /BBox [%F %F %F %F]', (
$data[
'x'] * $this->k), (-
$data[
'y'] * $this->k), ((
$data[
'w'] + 
$data[
'x']) * $this->k), ((
$data[
'h'] - 
$data[
'y']) * $this->k));
 
12497                     $out .= 
' /Matrix [1 0 0 1 0 0]';
 
12498                     $out .= 
' /Resources <<';
 
12499                     $out .= 
' /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]';
 
12500                     if (!$this->pdfa_mode) {
 
12502                          if (isset(
$data[
'extgstates']) AND !empty(
$data[
'extgstates'])) {
 
12503                               $out .= 
' /ExtGState <<';
 
12504                               foreach (
$data[
'extgstates'] as $k => $extgstate) {
 
12505                                    if (isset($this->extgstates[$k][
'name'])) {
 
12506                                         $out .= 
' /'.$this->extgstates[$k][
'name'];
 
12510                                    $out .= 
' '.$this->extgstates[$k][
'n'].
' 0 R';
 
12514                          if (isset(
$data[
'gradients']) AND !empty(
$data[
'gradients'])) {
 
12517                               foreach (
$data[
'gradients'] as 
$id => $grad) {
 
12519                                    $gp .= 
' /p'.$id.
' '.$this->gradients[
$id][
'pattern'].
' 0 R';
 
12521                                    $gs .= 
' /Sh'.$id.
' '.$this->gradients[
$id][
'id'].
' 0 R';
 
12523                               $out .= 
' /Pattern <<'.$gp.
' >>';
 
12524                               $out .= 
' /Shading <<'.$gs.
' >>';
 
12528                     if (isset(
$data[
'spot_colors']) AND !empty(
$data[
'spot_colors'])) {
 
12529                          $out .= 
' /ColorSpace <<';
 
12530                          foreach (
$data[
'spot_colors'] as $name => $color) {
 
12531                               $out .= 
' /CS'.$color[
'i'].
' '.$this->spot_colors[$name][
'n'].
' 0 R';
 
12536                     if (!empty(
$data[
'fonts'])) {
 
12537                          $out .= 
' /Font <<';
 
12538                          foreach (
$data[
'fonts'] as $fontkey => $fontid) {
 
12539                               $out .= 
' /F'.$fontid.
' '.$this->font_obj_ids[$fontkey].
' 0 R';
 
12544                     if (!empty(
$data[
'images']) OR !empty(
$data[
'xobjects'])) {
 
12545                          $out .= 
' /XObject <<';
 
12546                          foreach (
$data[
'images'] as $imgid) {
 
12547                               $out .= 
' /I'.$imgid.
' '.$this->xobjects[
'I'.$imgid][
'n'].
' 0 R';
 
12549                          foreach (
$data[
'xobjects'] as $sub_id => $sub_objid) {
 
12550                               $out .= 
' /'.$sub_id.
' '.$sub_objid[
'n'].
' 0 R';
 
12555                     if (isset(
$data[
'group']) AND (
$data[
'group'] !== 
false)) {
 
12557                          $out .= 
' /Group << /Type /Group /S /Transparency';
 
12558                          if (is_array(
$data[
'group'])) {
 
12559                               if (isset(
$data[
'group'][
'CS']) AND !empty(
$data[
'group'][
'CS'])) {
 
12560                                    $out .= 
' /CS /'.$data[
'group'][
'CS'];
 
12562                               if (isset(
$data[
'group'][
'I'])) {
 
12563                                    $out .= 
' /I /'.($data[
'group'][
'I']===
true?
'true':
'false');
 
12565                               if (isset(
$data[
'group'][
'K'])) {
 
12566                                    $out .= 
' /K /'.($data[
'group'][
'K']===
true?
'true':
'false');
 
12571                     $stream = $this->_getrawstream($stream, 
$data[
'n']);
 
12572                     $out .= 
' /Length '.strlen($stream);
 
12574                     $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
12575                     $out .= 
"\n".
'endobj';
 
12587           foreach ($this->spot_colors as $name => $color) {
 
12589                $this->spot_colors[$name][
'n'] = $this->n;
 
12590                $out = 
'[/Separation /'.str_replace(
' ', 
'#20', $name);
 
12591                $out .= 
' /DeviceCMYK <<';
 
12592                $out .= 
' /Range [0 1 0 1 0 1 0 1] /C0 [0 0 0 0]';
 
12593                $out .= 
' '.sprintf(
'/C1 [%F %F %F %F] ', ($color[
'C'] / 100), ($color[
'M'] / 100), ($color[
'Y'] / 100), ($color[
'K'] / 100));
 
12594                $out .= 
' /FunctionType 2 /Domain [0 1] /N 1>>]';
 
12595                $out .= 
"\n".
'endobj';
 
12608           foreach ($this->xobjects as 
$id => $objid) {
 
12609                $out .= 
' /'.$id.
' '.$objid[
'n'].
' 0 R';
 
12619           $out = $this->_getobj(2).
"\n";
 
12620           $out .= 
'<< /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]';
 
12621           $out .= 
' /Font <<';
 
12622           foreach ($this->fontkeys as $fontkey) {
 
12623                $font = $this->getFontBuffer($fontkey);
 
12624                $out .= 
' /F'.$font[
'i'].
' '.$font[
'n'].
' 0 R';
 
12627           $out .= 
' /XObject <<';
 
12628           $out .= $this->_getxobjectdict();
 
12631           if (!empty($this->pdflayers)) {
 
12632                $out .= 
' /Properties <<';
 
12633                foreach ($this->pdflayers as $layer) {
 
12634                     $out .= 
' /'.$layer[
'layer'].
' '.$layer[
'objid'].
' 0 R';
 
12638           if (!$this->pdfa_mode) {
 
12640                if (isset($this->extgstates) AND !empty($this->extgstates)) {
 
12641                     $out .= 
' /ExtGState <<';
 
12642                     foreach ($this->extgstates as $k => $extgstate) {
 
12643                          if (isset($extgstate[
'name'])) {
 
12644                               $out .= 
' /'.$extgstate[
'name'];
 
12648                          $out .= 
' '.$extgstate[
'n'].
' 0 R';
 
12652                if (isset($this->gradients) AND !empty($this->gradients)) {
 
12655                     foreach ($this->gradients as 
$id => $grad) {
 
12657                          $gp .= 
' /p'.$id.
' '.$grad[
'pattern'].
' 0 R';
 
12659                          $gs .= 
' /Sh'.$id.
' '.$grad[
'id'].
' 0 R';
 
12661                     $out .= 
' /Pattern <<'.$gp.
' >>';
 
12662                     $out .= 
' /Shading <<'.$gs.
' >>';
 
12666           if (isset($this->spot_colors) AND !empty($this->spot_colors)) {
 
12667                $out .= 
' /ColorSpace <<';
 
12668                foreach ($this->spot_colors as $color) {
 
12669                     $out .= 
' /CS'.$color[
'i'].
' '.$color[
'n'].
' 0 R';
 
12674           $out .= 
"\n".
'endobj';
 
12683           $this->_putextgstates();
 
12685           $this->_putfonts();
 
12686           $this->_putimages();
 
12687           $this->_putspotcolors();
 
12688           $this->_putshaders();
 
12689           $this->_putxobjects();
 
12690           $this->_putresourcedict();
 
12691           $this->_putdests();
 
12692           $this->_putbookmarks();
 
12693           $this->_putEmbeddedFiles();
 
12694           $this->_putannotsobjs();
 
12695           $this->_putjavascript();
 
12696           $this->_putencryption();
 
12706           $oid = $this->_newobj();
 
12709           $prev_isunicode = $this->isunicode;
 
12710           if ($this->docinfounicode) {
 
12711                $this->isunicode = 
true;
 
12713           if (!$this->empty_string($this->title)) {
 
12715                $out .= 
' /Title '.$this->_textstring($this->title, $oid);
 
12717           if (!$this->empty_string($this->author)) {
 
12719                $out .= 
' /Author '.$this->_textstring($this->author, $oid);
 
12721           if (!$this->empty_string($this->subject)) {
 
12723                $out .= 
' /Subject '.$this->_textstring($this->subject, $oid);
 
12725           if (!$this->empty_string($this->keywords)) {
 
12727                $out .= 
' /Keywords '.$this->_textstring($this->keywords.
' TCPDF', $oid);
 
12729           if (!$this->empty_string($this->creator)) {
 
12731                $out .= 
' /Creator '.$this->_textstring($this->creator, $oid);
 
12734           $this->isunicode = $prev_isunicode;
 
12736           $out .= 
' /Producer '.$this->_textstring($this->pdfproducer, $oid);
 
12738           $out .= 
' /CreationDate '.$this->_datestring(0, $this->doc_creation_timestamp);
 
12740           $out .= 
' /ModDate '.$this->_datestring(0, $this->doc_modification_timestamp);
 
12742           $out .= 
' /Trapped /False';
 
12744           $out .= 
"\n".
'endobj';
 
12757           $this->custom_xmp = $xmp;
 
12767           $oid = $this->_newobj();
 
12769           $prev_isunicode = $this->isunicode;
 
12770           $this->isunicode = 
true;
 
12771           $prev_encrypted = $this->encrypted;
 
12772           $this->encrypted = 
false;
 
12774           $xmp = 
'<?xpacket begin="'.$this->unichr(0xfeff).
'" id="W5M0MpCehiHzreSzNTczkc9d"?>'.
"\n";
 
12775           $xmp .= 
'<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 4.2.1-c043 52.372728, 2009/01/18-15:08:04">'.
"\n";
 
12776           $xmp .= 
"\t".
'<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">'.
"\n";
 
12777           $xmp .= 
"\t\t".
'<rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">'.
"\n";
 
12778           $xmp .= 
"\t\t\t".
'<dc:format>application/pdf</dc:format>'.
"\n";
 
12779           $xmp .= 
"\t\t\t".
'<dc:title>'.
"\n";
 
12780           $xmp .= 
"\t\t\t\t".
'<rdf:Alt>'.
"\n";
 
12781           $xmp .= 
"\t\t\t\t\t".
'<rdf:li xml:lang="x-default">'.$this->_escapeXML($this->title).
'</rdf:li>'.
"\n";
 
12782           $xmp .= 
"\t\t\t\t".
'</rdf:Alt>'.
"\n";
 
12783           $xmp .= 
"\t\t\t".
'</dc:title>'.
"\n";
 
12784           $xmp .= 
"\t\t\t".
'<dc:creator>'.
"\n";
 
12785           $xmp .= 
"\t\t\t\t".
'<rdf:Seq>'.
"\n";
 
12786           $xmp .= 
"\t\t\t\t\t".
'<rdf:li>'.$this->_escapeXML($this->author).
'</rdf:li>'.
"\n";
 
12787           $xmp .= 
"\t\t\t\t".
'</rdf:Seq>'.
"\n";
 
12788           $xmp .= 
"\t\t\t".
'</dc:creator>'.
"\n";
 
12789           $xmp .= 
"\t\t\t".
'<dc:description>'.
"\n";
 
12790           $xmp .= 
"\t\t\t\t".
'<rdf:Alt>'.
"\n";
 
12791           $xmp .= 
"\t\t\t\t\t".
'<rdf:li xml:lang="x-default">'.$this->_escapeXML($this->subject).
'</rdf:li>'.
"\n";
 
12792           $xmp .= 
"\t\t\t\t".
'</rdf:Alt>'.
"\n";
 
12793           $xmp .= 
"\t\t\t".
'</dc:description>'.
"\n";
 
12794           $xmp .= 
"\t\t\t".
'<dc:subject>'.
"\n";
 
12795           $xmp .= 
"\t\t\t\t".
'<rdf:Bag>'.
"\n";
 
12796           $xmp .= 
"\t\t\t\t\t".
'<rdf:li>'.$this->_escapeXML($this->keywords).
' TCPDF</rdf:li>'.
"\n";
 
12797           $xmp .= 
"\t\t\t\t".
'</rdf:Bag>'.
"\n";
 
12798           $xmp .= 
"\t\t\t".
'</dc:subject>'.
"\n";
 
12799           $xmp .= 
"\t\t".
'</rdf:Description>'.
"\n";
 
12801           $dcdate = $this->getFormattedDate($this->doc_creation_timestamp);
 
12802           $doccreationdate = substr($dcdate, 0, 4).
'-'.substr($dcdate, 4, 2).
'-'.substr($dcdate, 6, 2);
 
12803           $doccreationdate .= 
'T'.substr($dcdate, 8, 2).
':'.substr($dcdate, 10, 2).
':'.substr($dcdate, 12, 2);
 
12804           $doccreationdate .= 
'+'.substr($dcdate, 15, 2).
':'.substr($dcdate, 18, 2);
 
12805           $doccreationdate = $this->_escapeXML($doccreationdate);
 
12807           $dmdate = $this->getFormattedDate($this->doc_modification_timestamp);
 
12808           $docmoddate = substr($dmdate, 0, 4).
'-'.substr($dmdate, 4, 2).
'-'.substr($dmdate, 6, 2);
 
12809           $docmoddate .= 
'T'.substr($dmdate, 8, 2).
':'.substr($dmdate, 10, 2).
':'.substr($dmdate, 12, 2);
 
12810           $docmoddate .= 
'+'.substr($dmdate, 15, 2).
':'.substr($dmdate, 18, 2);
 
12811           $docmoddate = $this->_escapeXML($docmoddate);
 
12812           $xmp .= 
"\t\t".
'<rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/">'.
"\n";
 
12813           $xmp .= 
"\t\t\t".
'<xmp:CreateDate>'.$doccreationdate.
'</xmp:CreateDate>'.
"\n";
 
12814           $xmp .= 
"\t\t\t".
'<xmp:CreatorTool>'.$this->creator.
'</xmp:CreatorTool>'.
"\n";
 
12815           $xmp .= 
"\t\t\t".
'<xmp:ModifyDate>'.$docmoddate.
'</xmp:ModifyDate>'.
"\n";
 
12816           $xmp .= 
"\t\t\t".
'<xmp:MetadataDate>'.$doccreationdate.
'</xmp:MetadataDate>'.
"\n";
 
12817           $xmp .= 
"\t\t".
'</rdf:Description>'.
"\n";
 
12818           $xmp .= 
"\t\t".
'<rdf:Description rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/">'.
"\n";
 
12819           $xmp .= 
"\t\t\t".
'<pdf:Keywords>'.$this->_escapeXML($this->keywords).
' TCPDF</pdf:Keywords>'.
"\n";
 
12820           $xmp .= 
"\t\t\t".
'<pdf:Producer>'.$this->_escapeXML($this->pdfproducer).
'</pdf:Producer>'.
"\n";
 
12821           $xmp .= 
"\t\t".
'</rdf:Description>'.
"\n";
 
12822           $xmp .= 
"\t\t".
'<rdf:Description rdf:about="" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">'.
"\n";
 
12823           $uuid = 
'uuid:'.substr($this->file_id, 0, 8).
'-'.substr($this->file_id, 8, 4).
'-'.substr($this->file_id, 12, 4).
'-'.substr($this->file_id, 16, 4).
'-'.substr($this->file_id, 20, 12);
 
12824           $xmp .= 
"\t\t\t".
'<xmpMM:DocumentID>'.$uuid.
'</xmpMM:DocumentID>'.
"\n";
 
12825           $xmp .= 
"\t\t\t".
'<xmpMM:InstanceID>'.$uuid.
'</xmpMM:InstanceID>'.
"\n";
 
12826           $xmp .= 
"\t\t".
'</rdf:Description>'.
"\n";
 
12827           if ($this->pdfa_mode) {
 
12828                $xmp .= 
"\t\t".
'<rdf:Description rdf:about="" xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/">'.
"\n";
 
12829                $xmp .= 
"\t\t\t".
'<pdfaid:part>1</pdfaid:part>'.
"\n";
 
12830                $xmp .= 
"\t\t\t".
'<pdfaid:conformance>B</pdfaid:conformance>'.
"\n";
 
12831                $xmp .= 
"\t\t".
'</rdf:Description>'.
"\n";
 
12834           $xmp .= 
"\t\t".
'<rdf:Description rdf:about="" xmlns:pdfaExtension="http://www.aiim.org/pdfa/ns/extension/" xmlns:pdfaSchema="http://www.aiim.org/pdfa/ns/schema#" xmlns:pdfaProperty="http://www.aiim.org/pdfa/ns/property#">'.
"\n";
 
12835           $xmp .= 
"\t\t\t".
'<pdfaExtension:schemas>'.
"\n";
 
12836           $xmp .= 
"\t\t\t\t".
'<rdf:Bag>'.
"\n";
 
12837           $xmp .= 
"\t\t\t\t\t".
'<rdf:li rdf:parseType="Resource">'.
"\n";
 
12838           $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:namespaceURI>http://ns.adobe.com/pdf/1.3/</pdfaSchema:namespaceURI>'.
"\n";
 
12839           $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:prefix>pdf</pdfaSchema:prefix>'.
"\n";
 
12840           $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:schema>Adobe PDF Schema</pdfaSchema:schema>'.
"\n";
 
12841           $xmp .= 
"\t\t\t\t\t".
'</rdf:li>'.
"\n";
 
12842           $xmp .= 
"\t\t\t\t\t".
'<rdf:li rdf:parseType="Resource">'.
"\n";
 
12843           $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:namespaceURI>http://ns.adobe.com/xap/1.0/mm/</pdfaSchema:namespaceURI>'.
"\n";
 
12844           $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:prefix>xmpMM</pdfaSchema:prefix>'.
"\n";
 
12845           $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:schema>XMP Media Management Schema</pdfaSchema:schema>'.
"\n";
 
12846           $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:property>'.
"\n";
 
12847           $xmp .= 
"\t\t\t\t\t\t\t".
'<rdf:Seq>'.
"\n";
 
12848           $xmp .= 
"\t\t\t\t\t\t\t\t".
'<rdf:li rdf:parseType="Resource">'.
"\n";
 
12849           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:category>internal</pdfaProperty:category>'.
"\n";
 
12850           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:description>UUID based identifier for specific incarnation of a document</pdfaProperty:description>'.
"\n";
 
12851           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:name>InstanceID</pdfaProperty:name>'.
"\n";
 
12852           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:valueType>URI</pdfaProperty:valueType>'.
"\n";
 
12853           $xmp .= 
"\t\t\t\t\t\t\t\t".
'</rdf:li>'.
"\n";
 
12854           $xmp .= 
"\t\t\t\t\t\t\t".
'</rdf:Seq>'.
"\n";
 
12855           $xmp .= 
"\t\t\t\t\t\t".
'</pdfaSchema:property>'.
"\n";
 
12856           $xmp .= 
"\t\t\t\t\t".
'</rdf:li>'.
"\n";
 
12857           $xmp .= 
"\t\t\t\t\t".
'<rdf:li rdf:parseType="Resource">'.
"\n";
 
12858           $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:namespaceURI>http://www.aiim.org/pdfa/ns/id/</pdfaSchema:namespaceURI>'.
"\n";
 
12859           $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:prefix>pdfaid</pdfaSchema:prefix>'.
"\n";
 
12860           $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:schema>PDF/A ID Schema</pdfaSchema:schema>'.
"\n";
 
12861           $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:property>'.
"\n";
 
12862           $xmp .= 
"\t\t\t\t\t\t\t".
'<rdf:Seq>'.
"\n";
 
12863           $xmp .= 
"\t\t\t\t\t\t\t\t".
'<rdf:li rdf:parseType="Resource">'.
"\n";
 
12864           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:category>internal</pdfaProperty:category>'.
"\n";
 
12865           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:description>Part of PDF/A standard</pdfaProperty:description>'.
"\n";
 
12866           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:name>part</pdfaProperty:name>'.
"\n";
 
12867           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:valueType>Integer</pdfaProperty:valueType>'.
"\n";
 
12868           $xmp .= 
"\t\t\t\t\t\t\t\t".
'</rdf:li>'.
"\n";
 
12869           $xmp .= 
"\t\t\t\t\t\t\t\t".
'<rdf:li rdf:parseType="Resource">'.
"\n";
 
12870           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:category>internal</pdfaProperty:category>'.
"\n";
 
12871           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:description>Amendment of PDF/A standard</pdfaProperty:description>'.
"\n";
 
12872           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:name>amd</pdfaProperty:name>'.
"\n";
 
12873           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:valueType>Text</pdfaProperty:valueType>'.
"\n";
 
12874           $xmp .= 
"\t\t\t\t\t\t\t\t".
'</rdf:li>'.
"\n";
 
12875           $xmp .= 
"\t\t\t\t\t\t\t\t".
'<rdf:li rdf:parseType="Resource">'.
"\n";
 
12876           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:category>internal</pdfaProperty:category>'.
"\n";
 
12877           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:description>Conformance level of PDF/A standard</pdfaProperty:description>'.
"\n";
 
12878           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:name>conformance</pdfaProperty:name>'.
"\n";
 
12879           $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:valueType>Text</pdfaProperty:valueType>'.
"\n";
 
12880           $xmp .= 
"\t\t\t\t\t\t\t\t".
'</rdf:li>'.
"\n";
 
12881           $xmp .= 
"\t\t\t\t\t\t\t".
'</rdf:Seq>'.
"\n";
 
12882           $xmp .= 
"\t\t\t\t\t\t".
'</pdfaSchema:property>'.
"\n";
 
12883           $xmp .= 
"\t\t\t\t\t".
'</rdf:li>'.
"\n";
 
12884           $xmp .= 
"\t\t\t\t".
'</rdf:Bag>'.
"\n";
 
12885           $xmp .= 
"\t\t\t".
'</pdfaExtension:schemas>'.
"\n";
 
12886           $xmp .= 
"\t\t".
'</rdf:Description>'.
"\n";
 
12887           $xmp .= 
"\t".
'</rdf:RDF>'.
"\n";
 
12888           $xmp .= $this->custom_xmp;
 
12889           $xmp .= 
'</x:xmpmeta>'.
"\n";
 
12890           $xmp .= 
'<?xpacket end="w"?>';
 
12891           $out = 
'<< /Type /Metadata /Subtype /XML /Length '.strlen($xmp).
' >> stream'.
"\n".$xmp.
"\n".
'endstream'.
"\n".
'endobj';
 
12893           $this->isunicode = $prev_isunicode;
 
12894           $this->encrypted = $prev_encrypted;
 
12906           $xmpobj = $this->_putXMP();
 
12908           if ($this->pdfa_mode OR $this->force_srgb) {
 
12909                $iccobj = $this->_newobj();
 
12910                $icc = file_get_contents(dirname(__FILE__).
'/sRGB.icc');
 
12912                if ($this->compress) {
 
12913                     $filter = 
' /Filter /FlateDecode';
 
12914                     $icc = gzcompress($icc);
 
12916                $icc = $this->_getrawstream($icc);
 
12917                $this->_out(
'<</N 3 '.$filter.
'/Length '.strlen($icc).
'>> stream'.
"\n".$icc.
"\n".
'endstream'.
"\n".
'endobj');
 
12920           $oid = $this->_newobj();
 
12921           $out = 
'<< /Type /Catalog';
 
12922           $out .= 
' /Version /'.$this->PDFVersion;
 
12924           $out .= 
' /Pages 1 0 R';
 
12926           $out .= 
' /Names <<';
 
12927           if ((!$this->pdfa_mode) AND ((!empty($this->javascript)) OR (!empty($this->js_objects)))) {
 
12928                $out .= 
' /JavaScript '.($this->n_js).
' 0 R';
 
12931           if (!empty($this->dests)) {
 
12932                $out .= 
' /Dests '.$this->n_dests.
' 0 R';
 
12934           $out .= $this->_putviewerpreferences();
 
12935           if (isset($this->LayoutMode) AND (!$this->empty_string($this->LayoutMode))) {
 
12936                $out .= 
' /PageLayout /'.$this->LayoutMode;
 
12938           if (isset($this->PageMode) AND (!$this->empty_string($this->PageMode))) {
 
12939                $out .= 
' /PageMode /'.$this->PageMode;
 
12941           if (count($this->outlines) > 0) {
 
12942                $out .= 
' /Outlines '.$this->OutlineRoot.
' 0 R';
 
12943                $out .= 
' /PageMode /UseOutlines';
 
12946           if ($this->ZoomMode == 
'fullpage') {
 
12947                $out .= 
' /OpenAction ['.$this->page_obj_id[1].
' 0 R /Fit]';
 
12948           } 
elseif ($this->ZoomMode == 
'fullwidth') {
 
12949                $out .= 
' /OpenAction ['.$this->page_obj_id[1].
' 0 R /FitH null]';
 
12950           } 
elseif ($this->ZoomMode == 
'real') {
 
12951                $out .= 
' /OpenAction ['.$this->page_obj_id[1].
' 0 R /XYZ null null 1]';
 
12952           } 
elseif (!is_string($this->ZoomMode)) {
 
12953                $out .= sprintf(
' /OpenAction ['.$this->page_obj_id[1].
' 0 R /XYZ null null %F]', ($this->ZoomMode / 100));
 
12957           $out .= 
' /Metadata '.$xmpobj.
' 0 R';
 
12960           if (isset($this->l[
'a_meta_language'])) {
 
12961                $out .= 
' /Lang '.$this->_textstring($this->l[
'a_meta_language'], $oid);
 
12965           if ($this->pdfa_mode OR $this->force_srgb) {
 
12966                $out .= 
' /OutputIntents [<<';
 
12967                $out .= 
' /Type /OutputIntent';
 
12968                $out .= 
' /S /GTS_PDFA1';
 
12969                $out .= 
' /OutputCondition '.$this->_textstring(
'sRGB IEC61966-2.1', $oid);
 
12970                $out .= 
' /OutputConditionIdentifier '.$this->_textstring(
'sRGB IEC61966-2.1', $oid);
 
12971                $out .= 
' /RegistryName '.$this->_textstring(
'http://www.color.org', $oid);
 
12972                $out .= 
' /Info '.$this->_textstring(
'sRGB IEC61966-2.1', $oid);
 
12973                $out .= 
' /DestOutputProfile '.$iccobj.
' 0 R';
 
12977           if (!empty($this->pdflayers)) {
 
12979                $lyrobjs_print = 
'';
 
12980                $lyrobjs_view = 
'';
 
12981                foreach ($this->pdflayers as $layer) {
 
12982                     $lyrobjs .= 
' '.$layer[
'objid'].
' 0 R';
 
12983                     if ($layer[
'print']) {
 
12984                          $lyrobjs_print .= 
' '.$layer[
'objid'].
' 0 R';
 
12986                     if ($layer[
'view']) {
 
12987                          $lyrobjs_view .= 
' '.$layer[
'objid'].
' 0 R';
 
12990                $out .= 
' /OCProperties << /OCGs ['.$lyrobjs.
']';
 
12992                $out .= 
' /Name '.$this->_textstring(
'Layers', $oid);
 
12993                $out .= 
' /Creator '.$this->_textstring(
'TCPDF', $oid);
 
12994                $out .= 
' /BaseState /ON';
 
12995                $out .= 
' /ON ['.$lyrobjs_print.
']';
 
12996                $out .= 
' /OFF ['.$lyrobjs_view.
']';
 
12997                $out .= 
' /Intent /View';
 
12999                $out .= 
' << /Event /Print /OCGs ['.$lyrobjs.
'] /Category [/Print] >>';
 
13000                $out .= 
' << /Event /View /OCGs ['.$lyrobjs.
'] /Category [/View] >>';
 
13002                $out .= 
' /Order ['.$lyrobjs.
']';
 
13003                $out .= 
' /ListMode /AllPages';
 
13010           if (!empty($this->form_obj_id) OR ($this->sign AND isset($this->signature_data[
'cert_type']))) {
 
13011                $out .= 
' /AcroForm <<';
 
13013                if ($this->sign AND isset($this->signature_data[
'cert_type'])) {
 
13015                     $objrefs .= $this->sig_obj_id.
' 0 R';
 
13017                if (!empty($this->empty_signature_appearance)) {
 
13018                     foreach ($this->empty_signature_appearance as $esa) {
 
13020                          $objrefs .= 
' '.$esa[
'objid'].
' 0 R';
 
13023                if (!empty($this->form_obj_id)) {
 
13024                     foreach($this->form_obj_id as $objid) {
 
13025                          $objrefs .= 
' '.$objid.
' 0 R';
 
13028                $out .= 
' /Fields ['.$objrefs.
']';
 
13030                $out .= 
' /NeedAppearances false';
 
13031                if ($this->sign AND isset($this->signature_data[
'cert_type'])) {
 
13032                     if ($this->signature_data[
'cert_type'] > 0) {
 
13033                          $out .= 
' /SigFlags 3';
 
13035                          $out .= 
' /SigFlags 1';
 
13039                if (isset($this->annotation_fonts) AND !empty($this->annotation_fonts)) {
 
13041                     $out .= 
' /Font <<';
 
13042                     foreach ($this->annotation_fonts as $fontkey => $fontid) {
 
13043                          $out .= 
' /F'.$fontid.
' '.$this->font_obj_ids[$fontkey].
' 0 R';
 
13047                $font = $this->getFontBuffer(
'helvetica');
 
13048                $out .= 
' /DA (/F'.$font[
'i'].
' 0 Tf 0 g)';
 
13049                $out .= 
' /Q '.(($this->rtl)?
'2':
'0');
 
13053                if ($this->sign AND isset($this->signature_data[
'cert_type'])) {
 
13054                     if ($this->signature_data[
'cert_type'] > 0) {
 
13055                          $out .= 
' /Perms << /DocMDP '.($this->sig_obj_id + 1).
' 0 R >>';
 
13057                          $out .= 
' /Perms << /UR3 '.($this->sig_obj_id + 1).
' 0 R >>';
 
13066           $out .= 
"\n".
'endobj';
 
13079           $out = 
' /ViewerPreferences <<';
 
13081                $out .= 
' /Direction /R2L';
 
13083                $out .= 
' /Direction /L2R';
 
13085           if (isset($this->viewer_preferences[
'HideToolbar']) AND ($this->viewer_preferences[
'HideToolbar'])) {
 
13086                $out .= 
' /HideToolbar true';
 
13088           if (isset($this->viewer_preferences[
'HideMenubar']) AND ($this->viewer_preferences[
'HideMenubar'])) {
 
13089                $out .= 
' /HideMenubar true';
 
13091           if (isset($this->viewer_preferences[
'HideWindowUI']) AND ($this->viewer_preferences[
'HideWindowUI'])) {
 
13092                $out .= 
' /HideWindowUI true';
 
13094           if (isset($this->viewer_preferences[
'FitWindow']) AND ($this->viewer_preferences[
'FitWindow'])) {
 
13095                $out .= 
' /FitWindow true';
 
13097           if (isset($this->viewer_preferences[
'CenterWindow']) AND ($this->viewer_preferences[
'CenterWindow'])) {
 
13098                $out .= 
' /CenterWindow true';
 
13100           if (isset($this->viewer_preferences[
'DisplayDocTitle']) AND ($this->viewer_preferences[
'DisplayDocTitle'])) {
 
13101                $out .= 
' /DisplayDocTitle true';
 
13103           if (isset($this->viewer_preferences[
'NonFullScreenPageMode'])) {
 
13104                $out .= 
' /NonFullScreenPageMode /'.$this->viewer_preferences[
'NonFullScreenPageMode'];
 
13106           if (isset($this->viewer_preferences[
'ViewArea'])) {
 
13107                $out .= 
' /ViewArea /'.$this->viewer_preferences[
'ViewArea'];
 
13109           if (isset($this->viewer_preferences[
'ViewClip'])) {
 
13110                $out .= 
' /ViewClip /'.$this->viewer_preferences[
'ViewClip'];
 
13112           if (isset($this->viewer_preferences[
'PrintArea'])) {
 
13113                $out .= 
' /PrintArea /'.$this->viewer_preferences[
'PrintArea'];
 
13115           if (isset($this->viewer_preferences[
'PrintClip'])) {
 
13116                $out .= 
' /PrintClip /'.$this->viewer_preferences[
'PrintClip'];
 
13118           if (isset($this->viewer_preferences[
'PrintScaling'])) {
 
13119                $out .= 
' /PrintScaling /'.$this->viewer_preferences[
'PrintScaling'];
 
13121           if (isset($this->viewer_preferences[
'Duplex']) AND (!$this->empty_string($this->viewer_preferences[
'Duplex']))) {
 
13122                $out .= 
' /Duplex /'.$this->viewer_preferences[
'Duplex'];
 
13124           if (isset($this->viewer_preferences[
'PickTrayByPDFSize'])) {
 
13125                if ($this->viewer_preferences[
'PickTrayByPDFSize']) {
 
13126                     $out .= 
' /PickTrayByPDFSize true';
 
13128                     $out .= 
' /PickTrayByPDFSize false';
 
13131           if (isset($this->viewer_preferences[
'PrintPageRange'])) {
 
13132                $PrintPageRangeNum = 
'';
 
13133                foreach ($this->viewer_preferences[
'PrintPageRange'] as $k => $v) {
 
13134                     $PrintPageRangeNum .= 
' '.($v - 1).
'';
 
13136                $out .= 
' /PrintPageRange ['.substr($PrintPageRangeNum,1).
']';
 
13138           if (isset($this->viewer_preferences[
'NumCopies'])) {
 
13139                $out .= 
' /NumCopies '.intval($this->viewer_preferences[
'NumCopies']);
 
13150           $this->_out(
'%PDF-'.$this->PDFVersion);
 
13151           $this->_out(
'%'.chr(0xe2).chr(0xe3).chr(0xcf).chr(0xd3));
 
13160           $this->_putheader();
 
13161           $this->_putpages();
 
13162           $this->_putresources();
 
13164           if (!empty($this->empty_signature_appearance)) {
 
13165                foreach ($this->empty_signature_appearance as $key => $esa) {
 
13167                     $out = $this->_getobj($esa[
'objid']).
"\n";
 
13168                     $out .= 
'<< /Type /Annot';
 
13169                     $out .= 
' /Subtype /Widget';
 
13170                     $out .= 
' /Rect ['.$esa[
'rect'].
']';
 
13171                     $out .= 
' /P '.$this->page_obj_id[($esa[
'page'])].
' 0 R'; 
 
13173                     $out .= 
' /FT /Sig';
 
13174                     $signame = sprintf(
'Signature_%03d', ($key + 1));
 
13175                     $out .= 
' /T '.$this->_textstring($signame, $esa[
'objid']);
 
13178                     $out .= 
"\n".
'endobj';
 
13183           if ($this->sign AND isset($this->signature_data[
'cert_type'])) {
 
13185                $out = $this->_getobj($this->sig_obj_id).
"\n";
 
13186                $out .= 
'<< /Type /Annot';
 
13187                $out .= 
' /Subtype /Widget';
 
13188                $out .= 
' /Rect ['.$this->signature_appearance[
'rect'].
']';
 
13189                $out .= 
' /P '.$this->page_obj_id[($this->signature_appearance[
'page'])].
' 0 R'; 
 
13191                $out .= 
' /FT /Sig';
 
13192                $out .= 
' /T '.$this->_textstring(
'Signature_000', $this->sig_obj_id);
 
13194                $out .= 
' /V '.($this->sig_obj_id + 1).
' 0 R';
 
13196                $out .= 
"\n".
'endobj';
 
13199                $this->_putsignature();
 
13202           $objid_info = $this->_putinfo();
 
13204           $objid_catalog = $this->_putcatalog();
 
13206           $o = $this->bufferlen;
 
13208           $this->_out(
'xref');
 
13209           $this->_out(
'0 '.($this->n + 1));
 
13210           $this->_out(
'0000000000 65535 f ');
 
13211           $freegen = ($this->n + 2);
 
13212           for (
$i=1; 
$i <= $this->n; ++
$i) {
 
13213                if (!isset($this->offsets[
$i]) AND ($i > 1)) {
 
13214                     $this->_out(sprintf(
'0000000000 %05d f ', $freegen));
 
13217                     $this->_out(sprintf(
'%010d 00000 n ', $this->offsets[$i]));
 
13221           $out = 
'trailer'.
"\n";
 
13223           $out .= 
' /Size '.($this->n + 1);
 
13224           $out .= 
' /Root '.$objid_catalog.
' 0 R';
 
13225           $out .= 
' /Info '.$objid_info.
' 0 R';
 
13226           if ($this->encrypted) {
 
13227                $out .= 
' /Encrypt '.$this->encryptdata[
'objid'].
' 0 R';
 
13229           $out .= 
' /ID [ <'.$this->file_id.
'> <'.$this->file_id.
'> ]';
 
13232           $this->_out(
'startxref');
 
13234           $this->_out(
'%%EOF');
 
13236           if ($this->diskcache) {
 
13238                foreach ($this->imagekeys as $key) {
 
13240                     unlink($this->images[$key]);
 
13242                foreach ($this->fontkeys as $key) {
 
13244                     unlink($this->fonts[$key]);
 
13258           $this->pageobjects[$this->page] = array();
 
13259           $this->setPageBuffer($this->page, 
'');
 
13261           $this->transfmrk[$this->page] = array();
 
13263           if ($this->empty_string($orientation)) {
 
13264                if (isset($this->CurOrientation)) {
 
13265                     $orientation = $this->CurOrientation;
 
13266                } 
elseif ($this->fwPt > $this->fhPt) {
 
13268                     $orientation = 
'L';
 
13271                     $orientation = 
'P';
 
13274           if ($this->empty_string($format)) {
 
13275                $this->pagedim[$this->page] = $this->pagedim[($this->page - 1)];
 
13276                $this->setPageOrientation($orientation);
 
13278                $this->setPageFormat($format, $orientation);
 
13281                $this->x = $this->w - $this->rMargin;
 
13283                $this->x = $this->lMargin;
 
13285           $this->y = $this->tMargin;
 
13286           if (isset($this->newpagegroup[$this->page])) {
 
13288                $this->currpagegroup = $this->newpagegroup[$this->page];
 
13289                $this->pagegroups[$this->currpagegroup] = 1;
 
13290           } 
elseif (isset($this->currpagegroup) AND ($this->currpagegroup > 0)) {
 
13291                ++$this->pagegroups[$this->currpagegroup];
 
13300           $this->setVisibility(
'all');
 
13310           $this->_out($this->_getobj());
 
13322           if ($objid === 
'') {
 
13326           $this->offsets[$objid] = $this->bufferlen;
 
13327           $this->pageobjects[$this->page][] = $objid;
 
13328           return $objid.
' 0 obj';
 
13339           $w = $this->GetStringWidth($txt);
 
13340           return $this->_dounderlinew($x, $y, $w);
 
13352           $linew = - $this->CurrentFont[
'ut'] / 1000 * $this->FontSizePt;
 
13353           return sprintf(
'%F %F %F %F re f', $x * $this->k, ((($this->h - $y) * $this->k) + $linew), $w * $this->k, $linew);
 
13364           $w = $this->GetStringWidth($txt);
 
13365           return $this->_dolinethroughw($x, $y, $w);
 
13377           $linew = - $this->CurrentFont[
'ut'] / 1000 * $this->FontSizePt;
 
13378           return sprintf(
'%F %F %F %F re f', $x * $this->k, ((($this->h - $y) * $this->k) + $linew + ($this->FontSizePt / 3)), $w * $this->k, $linew);
 
13390           $w = $this->GetStringWidth($txt);
 
13391           return $this->_dooverlinew($x, $y, $w);
 
13403           $linew = - $this->CurrentFont[
'ut'] / 1000 * $this->FontSizePt;
 
13404           return sprintf(
'%F %F %F %F re f', $x * $this->k, (($this->h - $y + $this->FontAscent) * $this->k) - $linew, $w * $this->k, $linew);
 
13415           $a = unpack(
'Ni', fread($f, 4));
 
13427           return strtr($s, array(
')' => 
'\\)', 
'(' => 
'\\(', 
'\\' => 
'\\\\', chr(13) => 
'\r'));
 
13441           $s = $this->_encrypt_data($n, $s);
 
13442           return '('. $this->_escape($s).
')';
 
13452           if (is_string($time)) {
 
13453                $time = getTimestamp($time);
 
13455           $this->doc_creation_timestamp = intval($time);
 
13465           if (is_string($time)) {
 
13466                $time = getTimestamp($time);
 
13468           $this->doc_modification_timestamp = intval($time);
 
13478           return $this->doc_creation_timestamp;
 
13488           return $this->doc_modification_timestamp;
 
13499           if (($date[0] == 
'D') AND ($date[1] == 
':')) {
 
13501                $date = substr($date, 2);
 
13503           return strtotime($date);
 
13514           return substr_replace(date(
'YmdHisO', intval($time)), 
'\'', (0 - 2), 0).
'\'';
 
13526           if ((empty($timestamp)) OR ($timestamp < 0)) {
 
13527                $timestamp = $this->doc_creation_timestamp;
 
13529           return $this->_datastring(
'D:'.$this->getFormattedDate($timestamp), $n);
 
13540           if ($this->isunicode) {
 
13542                $s = $this->UTF8ToUTF16BE($s, 
true);
 
13544           return $this->_datastring($s, $n);
 
13556           if ($this->isunicode) {
 
13557                if (($this->CurrentFont[
'type'] == 
'core') OR ($this->CurrentFont[
'type'] == 
'TrueType') OR ($this->CurrentFont[
'type'] == 
'Type1')) {
 
13558                     $s = $this->UTF8ToLatin1($s);
 
13561                     $s = $this->utf8StrRev($s, 
false, $this->tmprtl);
 
13564           return $this->_escape($s);
 
13575           $replaceTable = array(
"\0" => 
'', 
'&' => 
'&', 
'<' => 
'<', 
'>' => 
'>');
 
13576           $str = strtr($str, $replaceTable);
 
13593           return $this->_encrypt_data($n, $s);
 
13604           return 'stream'.
"\n".$this->_getrawstream($s, $n).
"\n".
'endstream';
 
13615           $this->_out($this->_getstream($s, $n));
 
13624           if ($this->state == 2) {
 
13625                if ($this->inxobj) {
 
13627                     $this->xobjects[$this->xobjid][
'outdata'] .= $s.
"\n";
 
13628                } 
elseif ((!$this->InFooter) AND isset($this->footerlen[$this->page]) AND ($this->footerlen[$this->page] > 0)) {
 
13630                     $pagebuff = $this->getPageBuffer($this->page);
 
13631                     $page = substr($pagebuff, 0, -$this->footerlen[$this->page]);
 
13632                     $footer = substr($pagebuff, -$this->footerlen[$this->page]);
 
13633                     $this->setPageBuffer($this->page, $page.$s.
"\n".$footer);
 
13635                     $this->footerpos[$this->page] += strlen($s.
"\n");
 
13638                     $this->setPageBuffer($this->page, $s.
"\n", 
true);
 
13640           } 
elseif ($this->state > 0) {
 
13642                $this->setBuffer($s.
"\n");
 
13682           $strkey = md5($str);
 
13683           if (isset($this->cache_UTF8StringToArray[$strkey])) {
 
13685                $chrarray = $this->cache_UTF8StringToArray[$strkey][
's'];
 
13686                if (!isset($this->cache_UTF8StringToArray[$strkey][
'f'][$this->CurrentFont[
'fontkey']])) {
 
13687                     if ($this->isunicode) {
 
13688                          foreach ($chrarray as $chr) {
 
13690                               $this->CurrentFont[
'subsetchars'][$chr] = 
true;
 
13693                          $this->setFontSubBuffer($this->CurrentFont[
'fontkey'], 
'subsetchars', $this->CurrentFont[
'subsetchars']);
 
13695                     $this->cache_UTF8StringToArray[$strkey][
'f'][$this->CurrentFont[
'fontkey']] = 
true;
 
13700           if ($this->cache_size_UTF8StringToArray >= $this->cache_maxsize_UTF8StringToArray) {
 
13702                array_shift($this->cache_UTF8StringToArray);
 
13705           $this->cache_UTF8StringToArray[$strkey] = array(
's' => array(), 
'f' => array());
 
13706           ++$this->cache_size_UTF8StringToArray;
 
13707           if (!$this->isunicode) {
 
13710                $strlen = strlen($str);
 
13711                for (
$i=0; 
$i < $strlen; ++
$i) {
 
13712                     $strarr[] = ord($str[
$i]);
 
13715                $this->cache_UTF8StringToArray[$strkey][
's'] = $strarr;
 
13716                $this->cache_UTF8StringToArray[$strkey][
'f'][$this->CurrentFont[
'fontkey']] = 
true;
 
13720           $unicode = array(); 
 
13724           $length = strlen($str);
 
13725           for (
$i = 0; 
$i < $length; ++
$i) {
 
13726                $char = ord($str[
$i]); 
 
13727                if (count($bytes) == 0) { 
 
13728                     if ($char <= 0x7F) {
 
13731                     } 
elseif (($char >> 0x05) == 0x06) { 
 
13732                          $bytes[] = ($char - 0xC0) << 0x06;
 
13734                     } 
elseif (($char >> 0x04) == 0x0E) { 
 
13735                          $bytes[] = ($char - 0xE0) << 0x0C;
 
13737                     } 
elseif (($char >> 0x03) == 0x1E) { 
 
13738                          $bytes[] = ($char - 0xF0) << 0x12;
 
13746                } 
elseif (($char >> 0x06) == 0x02) { 
 
13747                     $bytes[] = $char - 0x80;
 
13748                     if (count($bytes) == $numbytes) {
 
13751                          for ($j = 1; $j < $numbytes; ++$j) {
 
13752                               $char += ($bytes[$j] << (($numbytes - $j - 1) * 0x06));
 
13754                          if ((($char >= 0xD800) AND ($char <= 0xDFFF)) OR ($char >= 0x10FFFF)) {
 
13773                if ($unichar >= 0) {
 
13775                     $unicode[] = $unichar;
 
13777                     $this->CurrentFont[
'subsetchars'][$unichar] = 
true;
 
13782           $this->setFontSubBuffer($this->CurrentFont[
'fontkey'], 
'subsetchars', $this->CurrentFont[
'subsetchars']);
 
13784           $this->cache_UTF8StringToArray[$strkey][
's'] = $unicode;
 
13785           $this->cache_UTF8StringToArray[$strkey][
'f'][$this->CurrentFont[
'fontkey']] = 
true;
 
13800           if (!$this->isunicode) {
 
13803           $unicode = $this->UTF8StringToArray($str); 
 
13804           return $this->arrUTF8ToUTF16BE($unicode, $setbom);
 
13816           if (!$this->isunicode) {
 
13820           $unicode = $this->UTF8StringToArray($str); 
 
13821           foreach ($unicode as $char) {
 
13823                     $outstr .= chr($char);
 
13824                } 
elseif (array_key_exists($char, $this->unicode->uni_utf8tolatin)) {
 
13826                     $outstr .= chr($this->unicode->uni_utf8tolatin[$char]);
 
13827                } 
elseif ($char == 0xFFFD) {
 
13845           if ((!$this->isunicode) OR $this->isUnicodeFont()) {
 
13849           foreach ($unicode as $char) {
 
13852                } 
elseif (array_key_exists($char, $this->unicode->uni_utf8tolatin)) {
 
13854                     $outarr[] = $this->unicode->uni_utf8tolatin[$char];
 
13855                } 
elseif ($char == 0xFFFD) {
 
13905                $outstr .= 
"\xFE\xFF"; 
 
13907           foreach ($unicode as $char) {
 
13908                if ($char == 0x200b) {
 
13910                } 
elseif ($char == 0xFFFD) {
 
13911                     $outstr .= 
"\xFF\xFD"; 
 
13912                } 
elseif ($char < 0x10000) {
 
13913                     $outstr .= chr($char >> 0x08);
 
13914                     $outstr .= chr($char & 0xFF);
 
13917                     $w1 = 0xD800 | ($char >> 0x0a);
 
13918                     $w2 = 0xDC00 | ($char & 0x3FF);
 
13919                     $outstr .= chr($w1 >> 0x08);
 
13920                     $outstr .= chr($w1 & 0xFF);
 
13921                     $outstr .= chr($w2 >> 0x08);
 
13922                     $outstr .= chr($w2 & 0xFF);
 
13936           $this->header_font = $font;
 
13946           return $this->header_font;
 
13956           $this->footer_font = $font;
 
13966           return $this->footer_font;
 
13976           $this->l = $language;
 
13977           if (isset($this->l[
'a_meta_dir'])) {
 
13978                $this->rtl = $this->l[
'a_meta_dir']==
'rtl' ? 
true : 
false;
 
13980                $this->rtl = 
false;
 
13989           if ($this->state < 3) {
 
13992           return $this->buffer;
 
14007      public function addHtmlLink(
$url, $name, $fill=
false, $firstline=
false, $color=
'', $style=-1, $firstblock=
false) {
 
14008           if (!$this->empty_string(
$url) AND (
$url[0] == 
'#') AND is_numeric(
$url[1])) {
 
14010                $lnkdata = explode(
',', 
$url);
 
14011                if (isset($lnkdata[0])) {
 
14012                     $page = intval(substr($lnkdata[0], 1));
 
14013                     if (empty($page) OR ($page <= 0)) {
 
14014                          $page = $this->page;
 
14016                     if (isset($lnkdata[1]) AND (strlen($lnkdata[1]) > 0)) {
 
14017                          $lnky = floatval($lnkdata[1]);
 
14021                     $url = $this->AddLink();
 
14022                     $this->SetLink(
$url, $lnky, $page);
 
14026           $prevcolor = $this->fgcolor;
 
14027           $prevstyle = $this->FontStyle;
 
14028           if (empty($color)) {
 
14029                $this->SetTextColorArray($this->htmlLinkColorArray);
 
14031                $this->SetTextColorArray($color);
 
14033           if ($style == -1) {
 
14034                $this->SetFont(
'', $this->FontStyle.$this->htmlLinkFontStyle);
 
14036                $this->SetFont(
'', $this->FontStyle.$style);
 
14038           $ret = $this->Write($this->lasth, $name, 
$url, $fill, 
'', 
false, 0, $firstline, $firstblock, 0);
 
14040           $this->SetFont(
'', $prevstyle);
 
14041           $this->SetTextColorArray($prevcolor);
 
14053           $color = preg_replace(
'/[\s]*/', 
'', $hcolor); 
 
14054           $color = strtolower($color);
 
14056           if (strpos($color, 
'[') !== 
false) {
 
14057                if (preg_match(
'/[\[][\"\'](t|g|rgb|cmyk)[\"\'][\,]?([0-9\.]*)[\,]?([0-9\.]*)[\,]?([0-9\.]*)[\,]?([0-9\.]*)[\]]/', $color, $m) > 0) {
 
14058                     $returncolor = array();
 
14062                               $returncolor[
'C'] = max(0, min(100, (floatval($m[2]) * 100)));
 
14063                               $returncolor[
'M'] = max(0, min(100, (floatval($m[3]) * 100)));
 
14064                               $returncolor[
'Y'] = max(0, min(100, (floatval($m[4]) * 100)));
 
14065                               $returncolor[
'K'] = max(0, min(100, (floatval($m[5]) * 100)));
 
14070                               $returncolor[
'R'] = max(0, min(255, (floatval($m[2]) * 255)));
 
14071                               $returncolor[
'G'] = max(0, min(255, (floatval($m[3]) * 255)));
 
14072                               $returncolor[
'B'] = max(0, min(255, (floatval($m[4]) * 255)));
 
14077                               $returncolor[
'G'] = max(0, min(255, (floatval($m[2]) * 255)));
 
14086                     return $returncolor;
 
14088           } 
elseif (($dotpos = strpos($color, 
'.')) !== 
false) {
 
14090                $color = substr($color, ($dotpos + 1));
 
14091                if ($color == 
'transparent') {
 
14096           if (strlen($color) == 0) {
 
14100           if (substr($color, 0, 3) == 
'rgb') {
 
14101                $codes = substr($color, 4);
 
14102                $codes = str_replace(
')', 
'', $codes);
 
14103                $returncolor = explode(
',', $codes);
 
14104                foreach ($returncolor as $key => $val) {
 
14105                     if (strpos($val, 
'%') > 0) {
 
14107                          $returncolor[$key] = (255 * intval($val) / 100);
 
14109                          $returncolor[$key] = intval($val);
 
14112                     $returncolor[$key] = max(0, min(255, $returncolor[$key]));
 
14114                return $returncolor;
 
14117           if (substr($color, 0, 4) == 
'cmyk') {
 
14118                $codes = substr($color, 5);
 
14119                $codes = str_replace(
')', 
'', $codes);
 
14120                $returncolor = explode(
',', $codes);
 
14121                foreach ($returncolor as $key => $val) {
 
14122                     if (strpos($val, 
'%') !== 
false) {
 
14124                          $returncolor[$key] = (100 * intval($val) / 100);
 
14126                          $returncolor[$key] = intval($val);
 
14129                     $returncolor[$key] = max(0, min(100, $returncolor[$key]));
 
14131                return $returncolor;
 
14133           if ($color{0} != 
'#') {
 
14135                if (isset($this->webcolor[$color])) {
 
14137                     $color_code = $this->webcolor[$color];
 
14140                     $returncolor = $this->getSpotColor($color);
 
14141                     if ($returncolor === 
false) {
 
14142                          $returncolor = $defcol;
 
14144                     return $returncolor;
 
14147                $color_code = substr($color, 1);
 
14150           switch (strlen($color_code)) {
 
14153                     $r = substr($color_code, 0, 1);
 
14154                     $g = substr($color_code, 1, 1);
 
14155                     $b = substr($color_code, 2, 1);
 
14156                     $returncolor = array();
 
14157                     $returncolor[
'R'] = max(0, min(255, hexdec($r.$r)));
 
14158                     $returncolor[
'G'] = max(0, min(255, hexdec($g.$g)));
 
14159                     $returncolor[
'B'] = max(0, min(255, hexdec($b.$b)));
 
14164                     $returncolor = array();
 
14165                     $returncolor[
'R'] = max(0, min(255, hexdec(substr($color_code, 0, 2))));
 
14166                     $returncolor[
'G'] = max(0, min(255, hexdec(substr($color_code, 2, 2))));
 
14167                     $returncolor[
'B'] = max(0, min(255, hexdec(substr($color_code, 4, 2))));
 
14172                     $returncolor = array();
 
14173                     $returncolor[
'C'] = max(0, min(100, round(hexdec(substr($color_code, 0, 2)) / 2.55)));
 
14174                     $returncolor[
'M'] = max(0, min(100, round(hexdec(substr($color_code, 2, 2)) / 2.55)));
 
14175                     $returncolor[
'Y'] = max(0, min(100, round(hexdec(substr($color_code, 4, 2)) / 2.55)));
 
14176                     $returncolor[
'K'] = max(0, min(100, round(hexdec(substr($color_code, 6, 2)) / 2.55)));
 
14180                     $returncolor = $defcol;
 
14184           return $returncolor;
 
14195           return ($px / ($this->imgscale * $this->k));
 
14206           return @html_entity_decode($text_to_convert, ENT_QUOTES, $this->encoding);
 
14220           $seed .= microtime();
 
14221           if (function_exists(
'openssl_random_pseudo_bytes') AND (strtoupper(substr(PHP_OS, 0, 3)) !== 
'WIN')) {
 
14223                $seed .= openssl_random_pseudo_bytes(512);
 
14225                for (
$i = 0; 
$i < 23; ++
$i) {
 
14226                     $seed .= uniqid(
'', 
true);
 
14229           $seed .= uniqid(
'', 
true);
 
14231           $seed .= @getmypid();
 
14233           $seed .= $this->bufferlen;
 
14234           if (isset($_SERVER[
'REMOTE_ADDR'])) {
 
14235                $seed .= $_SERVER[
'REMOTE_ADDR'];
 
14237           if (isset($_SERVER[
'HTTP_USER_AGENT'])) {
 
14238                $seed .= $_SERVER[
'HTTP_USER_AGENT'];
 
14240           if (isset($_SERVER[
'HTTP_ACCEPT'])) {
 
14241                $seed .= $_SERVER[
'HTTP_ACCEPT'];
 
14243           if (isset($_SERVER[
'HTTP_ACCEPT_ENCODING'])) {
 
14244                $seed .= $_SERVER[
'HTTP_ACCEPT_ENCODING'];
 
14246           if (isset($_SERVER[
'HTTP_ACCEPT_LANGUAGE'])) {
 
14247                $seed .= $_SERVER[
'HTTP_ACCEPT_LANGUAGE'];
 
14249           if (isset($_SERVER[
'HTTP_ACCEPT_CHARSET'])) {
 
14250                $seed .= $_SERVER[
'HTTP_ACCEPT_CHARSET'];
 
14253           $seed .= uniqid(
'', 
true);
 
14254           $seed .= microtime();
 
14268           $objkey = $this->encryptdata[
'key'].pack(
'VXxx', $n);
 
14269           if ($this->encryptdata[
'mode'] == 2) { 
 
14271                $objkey .= 
"\x73\x41\x6C\x54"; 
 
14273           $objkey = substr($this->_md5_16($objkey), 0, (($this->encryptdata[
'Length'] / 8) + 5));
 
14274           $objkey = substr($objkey, 0, 16);
 
14288           if (!$this->encrypted) {
 
14291           switch ($this->encryptdata[
'mode']) {
 
14294                     $s = $this->_RC4($this->_objectkey($n), $s);
 
14298                     $s = $this->_AES($this->_objectkey($n), $s);
 
14302                     $s = $this->_AES($this->encryptdata[
'key'], $s);
 
14316           if (!$this->encrypted) {
 
14319           $this->encryptdata[
'objid'] = $this->_newobj();
 
14321           if (!isset($this->encryptdata[
'Filter']) OR empty($this->encryptdata[
'Filter'])) {
 
14322                $this->encryptdata[
'Filter'] = 
'Standard';
 
14324           $out .= 
' /Filter /'.$this->encryptdata[
'Filter'];
 
14325           if (isset($this->encryptdata[
'SubFilter']) AND !empty($this->encryptdata[
'SubFilter'])) {
 
14326                $out .= 
' /SubFilter /'.$this->encryptdata[
'SubFilter'];
 
14328           if (!isset($this->encryptdata[
'V']) OR empty($this->encryptdata[
'V'])) {
 
14329                $this->encryptdata[
'V'] = 1;
 
14332           $out .= 
' /V '.$this->encryptdata[
'V'];
 
14333           if (isset($this->encryptdata[
'Length']) AND !empty($this->encryptdata[
'Length'])) {
 
14335                $out .= 
' /Length '.$this->encryptdata[
'Length'];
 
14337                $out .= 
' /Length 40';
 
14339           if ($this->encryptdata[
'V'] >= 4) {
 
14340                if (!isset($this->encryptdata[
'StmF']) OR empty($this->encryptdata[
'StmF'])) {
 
14341                     $this->encryptdata[
'StmF'] = 
'Identity';
 
14343                if (!isset($this->encryptdata[
'StrF']) OR empty($this->encryptdata[
'StrF'])) {
 
14345                     $this->encryptdata[
'StrF'] = 
'Identity';
 
14348                if (isset($this->encryptdata[
'CF']) AND !empty($this->encryptdata[
'CF'])) {
 
14350                     $out .= 
' /'.$this->encryptdata[
'StmF'].
' <<';
 
14351                     $out .= 
' /Type /CryptFilter';
 
14352                     if (isset($this->encryptdata[
'CF'][
'CFM']) AND !empty($this->encryptdata[
'CF'][
'CFM'])) {
 
14354                          $out .= 
' /CFM /'.$this->encryptdata[
'CF'][
'CFM'];
 
14355                          if ($this->encryptdata[
'pubkey']) {
 
14356                               $out .= 
' /Recipients [';
 
14357                               foreach ($this->encryptdata[
'Recipients'] as $rec) {
 
14358                                    $out .= 
' <'.$rec.
'>';
 
14361                               if (isset($this->encryptdata[
'CF'][
'EncryptMetadata']) AND (!$this->encryptdata[
'CF'][
'EncryptMetadata'])) {
 
14362                                    $out .= 
' /EncryptMetadata false';
 
14364                                    $out .= 
' /EncryptMetadata true';
 
14368                          $out .= 
' /CFM /None';
 
14370                     if (isset($this->encryptdata[
'CF'][
'AuthEvent']) AND !empty($this->encryptdata[
'CF'][
'AuthEvent'])) {
 
14372                          $out .= 
' /AuthEvent /'.$this->encryptdata[
'CF'][
'AuthEvent'];
 
14374                          $out .= 
' /AuthEvent /DocOpen';
 
14376                     if (isset($this->encryptdata[
'CF'][
'Length']) AND !empty($this->encryptdata[
'CF'][
'Length'])) {
 
14378                          $out .= 
' /Length '.$this->encryptdata[
'CF'][
'Length'];
 
14383                $out .= 
' /StmF /'.$this->encryptdata[
'StmF'];
 
14385                $out .= 
' /StrF /'.$this->encryptdata[
'StrF'];
 
14386                if (isset($this->encryptdata[
'EFF']) AND !empty($this->encryptdata[
'EFF'])) {
 
14388                     $out .= 
' /EFF /'.$this->encryptdata[
''];
 
14392           if ($this->encryptdata[
'pubkey']) {
 
14393                if (($this->encryptdata[
'V'] < 4) AND isset($this->encryptdata[
'Recipients']) AND !empty($this->encryptdata[
'Recipients'])) {
 
14394                     $out .= 
' /Recipients [';
 
14395                     foreach ($this->encryptdata[
'Recipients'] as $rec) {
 
14396                          $out .= 
' <'.$rec.
'>';
 
14402                if ($this->encryptdata[
'V'] == 5) { 
 
14404                     $out .= 
' /OE ('.$this->_escape($this->encryptdata[
'OE']).
')';
 
14405                     $out .= 
' /UE ('.$this->_escape($this->encryptdata[
'UE']).
')';
 
14406                     $out .= 
' /Perms ('.$this->_escape($this->encryptdata[
'perms']).
')';
 
14407                } 
elseif ($this->encryptdata[
'V'] == 4) { 
 
14409                } 
elseif ($this->encryptdata[
'V'] < 2) { 
 
14414                $out .= 
' /O ('.$this->_escape($this->encryptdata[
'O']).
')';
 
14415                $out .= 
' /U ('.$this->_escape($this->encryptdata[
'U']).
')';
 
14416                $out .= 
' /P '.$this->encryptdata[
'P'];
 
14417                if (isset($this->encryptdata[
'EncryptMetadata']) AND (!$this->encryptdata[
'EncryptMetadata'])) {
 
14418                     $out .= 
' /EncryptMetadata false';
 
14420                     $out .= 
' /EncryptMetadata true';
 
14424           $out .= 
"\n".
'endobj';
 
14439           if (function_exists(
'mcrypt_decrypt') AND ($out = @mcrypt_decrypt(MCRYPT_ARCFOUR, $key, $text, MCRYPT_MODE_STREAM, 
''))) {
 
14443           if ($this->last_enc_key != $key) {
 
14444                $k = str_repeat($key, ((256 / strlen($key)) + 1));
 
14445                $rc4 = range(0, 255);
 
14447                for (
$i = 0; 
$i < 256; ++
$i) {
 
14449                     $j = ($j + $t + ord($k[
$i])) % 256;
 
14450                     $rc4[
$i] = $rc4[$j];
 
14453                $this->last_enc_key = $key;
 
14454                $this->last_enc_key_c = $rc4;
 
14456                $rc4 = $this->last_enc_key_c;
 
14458           $len = strlen($text);
 
14462           for (
$i = 0; 
$i < $len; ++
$i) {
 
14463                $a = ($a + 1) % 256;
 
14465                $b = ($b + $t) % 256;
 
14466                $rc4[$a] = $rc4[$b];
 
14468                $k = $rc4[($rc4[$a] + $rc4[$b]) % 256];
 
14469                $out .= chr(ord($text[
$i]) ^ $k);
 
14486           $padding = 16 - (strlen($text) % 16);
 
14487           $text .= str_repeat(chr($padding), $padding);
 
14488           $iv = mcrypt_create_iv(mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), MCRYPT_RAND);
 
14489           $text = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $text, MCRYPT_MODE_CBC, $iv);
 
14503           return pack(
'H*', md5($str));
 
14514           if ($this->encryptdata[
'mode'] == 0) { 
 
14515                return $this->_RC4($this->encryptdata[
'key'], $this->enc_padding);
 
14516           } 
elseif ($this->encryptdata[
'mode'] < 3) { 
 
14517                $tmp = $this->_md5_16($this->enc_padding.$this->encryptdata[
'fileid']);
 
14518                $enc = $this->_RC4($this->encryptdata[
'key'], $tmp);
 
14519                $len = strlen($tmp);
 
14520                for (
$i = 1; 
$i <= 19; ++
$i) {
 
14522                     for ($j = 0; $j < $len; ++$j) {
 
14523                          $ek .= chr(ord($this->encryptdata[
'key'][$j]) ^ 
$i);
 
14525                     $enc = $this->_RC4($ek, $enc);
 
14527                $enc .= str_repeat(
"\x00", 16);
 
14528                return substr($enc, 0, 32);
 
14529           } 
elseif ($this->encryptdata[
'mode'] == 3) { 
 
14530                $seed = $this->_md5_16($this->getRandomSeed());
 
14532                $this->encryptdata[
'UVS'] = substr($seed, 0, 8);
 
14534                $this->encryptdata[
'UKS'] = substr($seed, 8, 16);
 
14535                return hash(
'sha256', $this->encryptdata[
'user_password'].$this->encryptdata[
'UVS'], 
true).$this->encryptdata[
'UVS'].$this->encryptdata[
'UKS'];
 
14547           $hashkey = hash(
'sha256', $this->encryptdata[
'user_password'].$this->encryptdata[
'UKS'], 
true);
 
14548           $iv = str_repeat(
"\x00", mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC));
 
14549           return mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $hashkey, $this->encryptdata[
'key'], MCRYPT_MODE_CBC, $iv);
 
14560           if ($this->encryptdata[
'mode'] < 3) { 
 
14561                $tmp = $this->_md5_16($this->encryptdata[
'owner_password']);
 
14562                if ($this->encryptdata[
'mode'] > 0) {
 
14563                     for (
$i = 0; 
$i < 50; ++
$i) {
 
14564                          $tmp = $this->_md5_16($tmp);
 
14567                $owner_key = substr($tmp, 0, ($this->encryptdata[
'Length'] / 8));
 
14568                $enc = $this->_RC4($owner_key, $this->encryptdata[
'user_password']);
 
14569                if ($this->encryptdata[
'mode'] > 0) {
 
14570                     $len = strlen($owner_key);
 
14571                     for (
$i = 1; 
$i <= 19; ++
$i) {
 
14573                          for ($j = 0; $j < $len; ++$j) {
 
14574                               $ek .= chr(ord($owner_key[$j]) ^ 
$i);
 
14576                          $enc = $this->_RC4($ek, $enc);
 
14580           } 
elseif ($this->encryptdata[
'mode'] == 3) { 
 
14581                $seed = $this->_md5_16($this->getRandomSeed());
 
14583                $this->encryptdata[
'OVS'] = substr($seed, 0, 8);
 
14585                $this->encryptdata[
'OKS'] = substr($seed, 8, 16);
 
14586                return hash(
'sha256', $this->encryptdata[
'owner_password'].$this->encryptdata[
'OVS'].$this->encryptdata[
'U'], 
true).$this->encryptdata[
'OVS'].$this->encryptdata[
'OKS'];
 
14598           $hashkey = hash(
'sha256', $this->encryptdata[
'owner_password'].$this->encryptdata[
'OKS'].$this->encryptdata[
'U'], 
true);
 
14599           $iv = str_repeat(
"\x00", mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC));
 
14600           return mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $hashkey, $this->encryptdata[
'key'], MCRYPT_MODE_CBC, $iv);
 
14613           $psw_array = $this->utf8Bidi($this->UTF8StringToArray($password), $password, $this->rtl);
 
14614           foreach ($psw_array as $c) {
 
14615                $psw .= $this->unichr($c);
 
14617           return substr($psw, 0, 127);
 
14627           $keybytelen = ($this->encryptdata[
'Length'] / 8);
 
14628           if (!$this->encryptdata[
'pubkey']) { 
 
14629                if ($this->encryptdata[
'mode'] == 3) { 
 
14631                     $this->encryptdata[
'key'] = substr(hash(
'sha256', $this->getRandomSeed(), 
true), 0, $keybytelen);
 
14633                     $this->encryptdata[
'user_password'] = $this->_fixAES256Password($this->encryptdata[
'user_password']);
 
14634                     $this->encryptdata[
'owner_password'] = $this->_fixAES256Password($this->encryptdata[
'owner_password']);
 
14636                     $this->encryptdata[
'U'] = $this->_Uvalue();
 
14638                     $this->encryptdata[
'UE'] = $this->_UEvalue();
 
14640                     $this->encryptdata[
'O'] = $this->_Ovalue();
 
14642                     $this->encryptdata[
'OE'] = $this->_OEvalue();
 
14644                     $this->encryptdata[
'P'] = $this->encryptdata[
'protection'];
 
14646                     $perms = $this->getEncPermissionsString($this->encryptdata[
'protection']); 
 
14647                     $perms .= chr(255).chr(255).chr(255).chr(255); 
 
14648                     if (isset($this->encryptdata[
'CF'][
'EncryptMetadata']) AND (!$this->encryptdata[
'CF'][
'EncryptMetadata'])) { 
 
14655                     $iv = str_repeat(
"\x00", mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_ECB));
 
14656                     $this->encryptdata[
'perms'] = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $this->encryptdata[
'key'], $perms, MCRYPT_MODE_ECB, $iv);
 
14659                     $this->encryptdata[
'user_password'] = substr($this->encryptdata[
'user_password'].$this->enc_padding, 0, 32);
 
14660                     $this->encryptdata[
'owner_password'] = substr($this->encryptdata[
'owner_password'].$this->enc_padding, 0, 32);
 
14662                     $this->encryptdata[
'O'] = $this->_Ovalue();
 
14664                     $permissions = $this->getEncPermissionsString($this->encryptdata[
'protection']);
 
14666                     $tmp = $this->_md5_16($this->encryptdata[
'user_password'].$this->encryptdata[
'O'].$permissions.$this->encryptdata[
'fileid']);
 
14667                     if ($this->encryptdata[
'mode'] > 0) {
 
14668                          for (
$i = 0; 
$i < 50; ++
$i) {
 
14669                               $tmp = $this->_md5_16(substr($tmp, 0, $keybytelen));
 
14672                     $this->encryptdata[
'key'] = substr($tmp, 0, $keybytelen);
 
14674                     $this->encryptdata[
'U'] = $this->_Uvalue();
 
14676                     $this->encryptdata[
'P'] = $this->encryptdata[
'protection'];
 
14680                $seed = sha1($this->getRandomSeed(), 
true);
 
14681                $recipient_bytes = 
'';
 
14682                foreach ($this->encryptdata[
'pubkeys'] as $pubkey) {
 
14684                     if (isset($pubkey[
'p'])) {
 
14685                          $pkprotection = $this->getUserPermissionCode($pubkey[
'p'], $this->encryptdata[
'mode']);
 
14687                          $pkprotection = $this->encryptdata[
'protection'];
 
14690                     $pkpermissions = $this->getEncPermissionsString($pkprotection);
 
14692                     $envelope = $seed.$pkpermissions;
 
14695                     $f = fopen($tempkeyfile, 
'wb');
 
14697                          $this->Error(
'Unable to create temporary key file: '.$tempkeyfile);
 
14699                     $envelope_length = strlen($envelope);
 
14700                     fwrite($f, $envelope, $envelope_length);
 
14703                     if (!openssl_pkcs7_encrypt($tempkeyfile, $tempencfile, $pubkey[
'c'], array(), PKCS7_BINARY | PKCS7_DETACHED)) {
 
14704                          $this->Error(
'Unable to encrypt the file: '.$tempkeyfile);
 
14706                     unlink($tempkeyfile);
 
14708                     $signature = file_get_contents($tempencfile, 
false, null, $envelope_length);
 
14709                     unlink($tempencfile);
 
14711                     $signature = substr($signature, strpos($signature, 
'Content-Disposition'));
 
14712                     $tmparr = explode(
"\n\n", $signature);
 
14713                     $signature = trim($tmparr[1]);
 
14716                     $signature = base64_decode($signature);
 
14718                     $hexsignature = current(unpack(
'H*', $signature));
 
14720                     $this->encryptdata[
'Recipients'][] = $hexsignature;
 
14722                     $recipient_bytes .= $signature;
 
14725                if ($this->encryptdata[
'mode'] == 3) { 
 
14726                     $this->encryptdata[
'key'] = substr(hash(
'sha256', $seed.$recipient_bytes, 
true), 0, $keybytelen);
 
14728                     $this->encryptdata[
'key'] = substr(sha1($seed.$recipient_bytes, 
true), 0, $keybytelen);
 
14747                'annot-forms' => 32, 
 
14748                'fill-forms' => 256, 
 
14750                'assemble' => 1024,
 
14751                'print-high' => 2048 
 
14753           $protection = 2147422012; 
 
14754           foreach ($permissions as $permission) {
 
14755                if (!isset($options[$permission])) {
 
14756                     $this->Error(
'Incorrect permission: '.$permission);
 
14758                if ((
$mode > 0) OR ($options[$permission] <= 32)) {
 
14760                     if ($options[$permission] == 2) {
 
14762                          $protection += $options[$permission];
 
14764                          $protection -= $options[$permission];
 
14768           return $protection;
 
14785      public function SetProtection($permissions=array(
'print', 
'modify', 
'copy', 
'annot-forms', 
'fill-forms', 
'extract', 
'assemble', 
'print-high'), $user_pass=
'', $owner_pass=null, 
$mode=0, $pubkeys=null) {
 
14786           if ($this->pdfa_mode) {
 
14790           $this->encryptdata[
'protection'] = $this->getUserPermissionCode($permissions, 
$mode);
 
14791           if (($pubkeys !== null) AND (is_array($pubkeys))) {
 
14793                $this->encryptdata[
'pubkeys'] = $pubkeys;
 
14798                if (!function_exists(
'openssl_pkcs7_encrypt')) {
 
14799                     $this->Error(
'Public-Key Security requires openssl library.');
 
14802                $this->encryptdata[
'pubkey'] = 
true;
 
14803                $this->encryptdata[
'Filter'] = 
'Adobe.PubSec';
 
14804                $this->encryptdata[
'StmF'] = 
'DefaultCryptFilter';
 
14805                $this->encryptdata[
'StrF'] = 
'DefaultCryptFilter';
 
14808                $this->encryptdata[
'pubkey'] = 
false;
 
14809                $this->encryptdata[
'Filter'] = 
'Standard';
 
14810                $this->encryptdata[
'StmF'] = 
'StdCF';
 
14811                $this->encryptdata[
'StrF'] = 
'StdCF';
 
14814                if (!extension_loaded(
'mcrypt')) {
 
14815                     $this->Error(
'AES encryption requires mcrypt library (http://www.php.net/manual/en/mcrypt.requirements.php).');
 
14817                if (mcrypt_get_cipher_name(MCRYPT_RIJNDAEL_128) === 
false) {
 
14818                     $this->Error(
'AES encryption requires MCRYPT_RIJNDAEL_128 cypher.');
 
14820                if ((
$mode == 3) AND !function_exists(
'hash')) {
 
14822                     $this->Error(
'AES 256 encryption requires HASH Message Digest Framework (http://www.php.net/manual/en/book.hash.php).');
 
14825           if ($owner_pass === null) {
 
14826                $owner_pass = md5($this->getRandomSeed());
 
14828           $this->encryptdata[
'user_password'] = $user_pass;
 
14829           $this->encryptdata[
'owner_password'] = $owner_pass;
 
14830           $this->encryptdata[
'mode'] = 
$mode;
 
14833                     $this->encryptdata[
'V'] = 1;
 
14834                     $this->encryptdata[
'Length'] = 40;
 
14835                     $this->encryptdata[
'CF'][
'CFM'] = 
'V2';
 
14839                     $this->encryptdata[
'V'] = 2;
 
14840                     $this->encryptdata[
'Length'] = 128;
 
14841                     $this->encryptdata[
'CF'][
'CFM'] = 
'V2';
 
14842                     if ($this->encryptdata[
'pubkey']) {
 
14843                          $this->encryptdata[
'SubFilter'] = 
'adbe.pkcs7.s4';
 
14844                          $this->encryptdata[
'Recipients'] = array();
 
14849                     $this->encryptdata[
'V'] = 4;
 
14850                     $this->encryptdata[
'Length'] = 128;
 
14851                     $this->encryptdata[
'CF'][
'CFM'] = 
'AESV2';
 
14852                     $this->encryptdata[
'CF'][
'Length'] = 128;
 
14853                     if ($this->encryptdata[
'pubkey']) {
 
14854                          $this->encryptdata[
'SubFilter'] = 
'adbe.pkcs7.s5';
 
14855                          $this->encryptdata[
'Recipients'] = array();
 
14860                     $this->encryptdata[
'V'] = 5;
 
14861                     $this->encryptdata[
'Length'] = 256;
 
14862                     $this->encryptdata[
'CF'][
'CFM'] = 
'AESV3';
 
14863                     $this->encryptdata[
'CF'][
'Length'] = 256;
 
14864                     if ($this->encryptdata[
'pubkey']) {
 
14865                          $this->encryptdata[
'SubFilter'] = 
'adbe.pkcs7.s5';
 
14866                          $this->encryptdata[
'Recipients'] = array();
 
14871           $this->encrypted = 
true;
 
14872           $this->encryptdata[
'fileid'] = $this->convertHexStringToString($this->file_id);
 
14873           $this->_generateencryptionkey();
 
14886           $bslength = strlen($bs);
 
14887           if (($bslength % 2) != 0) {
 
14892           for (
$i = 0; 
$i < $bslength; 
$i += 2) {
 
14893                $string .= chr(hexdec($bs[
$i].$bs[(
$i + 1)]));
 
14908           $chars = preg_split(
'//', $s, -1, PREG_SPLIT_NO_EMPTY);
 
14909           foreach ($chars as $c) {
 
14910                $bs .= sprintf(
'%02s', dechex(ord($c)));
 
14924           $binprot = sprintf(
'%032b', $protection);
 
14925           $str = chr(bindec(substr($binprot, 24, 8)));
 
14926           $str .= chr(bindec(substr($binprot, 16, 8)));
 
14927           $str .= chr(bindec(substr($binprot, 8, 8)));
 
14928           $str .= chr(bindec(substr($binprot, 0, 8)));
 
14945           if ($this->state != 2) {
 
14949           if ($this->inxobj) {
 
14951                $this->xobjects[$this->xobjid][
'transfmrk'][] = strlen($this->xobjects[$this->xobjid][
'outdata']);
 
14953                $this->transfmrk[$this->page][] = $this->pagelen[$this->page];
 
14955           ++$this->transfmatrix_key;
 
14956           $this->transfmatrix[$this->transfmatrix_key] = array();
 
14968           if ($this->state != 2) {
 
14972           if (isset($this->transfmatrix[$this->transfmatrix_key])) {
 
14973                array_pop($this->transfmatrix[$this->transfmatrix_key]);
 
14974                --$this->transfmatrix_key;
 
14976           if ($this->inxobj) {
 
14978                array_pop($this->xobjects[$this->xobjid][
'transfmrk']);
 
14980                array_pop($this->transfmrk[$this->page]);
 
14993           $this->Scale($s_x, 100, $x, $y);
 
15006           $this->Scale(100, $s_y, $x, $y);
 
15019           $this->Scale($s, $s, $x, $y);
 
15032      public function Scale($s_x, $s_y, $x=
'', $y=
'') {
 
15039           if (($s_x == 0) OR ($s_y == 0)) {
 
15040                $this->Error(
'Please do not use values equal to zero for scaling');
 
15042           $y = ($this->h - $y) * $this->k;
 
15052           $tm[4] = $x * (1 - $s_x);
 
15053           $tm[5] = $y * (1 - $s_y);
 
15055           $this->Transform($tm);
 
15066           $this->Scale(-100, 100, $x);
 
15077           $this->Scale(100, -100, 
'', $y);
 
15089           $this->Scale(-100, -100, $x, $y);
 
15102           $this->Scale(-100, 100, $x, $y);
 
15103           $this->Rotate(-2*($angle-90), $x, $y);
 
15114           $this->Translate($t_x, 0);
 
15125           $this->Translate(0, $t_y);
 
15143           $tm[4] = $t_x * $this->k;
 
15144           $tm[5] = -$t_y * $this->k;
 
15146           $this->Transform($tm);
 
15165           $y = ($this->h - $y) * $this->k;
 
15169           $tm[0] = cos(deg2rad($angle));
 
15170           $tm[1] = sin(deg2rad($angle));
 
15173           $tm[4] = $x + ($tm[1] * $y) - ($tm[0] * $x);
 
15174           $tm[5] = $y - ($tm[0] * $y) - ($tm[1] * $x);
 
15176           $this->Transform($tm);
 
15188      public function SkewX($angle_x, $x=
'', $y=
'') {
 
15189           $this->Skew($angle_x, 0, $x, $y);
 
15201      public function SkewY($angle_y, $x=
'', $y=
'') {
 
15202           $this->Skew(0, $angle_y, $x, $y);
 
15215      public function Skew($angle_x, $angle_y, $x=
'', $y=
'') {
 
15222           if (($angle_x <= -90) OR ($angle_x >= 90) OR ($angle_y <= -90) OR ($angle_y >= 90)) {
 
15223                $this->Error(
'Please use values between -90 and +90 degrees for Skewing.');
 
15226           $y = ($this->h - $y) * $this->k;
 
15230           $tm[1] = tan(deg2rad($angle_y));
 
15231           $tm[2] = tan(deg2rad($angle_x));
 
15233           $tm[4] = -$tm[2] * $y;
 
15234           $tm[5] = -$tm[1] * $x;
 
15236           $this->Transform($tm);
 
15247           if ($this->state != 2) {
 
15250           $this->_out(sprintf(
'%F %F %F %F %F %F cm', $tm[0], $tm[1], $tm[2], $tm[3], $tm[4], $tm[5]));
 
15252           $this->transfmatrix[$this->transfmatrix_key][] = array(
'a' => $tm[0], 
'b' => $tm[1], 
'c' => $tm[2], 
'd' => $tm[3], 
'e' => $tm[4], 
'f' => $tm[5]);
 
15254           if ($this->inxobj) {
 
15256                if (end($this->xobjects[$this->xobjid][
'transfmrk']) !== 
false) {
 
15257                     $key = key($this->xobjects[$this->xobjid][
'transfmrk']);
 
15258                     $this->xobjects[$this->xobjid][
'transfmrk'][$key] = strlen($this->xobjects[$this->xobjid][
'outdata']);
 
15260           } 
elseif (end($this->transfmrk[$this->page]) !== 
false) {
 
15261                $key = key($this->transfmrk[$this->page]);
 
15262                $this->transfmrk[$this->page][$key] = $this->pagelen[$this->page];
 
15280           $this->LineWidth = $width;
 
15281           $this->linestyleWidth = sprintf(
'%F w', ($width * $this->k));
 
15282           if ($this->state == 2) {
 
15283                $this->_out($this->linestyleWidth);
 
15295           return $this->LineWidth;
 
15323           if (!is_array($style)) {
 
15326           if (isset($style[
'width'])) {
 
15327                $this->LineWidth = $style[
'width'];
 
15328                $this->linestyleWidth = sprintf(
'%F w', ($style[
'width'] * $this->k));
 
15329                $s .= $this->linestyleWidth.
' ';
 
15331           if (isset($style[
'cap'])) {
 
15332                $ca = array(
'butt' => 0, 
'round'=> 1, 
'square' => 2);
 
15333                if (isset($ca[$style[
'cap']])) {
 
15334                     $this->linestyleCap = $ca[$style[
'cap']].
' J';
 
15335                     $s .= $this->linestyleCap.
' ';
 
15338           if (isset($style[
'join'])) {
 
15339                $ja = array(
'miter' => 0, 
'round' => 1, 
'bevel' => 2);
 
15340                if (isset($ja[$style[
'join']])) {
 
15341                     $this->linestyleJoin = $ja[$style[
'join']].
' j';
 
15342                     $s .= $this->linestyleJoin.
' ';
 
15345           if (isset($style[
'dash'])) {
 
15347                if ($style[
'dash']) {
 
15348                     if (preg_match(
'/^.+,/', $style[
'dash']) > 0) {
 
15349                          $tab = explode(
',', $style[
'dash']);
 
15351                          $tab = array($style[
'dash']);
 
15354                     foreach ($tab as 
$i => $v) {
 
15356                               $dash_string .= 
' ';
 
15358                          $dash_string .= sprintf(
'%F', $v);
 
15361                if (!isset($style[
'phase']) OR !$style[
'dash']) {
 
15362                     $style[
'phase'] = 0;
 
15364                $this->linestyleDash = sprintf(
'[%s] %F d', $dash_string, $style[
'phase']);
 
15365                $s .= $this->linestyleDash.
' ';
 
15367           if (isset($style[
'color'])) {
 
15368                $s .= $this->SetDrawColorArray($style[
'color'], 
true).
' ';
 
15370           if (!$ret AND ($this->state == 2)) {
 
15384           if ($this->state == 2) {
 
15385                $this->_out(sprintf(
'%F %F m', ($x * $this->k), (($this->h - $y) * $this->k)));
 
15398           if ($this->state == 2) {
 
15399                $this->_out(sprintf(
'%F %F l', ($x * $this->k), (($this->h - $y) * $this->k)));
 
15414           if ($this->state == 2) {
 
15415                $this->_out(sprintf(
'%F %F %F %F re %s', $x * $this->k, ($this->h - $y) * $this->k, $w * $this->k, -$h * $this->k, $op));
 
15432           if ($this->state == 2) {
 
15433                $this->_out(sprintf(
'%F %F %F %F %F %F c', $x1 * $this->k, ($this->h - $y1) * $this->k, $x2 * $this->k, ($this->h - $y2) * $this->k, $x3 * $this->k, ($this->h - $y3) * $this->k));
 
15448           if ($this->state == 2) {
 
15449                $this->_out(sprintf(
'%F %F %F %F v', $x2 * $this->k, ($this->h - $y2) * $this->k, $x3 * $this->k, ($this->h - $y3) * $this->k));
 
15464           if ($this->state == 2) {
 
15465                $this->_out(sprintf(
'%F %F %F %F y', $x1 * $this->k, ($this->h - $y1) * $this->k, $x3 * $this->k, ($this->h - $y3) * $this->k));
 
15480      public function Line($x1, $y1, $x2, $y2, $style=array()) {
 
15481           if ($this->state != 2) {
 
15484           if (is_array($style)) {
 
15485                $this->SetLineStyle($style);
 
15487           $this->_outPoint($x1, $y1);
 
15488           $this->_outLine($x2, $y2);
 
15510      public function Rect($x, $y, $w, $h, $style=
'', $border_style=array(), $fill_color=array()) {
 
15511           if ($this->state != 2) {
 
15514           if (!(
false === strpos($style, 
'F')) AND !empty($fill_color)) {
 
15515                $this->SetFillColorArray($fill_color);
 
15517           $op = $this->getPathPaintOperator($style);
 
15518           if ((!$border_style) OR (isset($border_style[
'all']))) {
 
15519                if (isset($border_style[
'all']) AND $border_style[
'all']) {
 
15520                     $this->SetLineStyle($border_style[
'all']);
 
15521                     $border_style = array();
 
15524           $this->_outRect($x, $y, $w, $h, $op);
 
15525           if ($border_style) {
 
15526                $border_style2 = array();
 
15527                foreach ($border_style as $line => $value) {
 
15528                     $length = strlen($line);
 
15529                     for (
$i = 0; 
$i < $length; ++
$i) {
 
15530                          $border_style2[$line[
$i]] = $value;
 
15533                $border_style = $border_style2;
 
15534                if (isset($border_style[
'L']) AND $border_style[
'L']) {
 
15535                     $this->Line($x, $y, $x, $y + $h, $border_style[
'L']);
 
15537                if (isset($border_style[
'T']) AND $border_style[
'T']) {
 
15538                     $this->Line($x, $y, $x + $w, $y, $border_style[
'T']);
 
15540                if (isset($border_style[
'R']) AND $border_style[
'R']) {
 
15541                     $this->Line($x + $w, $y, $x + $w, $y + $h, $border_style[
'R']);
 
15543                if (isset($border_style[
'B']) AND $border_style[
'B']) {
 
15544                     $this->Line($x, $y + $h, $x + $w, $y + $h, $border_style[
'B']);
 
15568      public function Curve($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3, $style=
'', $line_style=array(), $fill_color=array()) {
 
15569           if ($this->state != 2) {
 
15572           if (!(
false === strpos($style, 
'F')) AND isset($fill_color)) {
 
15573                $this->SetFillColorArray($fill_color);
 
15575           $op = $this->getPathPaintOperator($style);
 
15577                $this->SetLineStyle($line_style);
 
15579           $this->_outPoint($x0, $y0);
 
15580           $this->_outCurve($x1, $y1, $x2, $y2, $x3, $y3);
 
15598      public function Polycurve($x0, $y0, $segments, $style=
'', $line_style=array(), $fill_color=array()) {
 
15599           if ($this->state != 2) {
 
15602           if (!(
false === strpos($style, 
'F')) AND isset($fill_color)) {
 
15603                $this->SetFillColorArray($fill_color);
 
15605           $op = $this->getPathPaintOperator($style);
 
15607                $line_style = array();
 
15610                $this->SetLineStyle($line_style);
 
15612           $this->_outPoint($x0, $y0);
 
15613           foreach ($segments as $segment) {
 
15614                list($x1, $y1, $x2, $y2, $x3, $y3) = $segment;
 
15615                $this->_outCurve($x1, $y1, $x2, $y2, $x3, $y3);
 
15638      public function Ellipse($x0, $y0, $rx, $ry=
'', $angle=0, $astart=0, $afinish=360, $style=
'', $line_style=array(), $fill_color=array(), $nc=2) {
 
15639           if ($this->state != 2) {
 
15642           if ($this->empty_string($ry) OR ($ry == 0)) {
 
15645           if (!(
false === strpos($style, 
'F')) AND isset($fill_color)) {
 
15646                $this->SetFillColorArray($fill_color);
 
15648           $op = $this->getPathPaintOperator($style);
 
15650                $line_style = array();
 
15653                $this->SetLineStyle($line_style);
 
15655           $this->_outellipticalarc($x0, $y0, $rx, $ry, $angle, $astart, $afinish, 
false, $nc, 
true, 
true, 
false);
 
15679      protected function _outellipticalarc($xc, $yc, $rx, $ry, $xang=0, $angs=0, $angf=360, $pie=
false, $nc=2, $startpoint=
true, $ccw=
true, $svg=
false) {
 
15684           $xmin = 2147483647;
 
15685           $ymin = 2147483647;
 
15690                $this->_outPoint($xc, $yc);
 
15692           $xang = deg2rad((
float) $xang);
 
15693           $angs = deg2rad((
float) $angs);
 
15694           $angf = deg2rad((
float) $angf);
 
15699                $as = atan2((sin($angs) / $ry), (cos($angs) / $rx));
 
15700                $af = atan2((sin($angf) / $ry), (cos($angf) / $rx));
 
15708           if ($ccw AND ($as > $af)) {
 
15711           } 
elseif (!$ccw AND ($as < $af)) {
 
15715           $total_angle = ($af - $as);
 
15720           $nc *= (2 * abs($total_angle) / M_PI);
 
15721           $nc = round($nc) + 1;
 
15723           $arcang = ($total_angle / $nc);
 
15726           $y0 = ($this->h - $yc);
 
15729           $alpha = sin($arcang) * ((sqrt(4 + (3 * pow(tan(($arcang) / 2), 2))) - 1) / 3);
 
15730           $cos_xang = cos($xang);
 
15731           $sin_xang = sin($xang);
 
15732           $cos_ang = cos($ang);
 
15733           $sin_ang = sin($ang);
 
15735           $px1 = $x0 + ($rx * $cos_xang * $cos_ang) - ($ry * $sin_xang * $sin_ang);
 
15736           $py1 = $y0 + ($rx * $sin_xang * $cos_ang) + ($ry * $cos_xang * $sin_ang);
 
15738           $qx1 = ($alpha * ((-$rx * $cos_xang * $sin_ang) - ($ry * $sin_xang * $cos_ang)));
 
15739           $qy1 = ($alpha * ((-$rx * $sin_xang * $sin_ang) + ($ry * $cos_xang * $cos_ang)));
 
15742                $this->_outLine($px1, $this->h - $py1);
 
15743           } 
elseif ($startpoint) {
 
15745                $this->_outPoint($px1, $this->h - $py1);
 
15748           for (
$i = 1; 
$i <= $nc; ++
$i) {
 
15750                $ang = $as + (
$i * $arcang);
 
15754                $cos_ang = cos($ang);
 
15755                $sin_ang = sin($ang);
 
15757                $px2 = $x0 + ($rx * $cos_xang * $cos_ang) - ($ry * $sin_xang * $sin_ang);
 
15758                $py2 = $y0 + ($rx * $sin_xang * $cos_ang) + ($ry * $cos_xang * $sin_ang);
 
15760                $qx2 = ($alpha * ((-$rx * $cos_xang * $sin_ang) - ($ry * $sin_xang * $cos_ang)));
 
15761                $qy2 = ($alpha * ((-$rx * $sin_xang * $sin_ang) + ($ry * $cos_xang * $cos_ang)));
 
15763                $cx1 = ($px1 + $qx1);
 
15764                $cy1 = ($this->h - ($py1 + $qy1));
 
15765                $cx2 = ($px2 - $qx2);
 
15766                $cy2 = ($this->h - ($py2 - $qy2));
 
15768                $cy3 = ($this->h - $py2);
 
15769                $this->_outCurve($cx1, $cy1, $cx2, $cy2, $cx3, $cy3);
 
15771                $xmin = min($xmin, $cx1, $cx2, $cx3);
 
15772                $ymin = min($ymin, $cy1, $cy2, $cy3);
 
15773                $xmax = max($xmax, $cx1, $cx2, $cx3);
 
15774                $ymax = max($ymax, $cy1, $cy2, $cy3);
 
15782                $this->_outLine($xc, $yc);
 
15784                $xmin = min($xmin, $xc);
 
15785                $ymin = min($ymin, $yc);
 
15786                $xmax = max($xmax, $xc);
 
15787                $ymax = max($ymax, $yc);
 
15789           return array($xmin, $ymin, $xmax, $ymax);
 
15807      public function Circle($x0, $y0, $r, $angstr=0, $angend=360, $style=
'', $line_style=array(), $fill_color=array(), $nc=2) {
 
15808           $this->Ellipse($x0, $y0, $r, $r, 0, $angstr, $angend, $style, $line_style, $fill_color, $nc);
 
15825      public function PolyLine($p, $style=
'', $line_style=array(), $fill_color=array()) {
 
15826           $this->Polygon($p, $style, $line_style, $fill_color, 
false);
 
15844      public function Polygon($p, $style=
'', $line_style=array(), $fill_color=array(), $closed=
true) {
 
15845           if ($this->state != 2) {
 
15852                for (
$i = 0; 
$i < 4; ++
$i) {
 
15853                     $p[$nc + 
$i] = $p[
$i];
 
15856                if (isset($line_style[0])) {
 
15857                     $line_style[$np] = $line_style[0];
 
15861           if (!(
false === strpos($style, 
'F')) AND isset($fill_color)) {
 
15862                $this->SetFillColorArray($fill_color);
 
15864           $op = $this->getPathPaintOperator($style);
 
15866                $line_style = array();
 
15870                if (isset($line_style[
'all'])) {
 
15871                     $this->SetLineStyle($line_style[
'all']);
 
15877                          $this->_outPoint($p[0], $p[1]);
 
15878                          for (
$i = 2; 
$i < $nc; 
$i = 
$i + 2) {
 
15879                               $this->_outLine($p[
$i], $p[$i + 1]);
 
15884                     $this->_outPoint($p[0], $p[1]);
 
15885                     for (
$i = 2; 
$i < $nc; 
$i = 
$i + 2) {
 
15886                          $line_num = (
$i / 2) - 1;
 
15887                          if (isset($line_style[$line_num])) {
 
15888                               if ($line_style[$line_num] != 0) {
 
15889                                    if (is_array($line_style[$line_num])) {
 
15891                                         $this->SetLineStyle($line_style[$line_num]);
 
15892                                         $this->_outPoint($p[
$i - 2], $p[
$i - 1]);
 
15893                                         $this->_outLine($p[
$i], $p[$i + 1]);
 
15895                                         $this->_outPoint($p[$i], $p[$i + 1]);
 
15897                                         $this->_outLine($p[
$i], $p[$i + 1]);
 
15901                               $this->_outLine($p[
$i], $p[$i + 1]);
 
15908                $this->_outPoint($p[0], $p[1]);
 
15909                for (
$i = 2; 
$i < $nc; 
$i = 
$i + 2) {
 
15910                     $this->_outLine($p[
$i], $p[$i + 1]);
 
15945      public function RegularPolygon($x0, $y0, $r, $ns, $angle=0, $draw_circle=
false, $style=
'', $line_style=array(), $fill_color=array(), $circle_style=
'', $circle_outLine_style=array(), $circle_fill_color=array()) {
 
15949           if ($draw_circle) {
 
15950                $this->Circle($x0, $y0, $r, 0, 360, $circle_style, $circle_outLine_style, $circle_fill_color);
 
15953           for (
$i = 0; 
$i < $ns; ++
$i) {
 
15954                $a = $angle + (
$i * 360 / $ns);
 
15955                $a_rad = deg2rad((
float) $a);
 
15956                $p[] = $x0 + ($r * sin($a_rad));
 
15957                $p[] = $y0 + ($r * cos($a_rad));
 
15959           $this->Polygon($p, $style, $line_style, $fill_color);
 
15993      public function StarPolygon($x0, $y0, $r, $nv, $ng, $angle=0, $draw_circle=
false, $style=
'', $line_style=array(), $fill_color=array(), $circle_style=
'', $circle_outLine_style=array(), $circle_fill_color=array()) {
 
15997           if ($draw_circle) {
 
15998                $this->Circle($x0, $y0, $r, 0, 360, $circle_style, $circle_outLine_style, $circle_fill_color);
 
16001           $visited = array();
 
16002           for (
$i = 0; 
$i < $nv; ++
$i) {
 
16003                $a = $angle + (
$i * 360 / $nv);
 
16004                $a_rad = deg2rad((
float) $a);
 
16005                $p2[] = $x0 + ($r * sin($a_rad));
 
16006                $p2[] = $y0 + ($r * cos($a_rad));
 
16007                $visited[] = 
false;
 
16012                $p[] = $p2[
$i * 2];
 
16013                $p[] = $p2[(
$i * 2) + 1];
 
16014                $visited[
$i] = 
true;
 
16017           } 
while (!$visited[
$i]);
 
16018           $this->Polygon($p, $style, $line_style, $fill_color);
 
16035      public function RoundedRect($x, $y, $w, $h, $r, $round_corner=
'1111', $style=
'', $border_style=array(), $fill_color=array()) {
 
16036           $this->RoundedRectXY($x, $y, $w, $h, $r, $r, $round_corner, $style, $border_style, $fill_color);
 
16054      public function RoundedRectXY($x, $y, $w, $h, $rx, $ry, $round_corner=
'1111', $style=
'', $border_style=array(), $fill_color=array()) {
 
16055           if ($this->state != 2) {
 
16058           if (($round_corner == 
'0000') OR (($rx == $ry) AND ($rx == 0))) {
 
16060                $this->Rect($x, $y, $w, $h, $style, $border_style, $fill_color);
 
16064           if (!(
false === strpos($style, 
'F')) AND isset($fill_color)) {
 
16065                $this->SetFillColorArray($fill_color);
 
16067           $op = $this->getPathPaintOperator($style);
 
16069                $border_style = array();
 
16071           if ($border_style) {
 
16072                $this->SetLineStyle($border_style);
 
16074           $MyArc = 4 / 3 * (sqrt(2) - 1);
 
16075           $this->_outPoint($x + $rx, $y);
 
16076           $xc = $x + $w - $rx;
 
16078           $this->_outLine($xc, $y);
 
16079           if ($round_corner[0]) {
 
16080                $this->_outCurve($xc + ($rx * $MyArc), $yc - $ry, $xc + $rx, $yc - ($ry * $MyArc), $xc + $rx, $yc);
 
16082                $this->_outLine($x + $w, $y);
 
16084           $xc = $x + $w - $rx;
 
16085           $yc = $y + $h - $ry;
 
16086           $this->_outLine($x + $w, $yc);
 
16087           if ($round_corner[1]) {
 
16088                $this->_outCurve($xc + $rx, $yc + ($ry * $MyArc), $xc + ($rx * $MyArc), $yc + $ry, $xc, $yc + $ry);
 
16090                $this->_outLine($x + $w, $y + $h);
 
16093           $yc = $y + $h - $ry;
 
16094           $this->_outLine($xc, $y + $h);
 
16095           if ($round_corner[2]) {
 
16096                $this->_outCurve($xc - ($rx * $MyArc), $yc + $ry, $xc - $rx, $yc + ($ry * $MyArc), $xc - $rx, $yc);
 
16098                $this->_outLine($x, $y + $h);
 
16102           $this->_outLine($x, $yc);
 
16103           if ($round_corner[3]) {
 
16104                $this->_outCurve($xc - $rx, $yc - ($ry * $MyArc), $xc - ($rx * $MyArc), $yc - $ry, $xc, $yc - $ry);
 
16106                $this->_outLine($x, $y);
 
16107                $this->_outLine($x + $rx, $y);
 
16124      public function Arrow($x0, $y0, $x1, $y1, $head_style=0, $arm_size=5, $arm_angle=15) {
 
16127           $dir_angle = atan2(($y0 - $y1), ($x0 - $x1));
 
16128           if ($dir_angle < 0) {
 
16129                $dir_angle += (2 * M_PI);
 
16131           $arm_angle = deg2rad($arm_angle);
 
16134           if ($head_style > 0) {
 
16136                $sx1 = $x1 + (($arm_size - $this->LineWidth) * cos($dir_angle));
 
16137                $sy1 = $y1 + (($arm_size - $this->LineWidth) * sin($dir_angle));
 
16140           $this->Line($x0, $y0, $sx1, $sy1);
 
16142           $x2L = $x1 + ($arm_size * cos($dir_angle + $arm_angle));
 
16143           $y2L = $y1 + ($arm_size * sin($dir_angle + $arm_angle));
 
16145           $x2R = $x1 + ($arm_size * cos($dir_angle - $arm_angle));
 
16146           $y2R = $y1 + ($arm_size * sin($dir_angle - $arm_angle));
 
16149           switch ($head_style) {
 
16153                     $style = array(1, 1, 0);
 
16172           $this->Polygon(array($x2L, $y2L, $x1, $y1, $x2R, $y2R), $mode, $style, array());
 
16189      protected function utf8StrRev($str, $setbom=
false, $forcertl=
false) {
 
16190           return $this->utf8StrArrRev($this->UTF8StringToArray($str), $str, $setbom, $forcertl);
 
16205           return $this->arrUTF8ToUTF16BE($this->utf8Bidi($arr, $str, $forcertl), $setbom);
 
16218      protected function utf8Bidi($ta, $str=
'', $forcertl=
false) {
 
16223           if ($this->empty_string($str)) {
 
16225                $str = $this->UTF8ArrSubString($ta);
 
16228           if (preg_match($this->unicode->uni_RE_PATTERN_ARABIC, $str)) {
 
16234           if (!($forcertl OR $arabic OR preg_match($this->unicode->uni_RE_PATTERN_RTL, $str))) {
 
16239           $numchars = count($ta);
 
16241           if ($forcertl == 
'R') {
 
16243           } 
elseif ($forcertl == 
'L') {
 
16248                for (
$i=0; 
$i < $numchars; ++
$i) {
 
16249                     $type = $this->unicode->uni_type[$ta[
$i]];
 
16250                     if ($type == 
'L') {
 
16253                     } 
elseif (($type == 
'AL') OR ($type == 
'R')) {
 
16264           $remember = array();
 
16266           $sor = $pel % 2 ? 
'R' : 
'L';
 
16270           $chardata = Array();
 
16274           for (
$i=0; 
$i < $numchars; ++
$i) {
 
16275                if ($ta[
$i] == $this->unicode->uni_RLE) {
 
16279                     $next_level = $cel + ($cel % 2) + 1;
 
16280                     if ($next_level < 62) {
 
16281                          $remember[] = array(
'num' => $this->unicode->uni_RLE, 
'cel' => $cel, 
'dos' => $dos);
 
16282                          $cel = $next_level;
 
16285                          $eor = $cel % 2 ? 
'R' : 
'L';
 
16287                } 
elseif ($ta[
$i] == $this->unicode->uni_LRE) {
 
16291                     $next_level = $cel + 2 - ($cel % 2);
 
16292                     if ( $next_level < 62 ) {
 
16293                          $remember[] = array(
'num' => $this->unicode->uni_LRE, 
'cel' => $cel, 
'dos' => $dos);
 
16294                          $cel = $next_level;
 
16297                          $eor = $cel % 2 ? 
'R' : 
'L';
 
16299                } 
elseif ($ta[
$i] == $this->unicode->uni_RLO) {
 
16303                     $next_level = $cel + ($cel % 2) + 1;
 
16304                     if ($next_level < 62) {
 
16305                          $remember[] = array(
'num' => $this->unicode->uni_RLO, 
'cel' => $cel, 
'dos' => $dos);
 
16306                          $cel = $next_level;
 
16309                          $eor = $cel % 2 ? 
'R' : 
'L';
 
16311                } 
elseif ($ta[
$i] == $this->unicode->uni_LRO) {
 
16315                     $next_level = $cel + 2 - ($cel % 2);
 
16316                     if ( $next_level < 62 ) {
 
16317                          $remember[] = array(
'num' => $this->unicode->uni_LRO, 
'cel' => $cel, 
'dos' => $dos);
 
16318                          $cel = $next_level;
 
16321                          $eor = $cel % 2 ? 
'R' : 
'L';
 
16323                } 
elseif ($ta[
$i] == $this->unicode->uni_PDF) {
 
16325                     if (count($remember)) {
 
16326                          $last = count($remember ) - 1;
 
16327                          if (($remember[$last][
'num'] == $this->unicode->uni_RLE) OR
 
16328                               ($remember[$last][
'num'] == $this->unicode->uni_LRE) OR
 
16329                               ($remember[$last][
'num'] == $this->unicode->uni_RLO) OR
 
16330                               ($remember[$last][
'num'] == $this->unicode->uni_LRO)) {
 
16331                               $match = array_pop($remember);
 
16335                               $eor = ($cel > 
$match[
'cel'] ? $cel : 
$match[
'cel']) % 2 ? 
'R' : 
'L';
 
16338                } 
elseif (($ta[
$i] != $this->unicode->uni_RLE) AND
 
16339                                     ($ta[
$i] != $this->unicode->uni_LRE) AND
 
16340                                     ($ta[
$i] != $this->unicode->uni_RLO) AND
 
16341                                     ($ta[
$i] != $this->unicode->uni_LRO) AND
 
16342                                     ($ta[
$i] != $this->unicode->uni_PDF)) {
 
16349                          if (isset($this->unicode->uni_type[$ta[
$i]])) {
 
16350                               $chardir = $this->unicode->uni_type[$ta[
$i]];
 
16356                     $chardata[] = array(
'char' => $ta[
$i], 
'level' => $cel, 
'type' => $chardir, 
'sor' => $sor, 
'eor' => $eor);
 
16367           $numchars = count($chardata);
 
16372           for (
$i=0; 
$i < $numchars; ++
$i) {
 
16373                if ($chardata[
$i][
'type'] == 
'NSM') {
 
16375                          $chardata[
$i][
'type'] = $chardata[
$i][
'sor'];
 
16377                          $chardata[
$i][
'type'] = $chardata[(
$i-1)][
'type'];
 
16380                if ($chardata[
$i][
'level'] != $prevlevel) {
 
16385                $prevlevel = $chardata[
$i][
'level'];
 
16391           for (
$i=0; 
$i < $numchars; ++
$i) {
 
16392                if ($chardata[
$i][
'char'] == 
'EN') {
 
16393                     for ($j=$levcount; $j >= 0; $j--) {
 
16394                          if ($chardata[$j][
'type'] == 
'AL') {
 
16395                               $chardata[
$i][
'type'] = 
'AN';
 
16396                          } 
elseif (($chardata[$j][
'type'] == 
'L') OR ($chardata[$j][
'type'] == 
'R')) {
 
16401                if ($chardata[
$i][
'level'] != $prevlevel) {
 
16406                $prevlevel = $chardata[
$i][
'level'];
 
16410           for (
$i=0; 
$i < $numchars; ++
$i) {
 
16411                if ($chardata[
$i][
'type'] == 
'AL') {
 
16412                     $chardata[
$i][
'type'] = 
'R';
 
16419           for (
$i=0; 
$i < $numchars; ++
$i) {
 
16420                if (($levcount > 0) AND ((
$i+1) < $numchars) AND ($chardata[(
$i+1)][
'level'] == $prevlevel)) {
 
16421                     if (($chardata[
$i][
'type'] == 
'ES') AND ($chardata[(
$i-1)][
'type'] == 
'EN') AND ($chardata[(
$i+1)][
'type'] == 
'EN')) {
 
16422                          $chardata[
$i][
'type'] = 
'EN';
 
16423                     } 
elseif (($chardata[
$i][
'type'] == 
'CS') AND ($chardata[(
$i-1)][
'type'] == 
'EN') AND ($chardata[(
$i+1)][
'type'] == 
'EN')) {
 
16424                          $chardata[
$i][
'type'] = 
'EN';
 
16425                     } 
elseif (($chardata[
$i][
'type'] == 
'CS') AND ($chardata[(
$i-1)][
'type'] == 
'AN') AND ($chardata[(
$i+1)][
'type'] == 
'AN')) {
 
16426                          $chardata[
$i][
'type'] = 
'AN';
 
16429                if ($chardata[
$i][
'level'] != $prevlevel) {
 
16434                $prevlevel = $chardata[
$i][
'level'];
 
16440           for (
$i=0; 
$i < $numchars; ++
$i) {
 
16441                if ($chardata[
$i][
'type'] == 
'ET') {
 
16442                     if (($levcount > 0) AND ($chardata[(
$i-1)][
'type'] == 
'EN')) {
 
16443                          $chardata[
$i][
'type'] = 
'EN';
 
16446                          while (($j < $numchars) AND ($chardata[$j][
'level'] == $prevlevel)) {
 
16447                               if ($chardata[$j][
'type'] == 
'EN') {
 
16448                                    $chardata[
$i][
'type'] = 
'EN';
 
16450                               } 
elseif ($chardata[$j][
'type'] != 
'ET') {
 
16457                if ($chardata[
$i][
'level'] != $prevlevel) {
 
16462                $prevlevel = $chardata[
$i][
'level'];
 
16468           for (
$i=0; 
$i < $numchars; ++
$i) {
 
16469                if (($chardata[
$i][
'type'] == 
'ET') OR ($chardata[
$i][
'type'] == 
'ES') OR ($chardata[
$i][
'type'] == 
'CS')) {
 
16470                     $chardata[
$i][
'type'] = 
'ON';
 
16472                if ($chardata[
$i][
'level'] != $prevlevel) {
 
16477                $prevlevel = $chardata[
$i][
'level'];
 
16483           for (
$i=0; 
$i < $numchars; ++
$i) {
 
16484                if ($chardata[
$i][
'char'] == 
'EN') {
 
16485                     for ($j=$levcount; $j >= 0; $j--) {
 
16486                          if ($chardata[$j][
'type'] == 
'L') {
 
16487                               $chardata[
$i][
'type'] = 
'L';
 
16488                          } 
elseif ($chardata[$j][
'type'] == 
'R') {
 
16493                if ($chardata[
$i][
'level'] != $prevlevel) {
 
16498                $prevlevel = $chardata[
$i][
'level'];
 
16504           for (
$i=0; 
$i < $numchars; ++
$i) {
 
16505                if (($levcount > 0) AND ((
$i+1) < $numchars) AND ($chardata[(
$i+1)][
'level'] == $prevlevel)) {
 
16506                     if (($chardata[
$i][
'type'] == 
'N') AND ($chardata[(
$i-1)][
'type'] == 
'L') AND ($chardata[(
$i+1)][
'type'] == 
'L')) {
 
16507                          $chardata[
$i][
'type'] = 
'L';
 
16508                     } 
elseif (($chardata[
$i][
'type'] == 
'N') AND
 
16509                      (($chardata[(
$i-1)][
'type'] == 
'R') OR ($chardata[(
$i-1)][
'type'] == 
'EN') OR ($chardata[(
$i-1)][
'type'] == 
'AN')) AND
 
16510                      (($chardata[(
$i+1)][
'type'] == 
'R') OR ($chardata[(
$i+1)][
'type'] == 
'EN') OR ($chardata[(
$i+1)][
'type'] == 
'AN'))) {
 
16511                          $chardata[
$i][
'type'] = 
'R';
 
16512                     } 
elseif ($chardata[
$i][
'type'] == 
'N') {
 
16514                          $chardata[
$i][
'type'] = $chardata[
$i][
'sor'];
 
16516                } 
elseif (($levcount == 0) AND ((
$i+1) < $numchars) AND ($chardata[(
$i+1)][
'level'] == $prevlevel)) {
 
16518                     if (($chardata[
$i][
'type'] == 
'N') AND ($chardata[
$i][
'sor'] == 
'L') AND ($chardata[(
$i+1)][
'type'] == 
'L')) {
 
16519                          $chardata[
$i][
'type'] = 
'L';
 
16520                     } 
elseif (($chardata[
$i][
'type'] == 
'N') AND
 
16521                      (($chardata[
$i][
'sor'] == 
'R') OR ($chardata[
$i][
'sor'] == 
'EN') OR ($chardata[
$i][
'sor'] == 
'AN')) AND
 
16522                      (($chardata[(
$i+1)][
'type'] == 
'R') OR ($chardata[(
$i+1)][
'type'] == 
'EN') OR ($chardata[(
$i+1)][
'type'] == 
'AN'))) {
 
16523                          $chardata[
$i][
'type'] = 
'R';
 
16524                     } 
elseif ($chardata[
$i][
'type'] == 
'N') {
 
16526                          $chardata[
$i][
'type'] = $chardata[
$i][
'sor'];
 
16528                } 
elseif (($levcount > 0) AND (((
$i+1) == $numchars) OR ((
$i+1) < $numchars) AND ($chardata[(
$i+1)][
'level'] != $prevlevel))) {
 
16530                     if (($chardata[
$i][
'type'] == 
'N') AND ($chardata[(
$i-1)][
'type'] == 
'L') AND ($chardata[
$i][
'eor'] == 
'L')) {
 
16531                          $chardata[
$i][
'type'] = 
'L';
 
16532                     } 
elseif (($chardata[
$i][
'type'] == 
'N') AND
 
16533                      (($chardata[(
$i-1)][
'type'] == 
'R') OR ($chardata[(
$i-1)][
'type'] == 
'EN') OR ($chardata[(
$i-1)][
'type'] == 
'AN')) AND
 
16534                      (($chardata[
$i][
'eor'] == 
'R') OR ($chardata[
$i][
'eor'] == 
'EN') OR ($chardata[
$i][
'eor'] == 
'AN'))) {
 
16535                          $chardata[
$i][
'type'] = 
'R';
 
16536                     } 
elseif ($chardata[
$i][
'type'] == 
'N') {
 
16538                          $chardata[
$i][
'type'] = $chardata[
$i][
'sor'];
 
16540                } 
elseif ($chardata[
$i][
'type'] == 
'N') {
 
16542                     $chardata[
$i][
'type'] = $chardata[
$i][
'sor'];
 
16544                if ($chardata[
$i][
'level'] != $prevlevel) {
 
16549                $prevlevel = $chardata[
$i][
'level'];
 
16554           for (
$i=0; 
$i < $numchars; ++
$i) {
 
16555                $odd = $chardata[
$i][
'level'] % 2;
 
16557                     if (($chardata[
$i][
'type'] == 
'L') OR ($chardata[
$i][
'type'] == 
'AN') OR ($chardata[
$i][
'type'] == 
'EN')) {
 
16558                          $chardata[
$i][
'level'] += 1;
 
16561                     if ($chardata[
$i][
'type'] == 
'R') {
 
16562                          $chardata[
$i][
'level'] += 1;
 
16563                     } 
elseif (($chardata[
$i][
'type'] == 
'AN') OR ($chardata[
$i][
'type'] == 
'EN')) {
 
16564                          $chardata[
$i][
'level'] += 2;
 
16567                $maxlevel = max($chardata[
$i][
'level'],$maxlevel);
 
16575           for (
$i=0; 
$i < $numchars; ++
$i) {
 
16576                if (($chardata[
$i][
'type'] == 
'B') OR ($chardata[
$i][
'type'] == 
'S')) {
 
16577                     $chardata[
$i][
'level'] = $pel;
 
16578                } 
elseif ($chardata[
$i][
'type'] == 
'WS') {
 
16580                     while ($j < $numchars) {
 
16581                          if ((($chardata[$j][
'type'] == 
'B') OR ($chardata[$j][
'type'] == 
'S')) OR
 
16582                               (($j == ($numchars-1)) AND ($chardata[$j][
'type'] == 
'WS'))) {
 
16583                               $chardata[
$i][
'level'] = $pel;
 
16585                          } 
elseif ($chardata[$j][
'type'] != 
'WS') {
 
16596                $endedletter = array(1569,1570,1571,1572,1573,1575,1577,1583,1584,1585,1586,1608,1688);
 
16597                $alfletter = array(1570,1571,1573,1575);
 
16598                $chardata2 = $chardata;
 
16599                $laaletter = 
false;
 
16602                for (
$i=0; 
$i < $numchars; ++
$i) {
 
16603                     if (($this->unicode->uni_type[$chardata[
$i][
'char']] == 
'AL') OR ($chardata[
$i][
'char'] == 32) OR ($chardata[
$i][
'char'] == 8204)) {
 
16604                          $charAL[$x] = $chardata[
$i];
 
16605                          $charAL[$x][
'i'] = 
$i;
 
16606                          $chardata[
$i][
'x'] = $x;
 
16611                for (
$i=0; 
$i < $numchars; ++
$i) {
 
16612                     $thischar = $chardata[
$i];
 
16614                          $prevchar = $chardata[(
$i-1)];
 
16618                     if ((
$i+1) < $numchars) {
 
16619                          $nextchar = $chardata[(
$i+1)];
 
16623                     if ($this->unicode->uni_type[$thischar[
'char']] == 
'AL') {
 
16624                          $x = $thischar[
'x'];
 
16626                               $prevchar = $charAL[($x-1)];
 
16630                          if (($x+1) < $numAL) {
 
16631                               $nextchar = $charAL[($x+1)];
 
16636                          if (($prevchar !== 
false) AND ($prevchar[
'char'] == 1604) AND (in_array($thischar[
'char'], $alfletter))) {
 
16637                               $arabicarr = $this->unicode->uni_laa_array;
 
16640                                    $prevchar = $charAL[($x-2)];
 
16645                               $arabicarr = $this->unicode->uni_arabicsubst;
 
16646                               $laaletter = 
false;
 
16648                          if (($prevchar !== 
false) AND ($nextchar !== 
false) AND
 
16649                               (($this->unicode->uni_type[$prevchar[
'char']] == 
'AL') OR ($this->unicode->uni_type[$prevchar[
'char']] == 
'NSM')) AND
 
16650                               (($this->unicode->uni_type[$nextchar[
'char']] == 
'AL') OR ($this->unicode->uni_type[$nextchar[
'char']] == 
'NSM')) AND
 
16651                               ($prevchar[
'type'] == $thischar[
'type']) AND
 
16652                               ($nextchar[
'type'] == $thischar[
'type']) AND
 
16653                               ($nextchar[
'char'] != 1567)) {
 
16654                               if (in_array($prevchar[
'char'], $endedletter)) {
 
16655                                    if (isset($arabicarr[$thischar[
'char']][2])) {
 
16657                                         $chardata2[
$i][
'char'] = $arabicarr[$thischar[
'char']][2];
 
16660                                    if (isset($arabicarr[$thischar[
'char']][3])) {
 
16662                                         $chardata2[
$i][
'char'] = $arabicarr[$thischar[
'char']][3];
 
16665                          } 
elseif (($nextchar !== 
false) AND
 
16666                               (($this->unicode->uni_type[$nextchar[
'char']] == 
'AL') OR ($this->unicode->uni_type[$nextchar[
'char']] == 
'NSM')) AND
 
16667                               ($nextchar[
'type'] == $thischar[
'type']) AND
 
16668                               ($nextchar[
'char'] != 1567)) {
 
16669                               if (isset($arabicarr[$chardata[
$i][
'char']][2])) {
 
16671                                    $chardata2[
$i][
'char'] = $arabicarr[$thischar[
'char']][2];
 
16673                          } 
elseif ((($prevchar !== 
false) AND
 
16674                               (($this->unicode->uni_type[$prevchar[
'char']] == 
'AL') OR ($this->unicode->uni_type[$prevchar[
'char']] == 
'NSM')) AND
 
16675                               ($prevchar[
'type'] == $thischar[
'type'])) OR
 
16676                               (($nextchar !== 
false) AND ($nextchar[
'char'] == 1567))) {
 
16678                               if ((
$i > 1) AND ($thischar[
'char'] == 1607) AND
 
16679                                    ($chardata[
$i-1][
'char'] == 1604) AND
 
16680                                    ($chardata[
$i-2][
'char'] == 1604)) {
 
16683                                    $chardata2[
$i-2][
'char'] = 
false;
 
16684                                    $chardata2[
$i-1][
'char'] = 
false;
 
16685                                    $chardata2[
$i][
'char'] = 65010;
 
16687                                    if (($prevchar !== 
false) AND in_array($prevchar[
'char'], $endedletter)) {
 
16688                                         if (isset($arabicarr[$thischar[
'char']][0])) {
 
16690                                              $chardata2[
$i][
'char'] = $arabicarr[$thischar[
'char']][0];
 
16693                                         if (isset($arabicarr[$thischar[
'char']][1])) {
 
16695                                              $chardata2[
$i][
'char'] = $arabicarr[$thischar[
'char']][1];
 
16699                          } 
elseif (isset($arabicarr[$thischar[
'char']][0])) {
 
16701                               $chardata2[
$i][
'char'] = $arabicarr[$thischar[
'char']][0];
 
16706                               $chardata2[($charAL[($x-1)][
'i'])][
'char'] = 
false;
 
16714                for (
$i = 0; 
$i < ($numchars-1); ++
$i) {
 
16715                     if (($chardata2[
$i][
'char'] == 1617) AND (isset($this->unicode->uni_diacritics[($chardata2[
$i+1][
'char'])]))) {
 
16717                          if (isset($this->CurrentFont[
'cw'][($this->unicode->uni_diacritics[($chardata2[
$i+1][
'char'])])])) {
 
16718                               $chardata2[
$i][
'char'] = 
false;
 
16719                               $chardata2[
$i+1][
'char'] = $this->unicode->uni_diacritics[($chardata2[
$i+1][
'char'])];
 
16724                foreach ($chardata2 as $key => $value) {
 
16725                     if ($value[
'char'] === 
false) {
 
16726                          unset($chardata2[$key]);
 
16729                $chardata = array_values($chardata2);
 
16730                $numchars = count($chardata);
 
16738           for ($j=$maxlevel; $j > 0; $j--) {
 
16739                $ordarray = Array();
 
16742                for (
$i=0; 
$i < $numchars; ++
$i) {
 
16743                     if ($chardata[
$i][
'level'] >= $j) {
 
16745                          if (isset($this->unicode->uni_mirror[$chardata[
$i][
'char']])) {
 
16747                               $chardata[
$i][
'char'] = $this->unicode->uni_mirror[$chardata[
$i][
'char']];
 
16749                          $revarr[] = $chardata[
$i];
 
16752                               $revarr = array_reverse($revarr);
 
16753                               $ordarray = array_merge($ordarray, $revarr);
 
16757                          $ordarray[] = $chardata[
$i];
 
16761                     $revarr = array_reverse($revarr);
 
16762                     $ordarray = array_merge($ordarray, $revarr);
 
16764                $chardata = $ordarray;
 
16767           $ordarray = array();
 
16768           for (
$i=0; 
$i < $numchars; ++
$i) {
 
16769                $ordarray[] = $chardata[
$i][
'char'];
 
16771                $this->CurrentFont[
'subsetchars'][$chardata[
$i][
'char']] = 
true;
 
16774           $this->setFontSubBuffer($this->CurrentFont[
'fontkey'], 
'subsetchars', $this->CurrentFont[
'subsetchars']);
 
16790           $length = strlen($name);
 
16791           for (
$i = 0; 
$i < $length; ++
$i) {
 
16793                if (preg_match(
'/[0-9a-zA-Z]/', $chr) == 1) {
 
16796                     $escname .= sprintf(
'#%02X', ord($chr));
 
16816           $name = $this->encodeNameObject($name);
 
16817           if ($this->empty_string($name)) {
 
16821                $y = $this->GetY();
 
16824           } 
elseif ($y > $this->h) {
 
16828                $x = $this->GetX();
 
16831           } 
elseif ($x > $this->w) {
 
16834           if (empty($page)) {
 
16835                $page = $this->PageNo();
 
16836                if (empty($page)) {
 
16840           $this->dests[$name] = array(
'x' => $x, 
'y' => $y, 
'p' => $page);
 
16852           return $this->dests;
 
16862           if (empty($this->dests)) {
 
16865           $this->n_dests = $this->_newobj();
 
16867           foreach($this->dests as $name => $o) {
 
16868                $out .= 
' /'.$name.
' '.sprintf(
'[%u 0 R /XYZ %F %F null]', $this->page_obj_id[($o[
'p'])], ($o[
'x'] * $this->k), ($this->pagedim[$o[
'p']][
'h'] - ($o[
'y'] * $this->k)));
 
16871           $out .= 
"\n".
'endobj';
 
16885      public function setBookmark($txt, $level=0, $y=-1, $page=
'', $style=
'', $color=array(0,0,0)) {
 
16886           $this->Bookmark($txt, $level, $y, $page, $style, $color);
 
16902      public function Bookmark($txt, $level=0, $y=-1, $page=
'', $style=
'', $color=array(0,0,0), $x=-1) {
 
16906           if (isset($this->outlines[0])) {
 
16907                $lastoutline = end($this->outlines);
 
16908                $maxlevel = $lastoutline[
'l'] + 1;
 
16912           if ($level > $maxlevel) {
 
16913                $level = $maxlevel;
 
16916                $y = $this->GetY();
 
16919           } 
elseif ($y > $this->h) {
 
16923                $x = $this->GetX();
 
16926           } 
elseif ($x > $this->w) {
 
16929           if (empty($page)) {
 
16930                $page = $this->PageNo();
 
16931                if (empty($page)) {
 
16935           $this->outlines[] = array(
't' => $txt, 
'l' => $level, 
'x' => $x, 
'y' => $y, 
'p' => $page, 
's' => strtoupper($style), 
'c' => $color);
 
16945           $outline_p = array();
 
16946           $outline_y = array();
 
16947           foreach ($this->outlines as $key => $row) {
 
16948                $outline_p[$key] = $row[
'p'];
 
16949                $outline_k[$key] = $key;
 
16952           array_multisort($outline_p, SORT_NUMERIC, SORT_ASC, $outline_k, SORT_NUMERIC, SORT_ASC, $this->outlines);
 
16962           $nb = count($this->outlines);
 
16967           $this->sortBookmarks();
 
16970           foreach ($this->outlines as 
$i => $o) {
 
16972                     $parent = $lru[($o[
'l'] - 1)];
 
16974                     $this->outlines[
$i][
'parent'] = $parent;
 
16975                     $this->outlines[$parent][
'last'] = 
$i;
 
16976                     if ($o[
'l'] > $level) {
 
16978                          $this->outlines[$parent][
'first'] = 
$i;
 
16981                     $this->outlines[
$i][
'parent'] = $nb;
 
16983                if (($o[
'l'] <= $level) AND (
$i > 0)) {
 
16985                     $prev = $lru[$o[
'l']];
 
16986                     $this->outlines[$prev][
'next'] = 
$i;
 
16987                     $this->outlines[
$i][
'prev'] = $prev;
 
16989                $lru[$o[
'l']] = 
$i;
 
16994           $nltags = 
'/<br[\s]?\/>|<\/(blockquote|dd|dl|div|dt|h1|h2|h3|h4|h5|h6|hr|li|ol|p|pre|ul|tcpdf|table|tr|td)>/si';
 
16995           foreach ($this->outlines as 
$i => $o) {
 
16996                $oid = $this->_newobj();
 
16998                $title = preg_replace($nltags, 
"\n", $o[
't']);
 
16999                $title = preg_replace(
"/[\r]+/si", 
'', $title);
 
17000                $title = preg_replace(
"/[\n]+/si", 
"\n", $title);
 
17001                $title = strip_tags($title);
 
17002                $title = $this->stringTrim($title);
 
17003                $out = 
'<</Title '.$this->_textstring($title, $oid);
 
17004                $out .= 
' /Parent '.($n + $o[
'parent']).
' 0 R';
 
17005                if (isset($o[
'prev'])) {
 
17006                     $out .= 
' /Prev '.($n + $o[
'prev']).
' 0 R';
 
17008                if (isset($o[
'next'])) {
 
17009                     $out .= 
' /Next '.($n + $o[
'next']).
' 0 R';
 
17011                if (isset($o[
'first'])) {
 
17012                     $out .= 
' /First '.($n + $o[
'first']).
' 0 R';
 
17014                if (isset($o[
'last'])) {
 
17015                     $out .= 
' /Last '.($n + $o[
'last']).
' 0 R';
 
17017                if (isset($this->page_obj_id[($o[
'p'])])) {
 
17018                     $out .= 
' '.sprintf(
'/Dest [%u 0 R /XYZ %F %F null]', $this->page_obj_id[($o[
'p'])], ($o[
'x'] * $this->k), ($this->pagedim[$o[
'p']][
'h'] - ($o[
'y'] * $this->k)));
 
17022                if (!empty($o[
's'])) {
 
17024                     if (strpos($o[
's'], 
'B') !== 
false) {
 
17028                     if (strpos($o[
's'], 
'I') !== 
false) {
 
17032                $out .= sprintf(
' /F %d', $style);
 
17034                if (isset($o[
'c']) AND is_array($o[
'c']) AND (count($o[
'c']) == 3)) {
 
17035                     $color = array_values($o[
'c']);
 
17036                     $out .= sprintf(
' /C [%F %F %F]', ($color[0] / 255), ($color[1] / 255), ($color[2] / 255));
 
17039                     $out .= 
' /C [0.0 0.0 0.0]';
 
17041                $out .= 
' /Count 0'; 
 
17043                $out .= 
"\n".
'endobj';
 
17047           $this->OutlineRoot = $this->_newobj();
 
17048           $this->_out(
'<< /Type /Outlines /First '.$n.
' 0 R /Last '.($n + $lru[0]).
' 0 R >>'.
"\n".
'endobj');
 
17061           $this->javascript .= $script;
 
17074           if ($this->pdfa_mode) {
 
17079           $this->js_objects[$this->n] = array(
'n' => $this->n, 
'js' => $script, 
'onload' => $onload);
 
17090           if ($this->pdfa_mode OR (empty($this->javascript) AND empty($this->js_objects))) {
 
17093           if (strpos($this->javascript, 
'this.addField') > 0) {
 
17094                if (!$this->ur[
'enabled']) {
 
17099                $jsa = sprintf(
"ftcpdfdocsaved=this.addField('%s','%s',%d,[%F,%F,%F,%F]);", 
'tcpdfdocsaved', 
'text', 0, 0, 1, 0, 1);
 
17100                $jsb = 
"getField('tcpdfdocsaved').value='saved';";
 
17101                $this->javascript = $jsa.
"\n".$this->javascript.
"\n".$jsb;
 
17103           $this->n_js = $this->_newobj();
 
17104           $out = 
' << /Names [';
 
17105           if (!empty($this->javascript)) {
 
17106                $out .= 
' (EmbeddedJS) '.($this->n + 1).
' 0 R';
 
17108           if (!empty($this->js_objects)) {
 
17109                foreach ($this->js_objects as $key => $val) {
 
17110                     if ($val[
'onload']) {
 
17111                          $out .= 
' (JS'.$key.
') '.$key.
' 0 R';
 
17116           $out .= 
"\n".
'endobj';
 
17119           if (!empty($this->javascript)) {
 
17120                $obj_id = $this->_newobj();
 
17121                $out = 
'<< /S /JavaScript';
 
17122                $out .= 
' /JS '.$this->_textstring($this->javascript, $obj_id);
 
17124                $out .= 
"\n".
'endobj';
 
17128           if (!empty($this->js_objects)) {
 
17129                foreach ($this->js_objects as $key => $val) {
 
17130                     $out = $this->_getobj($key).
"\n".
' << /S /JavaScript /JS '.$this->_textstring($val[
'js'], $key).
' >>'.
"\n".
'endobj';
 
17144           static $aColors = array(
'transparent', 
'black', 
'white', 
'red', 
'green', 
'blue', 
'cyan', 
'magenta', 
'yellow', 
'dkGray', 
'gray', 
'ltGray');
 
17145           if (substr($color,0,1) == 
'#') {
 
17146                return sprintf(
"['RGB',%F,%F,%F]", hexdec(substr($color,1,2))/255, hexdec(substr($color,3,2))/255, hexdec(substr($color,5,2))/255);
 
17148           if (!in_array($color,$aColors)) {
 
17149                $this->Error(
'Invalid color: '.$color);
 
17151           return 'color.'.$color;
 
17167      protected function _addfield($type, $name, $x, $y, $w, $h, $prop) {
 
17172           $this->javascript .= 
"if (getField('tcpdfdocsaved').value != 'saved') {";
 
17174           $this->javascript .= sprintf(
"f".$name.
"=this.addField('%s','%s',%u,[%F,%F,%F,%F]);", $name, $type, $this->PageNo()-1, $x*$k, ($this->h-$y)*$k+1, ($x+$w)*$k, ($this->h-$y-$h)*$k+1).
"\n";
 
17175           $this->javascript .= 
'f'.$name.
'.textSize='.$this->FontSizePt.
";\n";
 
17176           while (list($key, $val) = each($prop)) {
 
17177                if (strcmp(substr($key, -5), 
'Color') == 0) {
 
17178                     $val = $this->_JScolor($val);
 
17180                     $val = 
"'".$val.
"'";
 
17182                $this->javascript .= 
'f'.$name.
'.'.$key.
'='.$val.
";\n";
 
17189           $this->javascript .= 
'}';
 
17203           if (isset($prop[
'aopt']) AND is_array($prop[
'aopt'])) {
 
17205                return $prop[
'aopt'];
 
17209           if (isset($prop[
'alignment'])) {
 
17210                switch ($prop[
'alignment']) {
 
17224                          $opt[
'q'] = ($this->rtl)?2:0;
 
17230           if (isset($prop[
'lineWidth'])) {
 
17231                $linewidth = intval($prop[
'lineWidth']);
 
17236           if (isset($prop[
'borderStyle'])) {
 
17237                switch ($prop[
'borderStyle']) {
 
17240                          $opt[
'border'] = array(0, 0, $linewidth, array(3, 2));
 
17241                          $opt[
'bs'] = array(
'w'=>$linewidth, 
's'=>
'D', 
'd'=>array(3, 2));
 
17246                          $opt[
'border'] = array(0, 0, $linewidth);
 
17247                          $opt[
'bs'] = array(
'w'=>$linewidth, 
's'=>
'B');
 
17252                          $opt[
'border'] = array(0, 0, $linewidth);
 
17253                          $opt[
'bs'] = array(
'w'=>$linewidth, 
's'=>
'I');
 
17257                     case 'underline': {
 
17258                          $opt[
'border'] = array(0, 0, $linewidth);
 
17259                          $opt[
'bs'] = array(
'w'=>$linewidth, 
's'=>
'U');
 
17264                          $opt[
'border'] = array(0, 0, $linewidth);
 
17265                          $opt[
'bs'] = array(
'w'=>$linewidth, 
's'=>
'S');
 
17273           if (isset($prop[
'border']) AND is_array($prop[
'border'])) {
 
17274                $opt[
'border'] = $prop[
'border'];
 
17276           if (!isset($opt[
'mk'])) {
 
17277                $opt[
'mk'] = array();
 
17279           if (!isset($opt[
'mk'][
'if'])) {
 
17280                $opt[
'mk'][
'if'] = array();
 
17282           $opt[
'mk'][
'if'][
'a'] = array(0.5, 0.5);
 
17284           if (isset($prop[
'buttonAlignX'])) {
 
17285                $opt[
'mk'][
'if'][
'a'][0] = $prop[
'buttonAlignX'];
 
17288           if (isset($prop[
'buttonAlignY'])) {
 
17289                $opt[
'mk'][
'if'][
'a'][1] = $prop[
'buttonAlignY'];
 
17292           if (isset($prop[
'buttonFitBounds']) AND ($prop[
'buttonFitBounds'] == 
'true')) {
 
17293                $opt[
'mk'][
'if'][
'fb'] = 
true;
 
17296           if (isset($prop[
'buttonScaleHow'])) {
 
17297                switch ($prop[
'buttonScaleHow']) {
 
17298                     case 'scaleHow.proportional': {
 
17299                          $opt[
'mk'][
'if'][
's'] = 
'P';
 
17302                     case 'scaleHow.anamorphic': {
 
17303                          $opt[
'mk'][
'if'][
's'] = 
'A';
 
17309           if (isset($prop[
'buttonScaleWhen'])) {
 
17310                switch ($prop[
'buttonScaleWhen']) {
 
17311                     case 'scaleWhen.always': {
 
17312                          $opt[
'mk'][
'if'][
'sw'] = 
'A';
 
17315                     case 'scaleWhen.never': {
 
17316                          $opt[
'mk'][
'if'][
'sw'] = 
'N';
 
17319                     case 'scaleWhen.tooBig': {
 
17320                          $opt[
'mk'][
'if'][
'sw'] = 
'B';
 
17323                     case 'scaleWhen.tooSmall': {
 
17324                          $opt[
'mk'][
'if'][
'sw'] = 
'S';
 
17330           if (isset($prop[
'buttonPosition'])) {
 
17331                switch ($prop[
'buttonPosition']) {
 
17333                     case 'position.textOnly': {
 
17334                          $opt[
'mk'][
'tp'] = 0;
 
17338                     case 'position.iconOnly': {
 
17339                          $opt[
'mk'][
'tp'] = 1;
 
17343                     case 'position.iconTextV': {
 
17344                          $opt[
'mk'][
'tp'] = 2;
 
17348                     case 'position.textIconV': {
 
17349                          $opt[
'mk'][
'tp'] = 3;
 
17353                     case 'position.iconTextH': {
 
17354                          $opt[
'mk'][
'tp'] = 4;
 
17358                     case 'position.textIconH': {
 
17359                          $opt[
'mk'][
'tp'] = 5;
 
17363                     case 'position.overlay': {
 
17364                          $opt[
'mk'][
'tp'] = 6;
 
17370           if (isset($prop[
'fillColor'])) {
 
17371                if (is_array($prop[
'fillColor'])) {
 
17372                     $opt[
'mk'][
'bg'] = $prop[
'fillColor'];
 
17374                     $opt[
'mk'][
'bg'] = $this->convertHTMLColorToDec($prop[
'fillColor']);
 
17378           if (isset($prop[
'strokeColor'])) {
 
17379                if (is_array($prop[
'strokeColor'])) {
 
17380                     $opt[
'mk'][
'bc'] = $prop[
'strokeColor'];
 
17382                     $opt[
'mk'][
'bc'] = $this->convertHTMLColorToDec($prop[
'strokeColor']);
 
17386           if (isset($prop[
'rotation'])) {
 
17387                $opt[
'mk'][
'r'] = $prop[
'rotation'];
 
17390           if (isset($prop[
'charLimit'])) {
 
17391                $opt[
'maxlen'] = intval($prop[
'charLimit']);
 
17397           if (isset($prop[
'readonly']) AND ($prop[
'readonly'] == 
'true')) {
 
17401           if (isset($prop[
'required']) AND ($prop[
'required'] == 
'true')) {
 
17405           if (isset($prop[
'multiline']) AND ($prop[
'multiline'] == 
'true')) {
 
17409           if (isset($prop[
'password']) AND ($prop[
'password'] == 
'true')) {
 
17413           if (isset($prop[
'NoToggleToOff']) AND ($prop[
'NoToggleToOff'] == 
'true')) {
 
17417           if (isset($prop[
'Radio']) AND ($prop[
'Radio'] == 
'true')) {
 
17421           if (isset($prop[
'Pushbutton']) AND ($prop[
'Pushbutton'] == 
'true')) {
 
17425           if (isset($prop[
'Combo']) AND ($prop[
'Combo'] == 
'true')) {
 
17429           if (isset($prop[
'editable']) AND ($prop[
'editable'] == 
'true')) {
 
17433           if (isset($prop[
'Sort']) AND ($prop[
'Sort'] == 
'true')) {
 
17437           if (isset($prop[
'fileSelect']) AND ($prop[
'fileSelect'] == 
'true')) {
 
17441           if (isset($prop[
'multipleSelection']) AND ($prop[
'multipleSelection'] == 
'true')) {
 
17445           if (isset($prop[
'doNotSpellCheck']) AND ($prop[
'doNotSpellCheck'] == 
'true')) {
 
17449           if (isset($prop[
'doNotScroll']) AND ($prop[
'doNotScroll'] == 
'true')) {
 
17453           if (isset($prop[
'comb']) AND ($prop[
'comb'] == 
'true')) {
 
17457           if (isset($prop[
'radiosInUnison']) AND ($prop[
'radiosInUnison'] == 
'true')) {
 
17461           if (isset($prop[
'richText']) AND ($prop[
'richText'] == 
'true')) {
 
17465           if (isset($prop[
'commitOnSelChange']) AND ($prop[
'commitOnSelChange'] == 
'true')) {
 
17470           if (isset($prop[
'defaultValue'])) {
 
17471                $opt[
'dv'] = $prop[
'defaultValue'];
 
17475           if (isset($prop[
'readonly']) AND ($prop[
'readonly'] == 
'true')) {
 
17479           if (isset($prop[
'display'])) {
 
17480                if ($prop[
'display'] == 
'display.visible') {
 
17482                } 
elseif ($prop[
'display'] == 
'display.hidden') {
 
17484                } 
elseif ($prop[
'display'] == 
'display.noPrint') {
 
17486                } 
elseif ($prop[
'display'] == 
'display.noView') {
 
17492           if (isset($prop[
'currentValueIndices']) AND is_array($prop[
'currentValueIndices'])) {
 
17493                $opt[
'i'] = $prop[
'currentValueIndices'];
 
17496           if (isset($prop[
'value'])) {
 
17497                if (is_array($prop[
'value'])) {
 
17498                     $opt[
'opt'] = array();
 
17499                     foreach ($prop[
'value'] AS $key => $optval) {
 
17501                          if (isset($prop[
'exportValues'][$key])) {
 
17502                               $opt[
'opt'][$key] = array($prop[
'exportValues'][$key], $prop[
'value'][$key]);
 
17504                               $opt[
'opt'][$key] = $prop[
'value'][$key];
 
17508                     $opt[
'v'] = $prop[
'value'];
 
17512           if (isset($prop[
'richValue'])) {
 
17513                $opt[
'rv'] = $prop[
'richValue'];
 
17516           if (isset($prop[
'submitName'])) {
 
17517                $opt[
'tm'] = $prop[
'submitName'];
 
17520           if (isset($prop[
'name'])) {
 
17521                $opt[
't'] = $prop[
'name'];
 
17524           if (isset($prop[
'userName'])) {
 
17525                $opt[
'tu'] = $prop[
'userName'];
 
17528           if (isset($prop[
'highlight'])) {
 
17529                switch ($prop[
'highlight']) {
 
17531                     case 'highlight.n': {
 
17536                     case 'highlight.i': {
 
17541                     case 'highlight.p': {
 
17546                     case 'highlight.o': {
 
17569           $this->default_form_prop = $prop;
 
17580           return $this->default_form_prop;
 
17597      public function TextField($name, $w, $h, $prop=array(), $opt=array(), $x=
'', $y=
'', $js=
false) {
 
17605           list($x, $y) = $this->checkPageRegions($h, $x, $y);
 
17607                $this->_addfield(
'text', $name, $x, $y, $w, $h, $prop);
 
17611           $prop = array_merge($this->getFormDefaultProp(), $prop);
 
17613           $popt = $this->getAnnotOptFromJSProp($prop);
 
17615           $this->annotation_fonts[$this->CurrentFont[
'fontkey']] = $this->CurrentFont[
'i'];
 
17616           $fontstyle = sprintf(
'/F%d %F Tf %s', $this->CurrentFont[
'i'], $this->FontSizePt, $this->TextColor);
 
17617           $popt[
'da'] = $fontstyle;
 
17619           $popt[
'ap'] = array();
 
17620           $popt[
'ap'][
'n'] = 
'/Tx BMC q '.$fontstyle.
' ';
 
17622           if (isset($prop[
'value']) AND !empty($prop[
'value'])) {
 
17623                $text = $prop[
'value'];
 
17624           } 
elseif (isset($opt[
'v']) AND !empty($opt[
'v'])) {
 
17627           $tmpid = $this->startTemplate($w, $h, 
false);
 
17629           if (isset($popt[
'q'])) {
 
17630                switch ($popt[
'q']) {
 
17649           $this->MultiCell($w, $h, $text, 0, $align, 
false, 0, 0, 0, 
true, 0, 
false, 
true, 0, 
'T', 
false);
 
17650           $this->endTemplate();
 
17652           $popt[
'ap'][
'n'] .= $this->xobjects[$tmpid][
'outdata'];
 
17653           unset($this->xobjects[$tmpid]);
 
17654           $popt[
'ap'][
'n'] .= 
'Q EMC';
 
17656           $opt = array_merge($popt, $opt);
 
17660           $opt[
'Subtype'] = 
'Widget';
 
17675           unset($opt[
'mk'][
'ca']);
 
17676           unset($opt[
'mk'][
'rc']);
 
17677           unset($opt[
'mk'][
'ac']);
 
17678           unset($opt[
'mk'][
'i']);
 
17679           unset($opt[
'mk'][
'ri']);
 
17680           unset($opt[
'mk'][
'ix']);
 
17681           unset($opt[
'mk'][
'if']);
 
17686           unset($opt[
'mk'][
'tp']);
 
17695           $this->Annotation($x, $y, $w, $h, $name, $opt, 0);
 
17718      public function RadioButton($name, $w, $prop=array(), $opt=array(), $onvalue=
'On', $checked=
false, $x=
'', $y=
'', $js=
false) {
 
17726           list($x, $y) = $this->checkPageRegions($w, $x, $y);
 
17728                $this->_addfield(
'radiobutton', $name, $x, $y, $w, $w, $prop);
 
17731           if ($this->empty_string($onvalue)) {
 
17735                $defval = $onvalue;
 
17740           $font = 
'zapfdingbats';
 
17741           if ($this->pdfa_mode) {
 
17743                $font = 
'pdfa'.$font;
 
17745           $this->AddFont($font);
 
17746           $tmpfont = $this->getFontBuffer($font);
 
17748           if (!isset($this->radiobutton_groups[$this->page])) {
 
17749                $this->radiobutton_groups[$this->page] = array();
 
17751           if (!isset($this->radiobutton_groups[$this->page][$name])) {
 
17752                $this->radiobutton_groups[$this->page][$name] = array();
 
17754                $this->radiobutton_groups[$this->page][$name][
'n'] = $this->n;
 
17755                $this->radio_groups[] = $this->n;
 
17757           $kid = ($this->n + 1);
 
17759           $this->radiobutton_groups[$this->page][$name][] = array(
'kid' => $kid, 
'def' => $defval);
 
17761           $prop = array_merge($this->getFormDefaultProp(), $prop);
 
17762           $prop[
'NoToggleToOff'] = 
'true';
 
17763           $prop[
'Radio'] = 
'true';
 
17764           $prop[
'borderStyle'] = 
'inset';
 
17766           $popt = $this->getAnnotOptFromJSProp($prop);
 
17768           $this->annotation_fonts[$tmpfont[
'fontkey']] = $tmpfont[
'i'];
 
17769           $fontstyle = sprintf(
'/F%d %F Tf %s', $tmpfont[
'i'], $this->FontSizePt, $this->TextColor);
 
17770           $popt[
'da'] = $fontstyle;
 
17772           $popt[
'ap'] = array();
 
17773           $popt[
'ap'][
'n'] = array();
 
17774           $fy = (($w - ((($tmpfont[
'desc'][
'Ascent'] - $tmpfont[
'desc'][
'Descent']) * $this->FontSizePt / 1000) / $this->k)) * $this->k);
 
17775           $popt[
'ap'][
'n'][$onvalue] = sprintf(
'q %s BT /F%d %F Tf %F %F Td ('.chr(108).
') Tj ET Q', $this->TextColor, $tmpfont[
'i'], $this->FontSizePt, 0, $fy);
 
17776           $popt[
'ap'][
'n'][
'Off'] = sprintf(
'q %s BT /F%d %F Tf %F %F Td ('.chr(109).
') Tj ET Q', $this->TextColor, $tmpfont[
'i'], $this->FontSizePt, 0, $fy);
 
17777           if (!isset($popt[
'mk'])) {
 
17778                $popt[
'mk'] = array();
 
17780           $popt[
'mk'][
'ca'] = 
'(l)';
 
17782           $opt = array_merge($popt, $opt);
 
17784           $opt[
'Subtype'] = 
'Widget';
 
17785           $opt[
'ft'] = 
'Btn';
 
17787                $opt[
'v'] = array(
'/'.$onvalue);
 
17788                $opt[
'as'] = $onvalue;
 
17790                $opt[
'as'] = 
'Off';
 
17793           if (!isset($this->radiobutton_groups[$this->page][$name][
'#readonly#'])) {
 
17794                $this->radiobutton_groups[$this->page][$name][
'#readonly#'] = 
false;
 
17796           $this->radiobutton_groups[$this->page][$name][
'#readonly#'] |= ($opt[
'f'] & 64);
 
17797           $this->Annotation($x, $y, $w, $w, $name, $opt, 0);
 
17820      public function ListBox($name, $w, $h, $values, $prop=array(), $opt=array(), $x=
'', $y=
'', $js=
false) {
 
17828           list($x, $y) = $this->checkPageRegions($h, $x, $y);
 
17830                $this->_addfield(
'listbox', $name, $x, $y, $w, $h, $prop);
 
17832                foreach ($values as $value) {
 
17833                     if (is_array($value)) {
 
17834                          $s .= 
',[\''.addslashes($value[1]).
'\',\
''.addslashes($value[0]).
'\']
'; 
17836                          $s .= ',[\
''.addslashes($value).
'\',\
''.addslashes($value).
'\']
'; 
17839                $this->javascript .= 'f
'.$name.'.setItems(
'.substr($s, 1).');
'."\n"; 
17842           // get default style 
17843           $prop = array_merge($this->getFormDefaultProp(), $prop); 
17844           // get annotation data 
17845           $popt = $this->getAnnotOptFromJSProp($prop); 
17846           // set additional default values 
17847           $this->annotation_fonts[$this->CurrentFont['fontkey
']] = $this->CurrentFont['i
']; 
17848           $fontstyle = sprintf('/F%d %F Tf %s
', $this->CurrentFont['i
'], $this->FontSizePt, $this->TextColor); 
17849           $popt['da
'] = $fontstyle; 
17850           // build appearance stream 
17851           $popt['ap
'] = array(); 
17852           $popt['ap
']['n
'] = '/Tx BMC q 
'.$fontstyle.' '; 
17854           foreach($values as $item) { 
17855                if (is_array($item)) { 
17856                     $text .= $item[1]."\n"; 
17858                     $text .= $item."\n"; 
17861           $tmpid = $this->startTemplate($w, $h, false); 
17862           $this->MultiCell($w, $h, $text, 0, '', false, 0, 0, 0, true, 0, false, true, 0, 'T
', false); 
17863           $this->endTemplate(); 
17865           $popt['ap
']['n
'] .= $this->xobjects[$tmpid]['outdata
']; 
17866           unset($this->xobjects[$tmpid]); 
17867           $popt['ap
']['n
'] .= 'Q EMC
'; 
17869           $opt = array_merge($popt, $opt); 
17870           // set remaining annotation data 
17871           $opt['Subtype
'] = 'Widget
'; 
17874           $opt['opt
'] = $values; 
17875           unset($opt['mk
']['ca
']); 
17876           unset($opt['mk
']['rc
']); 
17877           unset($opt['mk
']['ac
']); 
17878           unset($opt['mk
']['i
']); 
17879           unset($opt['mk
']['ri
']); 
17880           unset($opt['mk
']['ix
']); 
17881           unset($opt['mk
']['if']); 
17882           unset($opt['mk
']['tp
']); 
17883           $this->Annotation($x, $y, $w, $h, $name, $opt, 0); 
17906      public function ComboBox($name, $w, $h, $values, $prop=array(), $opt=array(), $x='', $y='', $js=false) { 
17913           // check page for no-write regions and adapt page margins if necessary 
17914           list($x, $y) = $this->checkPageRegions($h, $x, $y); 
17916                $this->_addfield('combobox
', $name, $x, $y, $w, $h, $prop); 
17918                foreach ($values as $value) { 
17919                     if (is_array($value)) { 
17920                          $s .= ',[\
''.addslashes($value[1]).
'\',\
''.addslashes($value[0]).
'\']
'; 
17922                          $s .= ',[\
''.addslashes($value).
'\',\
''.addslashes($value).
'\']
'; 
17925                $this->javascript .= 'f
'.$name.'.setItems(
'.substr($s, 1).');
'."\n"; 
17928           // get default style 
17929           $prop = array_merge($this->getFormDefaultProp(), $prop); 
17930           $prop['Combo
'] = true; 
17931           // get annotation data 
17932           $popt = $this->getAnnotOptFromJSProp($prop); 
17933           // set additional default options 
17934           $this->annotation_fonts[$this->CurrentFont['fontkey
']] = $this->CurrentFont['i
']; 
17935           $fontstyle = sprintf('/F%d %F Tf %s
', $this->CurrentFont['i
'], $this->FontSizePt, $this->TextColor); 
17936           $popt['da
'] = $fontstyle; 
17937           // build appearance stream 
17938           $popt['ap
'] = array(); 
17939           $popt['ap
']['n
'] = '/Tx BMC q 
'.$fontstyle.' '; 
17941           foreach($values as $item) { 
17942                if (is_array($item)) { 
17943                     $text .= $item[1]."\n"; 
17945                     $text .= $item."\n"; 
17948           $tmpid = $this->startTemplate($w, $h, false); 
17949           $this->MultiCell($w, $h, $text, 0, '', false, 0, 0, 0, true, 0, false, true, 0, 'T
', false); 
17950           $this->endTemplate(); 
17952           $popt['ap
']['n
'] .= $this->xobjects[$tmpid]['outdata
']; 
17953           unset($this->xobjects[$tmpid]); 
17954           $popt['ap
']['n
'] .= 'Q EMC
'; 
17956           $opt = array_merge($popt, $opt); 
17957           // set remaining annotation data 
17958           $opt['Subtype
'] = 'Widget
'; 
17961           $opt['opt
'] = $values; 
17962           unset($opt['mk
']['ca
']); 
17963           unset($opt['mk
']['rc
']); 
17964           unset($opt['mk
']['ac
']); 
17965           unset($opt['mk
']['i
']); 
17966           unset($opt['mk
']['ri
']); 
17967           unset($opt['mk
']['ix
']); 
17968           unset($opt['mk
']['if']); 
17969           unset($opt['mk
']['tp
']); 
17970           $this->Annotation($x, $y, $w, $h, $name, $opt, 0); 
17993      public function CheckBox($name, $w, $checked=false, $prop=array(), $opt=array(), $onvalue='Yes
', $x='', $y='', $js=false) { 
18000           // check page for no-write regions and adapt page margins if necessary 
18001           list($x, $y) = $this->checkPageRegions($w, $x, $y); 
18003                $this->_addfield('checkbox
', $name, $x, $y, $w, $w, $prop); 
18006           if (!isset($prop['value
'])) { 
18007                $prop['value
'] = array('Yes
'); 
18009           // get default style 
18010           $prop = array_merge($this->getFormDefaultProp(), $prop); 
18011           $prop['borderStyle
'] = 'inset
'; 
18012           // get annotation data 
18013           $popt = $this->getAnnotOptFromJSProp($prop); 
18014           // set additional default options 
18015           $font = 'zapfdingbats
'; 
18016           if ($this->pdfa_mode) { 
18017                // all fonts must be embedded 
18018                $font = 'pdfa
'.$font; 
18020           $this->AddFont($font); 
18021           $tmpfont = $this->getFontBuffer($font); 
18022           $this->annotation_fonts[$tmpfont['fontkey
']] = $tmpfont['i
']; 
18023           $fontstyle = sprintf('/F%d %F Tf %s
', $tmpfont['i
'], $this->FontSizePt, $this->TextColor); 
18024           $popt['da
'] = $fontstyle; 
18025           // build appearance stream 
18026           $popt['ap
'] = array(); 
18027           $popt['ap
']['n
'] = array(); 
18028           $fy = ((($tmpfont['desc
']['Ascent
'] + $tmpfont['desc
']['Descent
']) * $this->FontSizePt) / (1000 * $this->k)); 
18029           $fy = (($w - ((($tmpfont['desc
']['Ascent
'] - $tmpfont['desc
']['Descent
']) * $this->FontSizePt / 1000) / $this->k)) * $this->k); 
18030           $popt['ap
']['n
']['Yes
'] = sprintf('q %s BT /F%d %F Tf %F %F Td (
'.chr(110).') Tj ET Q', $this->TextColor, $tmpfont['i'], $this->FontSizePt, 0, $fy);
 
18031           $popt['ap']['n']['Off'] = sprintf('q %s BT /F%d %F Tf %F %F Td ('.chr(111).') Tj ET Q', $this->TextColor, $tmpfont['i'], $this->FontSizePt, 0, $fy);
 
18033           $opt = array_merge($popt, $opt);
 
18035           $opt['Subtype'] = 'Widget';
 
18036           $opt['ft'] = 'Btn';
 
18038           if ($this->empty_string($onvalue)) {
 
18041           $opt[
'opt'] = array($onvalue);
 
18043                $opt[
'v'] = array(
'/Yes');
 
18044                $opt[
'as'] = 
'Yes';
 
18046                $opt[
'v'] = array(
'/Off');
 
18047                $opt[
'as'] = 
'Off';
 
18049           $this->Annotation($x, $y, $w, $w, $name, $opt, 0);
 
18073      public function Button($name, $w, $h, $caption, 
$action, $prop=array(), $opt=array(), $x=
'', $y=
'', $js=
false) {
 
18081           list($x, $y) = $this->checkPageRegions($h, $x, $y);
 
18083                $this->_addfield(
'button', $name, $this->x, $this->y, $w, $h, $prop);
 
18084                $this->javascript .= 
'f'.$name.
".buttonSetCaption('".addslashes($caption).
"');\n";
 
18085                $this->javascript .= 
'f'.$name.
".setAction('MouseUp','".addslashes(
$action).
"');\n";
 
18086                $this->javascript .= 
'f'.$name.
".highlight='push';\n";
 
18087                $this->javascript .= 
'f'.$name.
".print=false;\n";
 
18091           $prop = array_merge($this->getFormDefaultProp(), $prop);
 
18092           $prop[
'Pushbutton'] = 
'true';
 
18093           $prop[
'highlight'] = 
'push';
 
18094           $prop[
'display'] = 
'display.noPrint';
 
18096           $popt = $this->getAnnotOptFromJSProp($prop);
 
18097           $this->annotation_fonts[$this->CurrentFont[
'fontkey']] = $this->CurrentFont[
'i'];
 
18098           $fontstyle = sprintf(
'/F%d %F Tf %s', $this->CurrentFont[
'i'], $this->FontSizePt, $this->TextColor);
 
18099           $popt[
'da'] = $fontstyle;
 
18101           $popt[
'ap'] = array();
 
18102           $popt[
'ap'][
'n'] = 
'/Tx BMC q '.$fontstyle.
' ';
 
18103           $tmpid = $this->startTemplate($w, $h, 
false);
 
18104           $bw = (2 / $this->k); 
 
18106                'L' => array(
'width' => $bw, 
'cap' => 
'square', 
'join' => 
'miter', 
'dash' => 0, 
'color' => array(231)),
 
18107                'R' => array(
'width' => $bw, 
'cap' => 
'square', 
'join' => 
'miter', 
'dash' => 0, 
'color' => array(51)),
 
18108                'T' => array(
'width' => $bw, 
'cap' => 
'square', 
'join' => 
'miter', 
'dash' => 0, 
'color' => array(231)),
 
18109                'B' => array(
'width' => $bw, 
'cap' => 
'square', 
'join' => 
'miter', 
'dash' => 0, 
'color' => array(51)));
 
18110           $this->SetFillColor(204);
 
18111           $this->Cell($w, $h, $caption, $border, 0, 
'C', 
true, 
'', 1, 
false, 
'T', 
'M');
 
18112           $this->endTemplate();
 
18114           $popt[
'ap'][
'n'] .= $this->xobjects[$tmpid][
'outdata'];
 
18115           unset($this->xobjects[$tmpid]);
 
18116           $popt[
'ap'][
'n'] .= 
'Q EMC';
 
18118           if (!isset($popt[
'mk'])) {
 
18119                $popt[
'mk'] = array();
 
18121           $ann_obj_id = ($this->n + 1);
 
18123                $ann_obj_id = ($this->n + 2);
 
18125           $popt[
'mk'][
'ca'] = $this->_textstring($caption, $ann_obj_id);
 
18126           $popt[
'mk'][
'rc'] = $this->_textstring($caption, $ann_obj_id);
 
18127           $popt[
'mk'][
'ac'] = $this->_textstring($caption, $ann_obj_id);
 
18129           $opt = array_merge($popt, $opt);
 
18131           $opt[
'Subtype'] = 
'Widget';
 
18132           $opt[
'ft'] = 
'Btn';
 
18133           $opt[
't'] = $caption;
 
18138                     $opt[
'aa'] = 
'/D <<';
 
18139                     $bmode = array(
'SubmitForm', 
'ResetForm', 
'ImportData');
 
18140                     foreach (
$action AS $key => $val) {
 
18141                          if (($key == 
'S') AND in_array($val, $bmode)) {
 
18142                               $opt[
'aa'] .= 
' /S /'.$val;
 
18143                          } 
elseif (($key == 
'F') AND (!empty($val))) {
 
18144                               $opt[
'aa'] .= 
' /F '.$this->_datastring($val, $ann_obj_id);
 
18145                          } 
elseif (($key == 
'Fields') AND is_array($val) AND !empty($val)) {
 
18146                               $opt[
'aa'] .= 
' /Fields [';
 
18147                               foreach ($val AS $field) {
 
18148                                    $opt[
'aa'] .= 
' '.$this->_textstring($field, $ann_obj_id);
 
18151                          } 
elseif (($key == 
'Flags')) {
 
18153                               if (is_array($val)) {
 
18154                                    foreach ($val AS $flag) {
 
18156                                              case 'Include/Exclude': {
 
18160                                              case 'IncludeNoValueFields': {
 
18164                                              case 'ExportFormat': {
 
18168                                              case 'GetMethod': {
 
18172                                              case 'SubmitCoordinates': {
 
18180                                              case 'IncludeAppendSaves': {
 
18184                                              case 'IncludeAnnotations': {
 
18188                                              case 'SubmitPDF': {
 
18192                                              case 'CanonicalFormat': {
 
18196                                              case 'ExclNonUserAnnots': {
 
18204                                              case 'EmbedForm': {
 
18211                                    $ff = intval($val);
 
18213                               $opt[
'aa'] .= 
' /Flags '.$ff;
 
18216                     $opt[
'aa'] .= 
' >>';
 
18219                     $js_obj_id = $this->addJavascriptObject(
$action);
 
18220                     $opt[
'aa'] = 
'/D '.$js_obj_id.
' 0 R';
 
18223           $this->Annotation($x, $y, $w, $h, $name, $opt, 0);
 
18241           if ((!$this->sign) OR (!isset($this->signature_data[
'cert_type']))) {
 
18244           $sigobjid = ($this->sig_obj_id + 1);
 
18245           $out = $this->_getobj($sigobjid).
"\n";
 
18246           $out .= 
'<< /Type /Sig';
 
18247           $out .= 
' /Filter /Adobe.PPKLite';
 
18248           $out .= 
' /SubFilter /adbe.pkcs7.detached';
 
18249           $out .= 
' '.$this->byterange_string;
 
18250           $out .= 
' /Contents<'.str_repeat(
'0', $this->signature_max_length).
'>';
 
18251           $out .= 
' /Reference ['; 
 
18252           $out .= 
' << /Type /SigRef';
 
18253           if ($this->signature_data[
'cert_type'] > 0) {
 
18254                $out .= 
' /TransformMethod /DocMDP';
 
18255                $out .= 
' /TransformParams <<';
 
18256                $out .= 
' /Type /TransformParams';
 
18257                $out .= 
' /P '.$this->signature_data[
'cert_type'];
 
18258                $out .= 
' /V /1.2';
 
18260                $out .= 
' /TransformMethod /UR3';
 
18261                $out .= 
' /TransformParams <<';
 
18262                $out .= 
' /Type /TransformParams';
 
18263                $out .= 
' /V /2.2';
 
18264                if (!$this->empty_string($this->ur[
'document'])) {
 
18265                     $out .= 
' /Document['.$this->ur[
'document'].
']';
 
18267                if (!$this->empty_string($this->ur[
'form'])) {
 
18268                     $out .= 
' /Form['.$this->ur[
'form'].
']';
 
18270                if (!$this->empty_string($this->ur[
'signature'])) {
 
18271                     $out .= 
' /Signature['.$this->ur[
'signature'].
']';
 
18273                if (!$this->empty_string($this->ur[
'annots'])) {
 
18274                     $out .= 
' /Annots['.$this->ur[
'annots'].
']';
 
18276                if (!$this->empty_string($this->ur[
'ef'])) {
 
18277                     $out .= 
' /EF['.$this->ur[
'ef'].
']';
 
18279                if (!$this->empty_string($this->ur[
'formex'])) {
 
18280                     $out .= 
' /FormEX['.$this->ur[
'formex'].
']';
 
18291           if (isset($this->signature_data[
'info'][
'Name']) AND !$this->empty_string($this->signature_data[
'info'][
'Name'])) {
 
18292                $out .= 
' /Name '.$this->_textstring($this->signature_data[
'info'][
'Name'], $sigobjid);
 
18294           if (isset($this->signature_data[
'info'][
'Location']) AND !$this->empty_string($this->signature_data[
'info'][
'Location'])) {
 
18295                $out .= 
' /Location '.$this->_textstring($this->signature_data[
'info'][
'Location'], $sigobjid);
 
18297           if (isset($this->signature_data[
'info'][
'Reason']) AND !$this->empty_string($this->signature_data[
'info'][
'Reason'])) {
 
18298                $out .= 
' /Reason '.$this->_textstring($this->signature_data[
'info'][
'Reason'], $sigobjid);
 
18300           if (isset($this->signature_data[
'info'][
'ContactInfo']) AND !$this->empty_string($this->signature_data[
'info'][
'ContactInfo'])) {
 
18301                $out .= 
' /ContactInfo '.$this->_textstring($this->signature_data[
'info'][
'ContactInfo'], $sigobjid);
 
18303           $out .= 
' /M '.$this->_datestring($sigobjid, $this->doc_modification_timestamp);
 
18305           $out .= 
"\n".
'endobj';
 
18328                $document=
'/FullSave',
 
18329                $annots=
'/Create/Delete/Modify/Copy/Import/Export',
 
18330                $form=
'/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate',
 
18331                $signature=
'/Modify',
 
18332                $ef=
'/Create/Delete/Modify/Import',
 
18334           $this->ur[
'enabled'] = $enable;
 
18335           $this->ur[
'document'] = $document;
 
18336           $this->ur[
'annots'] = $annots;
 
18337           $this->ur[
'form'] = $form;
 
18338           $this->ur[
'signature'] = $signature;
 
18339           $this->ur[
'ef'] = $ef;
 
18340           $this->ur[
'formex'] = $formex;
 
18341           if (!$this->sign) {
 
18342                $this->setSignature(
'', 
'', 
'', 
'', 0, array());
 
18362      public function setSignature($signing_cert=
'', $private_key=
'', $private_key_password=
'', $extracerts=
'', $cert_type=2, $info=array()) {
 
18367           $this->sign = 
true;
 
18369           $this->sig_obj_id = $this->n; 
 
18371           $this->signature_data = array();
 
18372           if (strlen($signing_cert) == 0) {
 
18373                $signing_cert = 
'file://'.dirname(__FILE__).
'/tcpdf.crt';
 
18374                $private_key_password = 
'tcpdfdemo';
 
18376           if (strlen($private_key) == 0) {
 
18377                $private_key = $signing_cert;
 
18379           $this->signature_data[
'signcert'] = $signing_cert;
 
18380           $this->signature_data[
'privkey'] = $private_key;
 
18381           $this->signature_data[
'password'] = $private_key_password;
 
18382           $this->signature_data[
'extracerts'] = $extracerts;
 
18383           $this->signature_data[
'cert_type'] = $cert_type;
 
18384           $this->signature_data[
'info'] = $info;
 
18399           $this->signature_appearance = $this->getSignatureAppearanceArray($x, $y, $w, $h, $page);
 
18415           $this->empty_signature_appearance[] = array(
'objid' => $this->n) + $this->getSignatureAppearanceArray($x, $y, $w, $h, $page);
 
18432           if (($page < 1) OR ($page > $this->numpages)) {
 
18433                $sigapp[
'page'] = $this->page;
 
18435                $sigapp[
'page'] = intval($page);
 
18437           $a = $x * $this->k;
 
18438           $b = $this->pagedim[($sigapp[
'page'])][
'h'] - (($y + $h) * $this->k);
 
18439           $c = $w * $this->k;
 
18440           $d = $h * $this->k;
 
18441           $sigapp[
'rect'] = sprintf(
'%F %F %F %F', $a, $b, ($a + $c), ($b + $d));
 
18453           if (empty($page)) {
 
18454                $page = $this->page + 1;
 
18456           $this->newpagegroup[$page] = 
sizeof($this->newpagegroup) + 1;
 
18484           $this->starting_page_number = max(0, intval($num));
 
18496           $ref = 
'{'.$this->alias_right_shift.
'}{'.$this->alias_tot_pages.
'}{'.$this->alias_num_page.
'}';
 
18497           $rep = str_repeat(
' ', $this->GetNumChars($ref));
 
18498           $wdiff = max(1, ($this->GetStringWidth($ref) / $this->GetStringWidth($rep)));
 
18499           $sdiff = sprintf(
'%F', $wdiff);
 
18500           $alias = $this->alias_right_shift.$sdiff.
'}';
 
18501           if ($this->isUnicodeFont()) {
 
18502                $alias = 
'{'.$alias;
 
18516           if ($this->isUnicodeFont()) {
 
18517                return '{'.$this->alias_tot_pages.
'}';
 
18519           return $this->alias_tot_pages;
 
18531           if ($this->isUnicodeFont()) {
 
18532                return '{'.$this->alias_num_page.
'}';
 
18534           return $this->alias_num_page;
 
18546           if ($this->isUnicodeFont()) {
 
18547                return '{'.$this->alias_group_tot_pages.
'}';
 
18549           return $this->alias_group_tot_pages;
 
18561           if ($this->isUnicodeFont()) {
 
18562                return '{'.$this->alias_group_num_page.
'}';
 
18564           return $this->alias_group_num_page;
 
18574           return $this->pagegroups[$this->currpagegroup];
 
18584           return $this->formatPageNumber($this->getGroupPageNo());
 
18595           return number_format((
float)$num, 0, 
'', 
'.');
 
18607           return number_format((
float)$num, 0, 
'', 
'.');
 
18617           return $this->formatPageNumber($this->PageNo());
 
18626           if (empty($this->pdflayers)) {
 
18629           foreach ($this->pdflayers as $key => $layer) {
 
18630                 $this->pdflayers[$key][
'objid'] = $this->_newobj();
 
18631                 $out = 
'<< /Type /OCG';
 
18632                 $out .= 
' /Name '.$this->_textstring($layer[
'name'], $this->pdflayers[$key][
'objid']);
 
18633                 $out .= 
' /Usage <<';
 
18634                 $out .= 
' /Print <</PrintState /'.($layer[
'print']?
'ON':
'OFF').
'>>';
 
18635                 $out .= 
' /View <</ViewState /'.($layer[
'view']?
'ON':
'OFF').
'>>';
 
18637                 $out .= 
"\n".
'endobj';
 
18651           if ($this->state != 2) {
 
18654           $layer = sprintf(
'LYR%03d', (count($this->pdflayers) + 1));
 
18655           if (empty($name)) {
 
18658                $name = preg_replace(
'/[^a-zA-Z0-9_\-]/', 
'', $name);
 
18660           $this->pdflayers[] = array(
'layer' => $layer, 
'name' => $name, 
'print' => $print, 
'view' => $view);
 
18661           $this->openMarkedContent = 
true;
 
18662           $this->_out(
'/OC /'.$layer.
' BDC');
 
18671           if ($this->state != 2) {
 
18674           if ($this->openMarkedContent) {
 
18676                $this->_out(
'EMC');
 
18677                $this->openMarkedContent = 
false;
 
18690           if ($this->state != 2) {
 
18696                     $this->startLayer(
'Print', 
true, 
false);
 
18701                     $this->startLayer(
'View', 
false, 
true);
 
18709                     $this->Error(
'Incorrect visibility: '.$v);
 
18723           if ($this->pdfa_mode) {
 
18728           foreach ($this->extgstates as 
$i => $ext) {
 
18729                if ($ext[
'parms'] == $parms) {
 
18730                     if ($this->inxobj) {
 
18732                          $this->xobjects[$this->xobjid][
'extgstates'][
$i] = $ext;
 
18738           $n = (count($this->extgstates) + 1);
 
18739           $this->extgstates[$n] = array(
'parms' => $parms);
 
18740           if ($this->inxobj) {
 
18742                $this->xobjects[$this->xobjid][
'extgstates'][$n] = $this->extgstates[$n];
 
18754           if ($this->pdfa_mode OR ($this->state != 2)) {
 
18758           $this->_out(sprintf(
'/GS%d gs', $gs));
 
18767           foreach ($this->extgstates as 
$i => $ext) {
 
18768                $this->extgstates[
$i][
'n'] = $this->_newobj();
 
18769                $out = 
'<< /Type /ExtGState';
 
18770                foreach ($ext[
'parms'] as $k => $v) {
 
18771                     if (is_float($v)) {
 
18772                          $v = sprintf(
'%F', $v);
 
18773                     } 
elseif ($v === 
true) {
 
18775                     } 
elseif ($v === 
false) {
 
18778                     $out .= 
' /'.$k.
' '.$v;
 
18781                $out .= 
"\n".
'endobj';
 
18796           if ($this->state != 2) {
 
18799           $stroking = $stroking ? 
true : 
false;
 
18800           if ($this->empty_string($nonstroking)) {
 
18802                $nonstroking = $stroking;
 
18804                $nonstroking = $nonstroking ? 
true : 
false;
 
18809           $this->overprint = array(
'OP' => $stroking, 
'op' => $nonstroking, 
'OPM' => 
$mode);
 
18810           $gs = $this->addExtGState($this->overprint);
 
18811           $this->setExtGState($gs);
 
18822           return $this->overprint;
 
18834      public function setAlpha($stroking=1, $bm=
'Normal', $nonstroking=
'', $ais=
false) {
 
18835           if ($this->pdfa_mode) {
 
18839           $stroking = floatval($stroking);
 
18840           if ($this->empty_string($nonstroking)) {
 
18842                $nonstroking = $stroking;
 
18844                $nonstroking = floatval($nonstroking);
 
18846           if ($bm[0] == 
'/') {
 
18848                $bm = substr($bm, 1);
 
18850           if (!in_array($bm, array(
'Normal', 
'Multiply', 
'Screen', 
'Overlay', 
'Darken', 
'Lighten', 
'ColorDodge', 
'ColorBurn', 
'HardLight', 
'SoftLight', 
'Difference', 
'Exclusion', 
'Hue', 
'Saturation', 
'Color', 
'Luminosity'))) {
 
18853           $ais = $ais ? 
true : 
false;
 
18854           $this->alpha = array(
'CA' => $stroking, 
'ca' => $nonstroking, 
'BM' => 
'/'.$bm, 
'AIS' => $ais);
 
18855           $gs = $this->addExtGState($this->alpha);
 
18856           $this->setExtGState($gs);
 
18867           return $this->alpha;
 
18877           if (($quality < 1) OR ($quality > 100)) {
 
18880           $this->jpeg_quality = intval($quality);
 
18890           $this->default_table_columns = intval($cols);
 
18900           $this->cell_height_ratio = $h;
 
18909           return $this->cell_height_ratio;
 
18919           if ($this->pdfa_mode) {
 
18921                $this->PDFVersion = 
'1.4';
 
18923                $this->PDFVersion = $version;
 
18937           $this->viewer_preferences = $preferences;
 
18953      public function colorRegistrationBar($x, $y, $w, $h, $transition=
true, $vertical=
false, 
$colors=
'A,R,G,B,C,M,Y,K') {
 
18954           $bars = explode(
',', 
$colors);
 
18955           $numbars = count($bars); 
 
18958                $coords = array(0, 0, 0, 1);
 
18959                $wb = $w / $numbars; 
 
18964                $coords = array(1, 0, 0, 0);
 
18966                $hb = $h / $numbars; 
 
18972           foreach ($bars as $col) {
 
18976                          $col_a = array(255);
 
18982                          $col_b = array(255);
 
18986                          $col_a = array(255,255,255);
 
18987                          $col_b = array(255,0,0);
 
18991                          $col_a = array(255,255,255);
 
18992                          $col_b = array(0,255,0);
 
18996                          $col_a = array(255,255,255);
 
18997                          $col_b = array(0,0,255);
 
19001                          $col_a = array(0,0,0,0);
 
19002                          $col_b = array(100,0,0,0);
 
19006                          $col_a = array(0,0,0,0);
 
19007                          $col_b = array(0,100,0,0);
 
19011                          $col_a = array(0,0,0,0);
 
19012                          $col_b = array(0,0,100,0);
 
19016                          $col_a = array(0,0,0,0);
 
19017                          $col_b = array(0,0,0,100);
 
19021                          $col_a = array(255);
 
19028                     $this->LinearGradient($xb, $yb, $wb, $hb, $col_a, $col_b, $coords);
 
19031                     $this->SetFillColorArray($col_b);
 
19032                     $this->Rect($xb, $yb, $wb, $hb, 
'F', array());
 
19051      public function cropMark($x, $y, $w, $h, $type=
'T,R,B,L', $color=array(0,0,0)) {
 
19052           $this->SetLineStyle(array(
'width' => (0.5 / $this->k), 
'cap' => 
'butt', 
'join' => 
'miter', 
'dash' => 0, 
'color' => $color));
 
19053           $type = strtoupper($type);
 
19054           $type = preg_replace(
'/[^A-Z\-\,]*/', 
'', $type);
 
19056           $type = str_replace(
'-', 
',', $type);
 
19057           $type = str_replace(
'TL', 
'T,L', $type);
 
19058           $type = str_replace(
'TR', 
'T,R', $type);
 
19059           $type = str_replace(
'BL', 
'F,L', $type);
 
19060           $type = str_replace(
'BR', 
'F,R', $type);
 
19061           $type = str_replace(
'A', 
'T,L', $type);
 
19062           $type = str_replace(
'B', 
'T,R', $type);
 
19063           $type = str_replace(
'T,RO', 
'BO', $type);
 
19064           $type = str_replace(
'C', 
'F,L', $type);
 
19065           $type = str_replace(
'D', 
'F,R', $type);
 
19066           $crops = explode(
',', strtoupper($type));
 
19068           $crops = array_unique($crops);
 
19071           foreach ($crops as $crop) {
 
19106                $this->Line($x1, $y1, $x2, $y2);
 
19122      public function registrationMark($x, $y, $r, $double=
false, $cola=array(0,0,0), $colb=array(255,255,255)) {
 
19123           $line_style = array(
'width' => (0.5 / $this->k), 
'cap' => 
'butt', 
'join' => 
'miter', 
'dash' => 0, 
'color' => $cola);
 
19124           $this->SetFillColorArray($cola);
 
19125           $this->PieSector($x, $y, $r, 90, 180, 
'F');
 
19126           $this->PieSector($x, $y, $r, 270, 360, 
'F');
 
19127           $this->Circle($x, $y, $r, 0, 360, 
'C', $line_style, array(), 8);
 
19130                $this->SetFillColorArray($colb);
 
19131                $this->PieSector($x, $y, $r2, 90, 180, 
'F');
 
19132                $this->PieSector($x, $y, $r2, 270, 360, 
'F');
 
19133                $this->SetFillColorArray($cola);
 
19134                $this->PieSector($x, $y, $r2, 0, 90, 
'F');
 
19135                $this->PieSector($x, $y, $r2, 180, 270, 
'F');
 
19136                $this->Circle($x, $y, $r2, 0, 360, 
'C', $line_style, array(), 8);
 
19153      public function LinearGradient($x, $y, $w, $h, $col1=array(), $col2=array(), $coords=array(0,0,1,0)) {
 
19154           $this->Clip($x, $y, $w, $h);
 
19155           $this->Gradient(2, $coords, array(array(
'color' => $col1, 
'offset' => 0, 
'exponent' => 1), array(
'color' => $col2, 
'offset' => 1, 
'exponent' => 1)), array(), 
false);
 
19171      public function RadialGradient($x, $y, $w, $h, $col1=array(), $col2=array(), $coords=array(0.5,0.5,0.5,0.5,1)) {
 
19172           $this->Clip($x, $y, $w, $h);
 
19173           $this->Gradient(3, $coords, array(array(
'color' => $col1, 
'offset' => 0, 
'exponent' => 1), array(
'color' => $col2, 
'offset' => 1, 
'exponent' => 1)), array(), 
false);
 
19194      public function CoonsPatchMesh($x, $y, $w, $h, $col1=array(), $col2=array(), $col3=array(), $col4=array(), $coords=array(0.00,0.0,0.33,0.00,0.67,0.00,1.00,0.00,1.00,0.33,1.00,0.67,1.00,1.00,0.67,1.00,0.33,1.00,0.00,1.00,0.00,0.67,0.00,0.33), $coords_min=0, $coords_max=1, $antialias=
false) {
 
19195           if ($this->pdfa_mode OR ($this->state != 2)) {
 
19198           $this->Clip($x, $y, $w, $h);
 
19199           $n = count($this->gradients) + 1;
 
19200           $this->gradients[$n] = array();
 
19201           $this->gradients[$n][
'type'] = 6; 
 
19202           $this->gradients[$n][
'coords'] = array();
 
19203           $this->gradients[$n][
'antialias'] = $antialias;
 
19204           $this->gradients[$n][
'colors'] = array();
 
19205           $this->gradients[$n][
'transparency'] = 
false;
 
19207           if (!isset($coords[0][
'f'])) {
 
19209                if (!isset($col1[1])) {
 
19210                     $col1[1] = $col1[2] = $col1[0];
 
19212                if (!isset($col2[1])) {
 
19213                     $col2[1] = $col2[2] = $col2[0];
 
19215                if (!isset($col3[1])) {
 
19216                     $col3[1] = $col3[2] = $col3[0];
 
19218                if (!isset($col4[1])) {
 
19219                     $col4[1] = $col4[2] = $col4[0];
 
19221                $patch_array[0][
'f'] = 0;
 
19222                $patch_array[0][
'points'] = $coords;
 
19223                $patch_array[0][
'colors'][0][
'r'] = $col1[0];
 
19224                $patch_array[0][
'colors'][0][
'g'] = $col1[1];
 
19225                $patch_array[0][
'colors'][0][
'b'] = $col1[2];
 
19226                $patch_array[0][
'colors'][1][
'r'] = $col2[0];
 
19227                $patch_array[0][
'colors'][1][
'g'] = $col2[1];
 
19228                $patch_array[0][
'colors'][1][
'b'] = $col2[2];
 
19229                $patch_array[0][
'colors'][2][
'r'] = $col3[0];
 
19230                $patch_array[0][
'colors'][2][
'g'] = $col3[1];
 
19231                $patch_array[0][
'colors'][2][
'b'] = $col3[2];
 
19232                $patch_array[0][
'colors'][3][
'r'] = $col4[0];
 
19233                $patch_array[0][
'colors'][3][
'g'] = $col4[1];
 
19234                $patch_array[0][
'colors'][3][
'b'] = $col4[2];
 
19237                $patch_array = $coords;
 
19241           $this->gradients[$n][
'stream'] = 
'';
 
19242           $count_patch = count($patch_array);
 
19243           for (
$i=0; 
$i < $count_patch; ++
$i) {
 
19244                $this->gradients[$n][
'stream'] .= chr($patch_array[
$i][
'f']); 
 
19245                $count_points = count($patch_array[$i][
'points']);
 
19246                for ($j=0; $j < $count_points; ++$j) {
 
19248                     $patch_array[
$i][
'points'][$j] = (($patch_array[
$i][
'points'][$j] - $coords_min) / ($coords_max - $coords_min)) * $bpcd;
 
19249                     if ($patch_array[$i][
'points'][$j] < 0) {
 
19250                          $patch_array[
$i][
'points'][$j] = 0;
 
19252                     if ($patch_array[$i][
'points'][$j] > $bpcd) {
 
19253                          $patch_array[
$i][
'points'][$j] = $bpcd;
 
19255                     $this->gradients[$n][
'stream'] .= chr(floor($patch_array[$i][
'points'][$j] / 256));
 
19256                     $this->gradients[$n][
'stream'] .= chr(floor($patch_array[$i][
'points'][$j] % 256));
 
19258                $count_cols = count($patch_array[$i][
'colors']);
 
19259                for ($j=0; $j < $count_cols; ++$j) {
 
19261                     $this->gradients[$n][
'stream'] .= chr($patch_array[$i][
'colors'][$j][
'r']);
 
19262                     $this->gradients[$n][
'stream'] .= chr($patch_array[$i][
'colors'][$j][
'g']);
 
19263                     $this->gradients[$n][
'stream'] .= chr($patch_array[$i][
'colors'][$j][
'b']);
 
19267           $this->_out(
'/Sh'.$n.
' sh');
 
19270           if ($this->inxobj) {
 
19272                $this->xobjects[$this->xobjid][
'gradients'][$n] = $this->gradients[$n];
 
19286      protected function Clip($x, $y, $w, $h) {
 
19287           if ($this->state != 2) {
 
19291                $x = $this->w - $x - $w;
 
19296           $s .= sprintf(
' %F %F %F %F re W n', $x*$this->k, ($this->h-$y)*$this->k, $w*$this->k, -$h*$this->k);
 
19298           $s .= sprintf(
' %F 0 0 %F %F %F cm', $w*$this->k, $h*$this->k, $x*$this->k, ($this->h-($y+$h))*$this->k);
 
19313      public function Gradient($type, $coords, $stops, $background=array(), $antialias=
false) {
 
19314           if ($this->pdfa_mode OR ($this->state != 2)) {
 
19317           $n = count($this->gradients) + 1;
 
19318           $this->gradients[$n] = array();
 
19319           $this->gradients[$n][
'type'] = $type;
 
19320           $this->gradients[$n][
'coords'] = $coords;
 
19321           $this->gradients[$n][
'antialias'] = $antialias;
 
19322           $this->gradients[$n][
'colors'] = array();
 
19323           $this->gradients[$n][
'transparency'] = 
false;
 
19325           $numcolspace = count($stops[0][
'color']);
 
19326           $bcolor = array_values($background);
 
19327           switch($numcolspace) {
 
19329                     $this->gradients[$n][
'colspace'] = 
'DeviceCMYK';
 
19330                     if (!empty($background)) {
 
19331                          $this->gradients[$n][
'background'] = sprintf(
'%F %F %F %F', $bcolor[0]/100, $bcolor[1]/100, $bcolor[2]/100, $bcolor[3]/100);
 
19336                     $this->gradients[$n][
'colspace'] = 
'DeviceRGB';
 
19337                     if (!empty($background)) {
 
19338                          $this->gradients[$n][
'background'] = sprintf(
'%F %F %F', $bcolor[0]/255, $bcolor[1]/255, $bcolor[2]/255);
 
19343                     $this->gradients[$n][
'colspace'] = 
'DeviceGray';
 
19344                     if (!empty($background)) {
 
19345                          $this->gradients[$n][
'background'] = sprintf(
'%F', $bcolor[0]/255);
 
19350           $num_stops = count($stops);
 
19351           $last_stop_id = $num_stops - 1;
 
19352           foreach ($stops as $key => $stop) {
 
19353                $this->gradients[$n][
'colors'][$key] = array();
 
19355                if (isset($stop[
'offset'])) {
 
19356                     $this->gradients[$n][
'colors'][$key][
'offset'] = $stop[
'offset'];
 
19359                          $this->gradients[$n][
'colors'][$key][
'offset'] = 0;
 
19360                     } 
elseif ($key == $last_stop_id) {
 
19361                          $this->gradients[$n][
'colors'][$key][
'offset'] = 1;
 
19363                          $offsetstep = (1 - $this->gradients[$n][
'colors'][($key - 1)][
'offset']) / ($num_stops - $key);
 
19364                          $this->gradients[$n][
'colors'][$key][
'offset'] = $this->gradients[$n][
'colors'][($key - 1)][
'offset'] + $offsetstep;
 
19367                if (isset($stop[
'opacity'])) {
 
19368                     $this->gradients[$n][
'colors'][$key][
'opacity'] = $stop[
'opacity'];
 
19369                     if ((!$this->pdfa_mode) AND ($stop[
'opacity'] < 1)) {
 
19370                          $this->gradients[$n][
'transparency'] = 
true;
 
19373                     $this->gradients[$n][
'colors'][$key][
'opacity'] = 1;
 
19376                if (isset($stop[
'exponent'])) {
 
19377                     $this->gradients[$n][
'colors'][$key][
'exponent'] = $stop[
'exponent'];
 
19379                     $this->gradients[$n][
'colors'][$key][
'exponent'] = 1;
 
19382                $color = array_values($stop[
'color']);
 
19383                switch($numcolspace) {
 
19385                          $this->gradients[$n][
'colors'][$key][
'color'] = sprintf(
'%F %F %F %F', $color[0]/100, $color[1]/100, $color[2]/100, $color[3]/100);
 
19389                          $this->gradients[$n][
'colors'][$key][
'color'] = sprintf(
'%F %F %F', $color[0]/255, $color[1]/255, $color[2]/255);
 
19393                          $this->gradients[$n][
'colors'][$key][
'color'] = sprintf(
'%F', $color[0]/255);
 
19398           if ($this->gradients[$n][
'transparency']) {
 
19400                $this->_out(
'/TGS'.$n.
' gs');
 
19403           $this->_out(
'/Sh'.$n.
' sh');
 
19406           if ($this->inxobj) {
 
19408                $this->xobjects[$this->xobjid][
'gradients'][$n] = $this->gradients[$n];
 
19419           if ($this->pdfa_mode) {
 
19422           $idt = count($this->gradients); 
 
19423           foreach ($this->gradients as 
$id => $grad) {
 
19424                if (($grad[
'type'] == 2) OR ($grad[
'type'] == 3)) {
 
19425                     $fc = $this->_newobj();
 
19427                     $out .= 
' /FunctionType 3';
 
19428                     $out .= 
' /Domain [0 1]';
 
19433                     $num_cols = count($grad[
'colors']);
 
19434                     $lastcols = $num_cols - 1;
 
19435                     for (
$i = 1; 
$i < $num_cols; ++
$i) {
 
19436                          $functions .= ($fc + 
$i).
' 0 R ';
 
19437                          if (
$i < $lastcols) {
 
19438                               $bounds .= sprintf(
'%F ', $grad[
'colors'][
$i][
'offset']);
 
19442                     $out .= 
' /Functions ['.trim($functions).
']';
 
19443                     $out .= 
' /Bounds ['.trim($bounds).
']';
 
19444                     $out .= 
' /Encode ['.trim($encode).
']';
 
19446                     $out .= 
"\n".
'endobj';
 
19448                     for (
$i = 1; 
$i < $num_cols; ++
$i) {
 
19451                          $out .= 
' /FunctionType 2';
 
19452                          $out .= 
' /Domain [0 1]';
 
19453                          $out .= 
' /C0 ['.$grad[
'colors'][(
$i - 1)][
'color'].
']';
 
19454                          $out .= 
' /C1 ['.$grad[
'colors'][
$i][
'color'].
']';
 
19455                          $out .= 
' /N '.$grad[
'colors'][
$i][
'exponent'];
 
19457                          $out .= 
"\n".
'endobj';
 
19461                     if ($grad[
'transparency']) {
 
19462                          $ft = $this->_newobj();
 
19464                          $out .= 
' /FunctionType 3';
 
19465                          $out .= 
' /Domain [0 1]';
 
19468                          $num_cols = count($grad[
'colors']);
 
19469                          for (
$i = 1; 
$i < $num_cols; ++
$i) {
 
19470                               $functions .= ($ft + 
$i).
' 0 R ';
 
19472                          $out .= 
' /Functions ['.trim($functions).
']';
 
19473                          $out .= 
' /Bounds ['.trim($bounds).
']';
 
19474                          $out .= 
' /Encode ['.trim($encode).
']';
 
19476                          $out .= 
"\n".
'endobj';
 
19478                          for (
$i = 1; 
$i < $num_cols; ++
$i) {
 
19481                               $out .= 
' /FunctionType 2';
 
19482                               $out .= 
' /Domain [0 1]';
 
19483                               $out .= 
' /C0 ['.$grad[
'colors'][(
$i - 1)][
'opacity'].
']';
 
19484                               $out .= 
' /C1 ['.$grad[
'colors'][
$i][
'opacity'].
']';
 
19485                               $out .= 
' /N '.$grad[
'colors'][
$i][
'exponent'];
 
19487                               $out .= 
"\n".
'endobj';
 
19494                $out = 
'<< /ShadingType '.$grad[
'type'];
 
19495                if (isset($grad[
'colspace'])) {
 
19496                     $out .= 
' /ColorSpace /'.$grad[
'colspace'];
 
19498                     $out .= 
' /ColorSpace /DeviceRGB';
 
19500                if (isset($grad[
'background']) AND !empty($grad[
'background'])) {
 
19501                     $out .= 
' /Background ['.$grad[
'background'].
']';
 
19503                if (isset($grad[
'antialias']) AND ($grad[
'antialias'] === 
true)) {
 
19504                     $out .= 
' /AntiAlias true';
 
19506                if ($grad[
'type'] == 2) {
 
19507                     $out .= 
' '.sprintf(
'/Coords [%F %F %F %F]', $grad[
'coords'][0], $grad[
'coords'][1], $grad[
'coords'][2], $grad[
'coords'][3]);
 
19508                     $out .= 
' /Domain [0 1]';
 
19509                     $out .= 
' /Function '.$fc.
' 0 R';
 
19510                     $out .= 
' /Extend [true true]';
 
19512                } 
elseif ($grad[
'type'] == 3) {
 
19515                     $out .= 
' '.sprintf(
'/Coords [%F %F 0 %F %F %F]', $grad[
'coords'][0], $grad[
'coords'][1], $grad[
'coords'][2], $grad[
'coords'][3], $grad[
'coords'][4]);
 
19516                     $out .= 
' /Domain [0 1]';
 
19517                     $out .= 
' /Function '.$fc.
' 0 R';
 
19518                     $out .= 
' /Extend [true true]';
 
19520                } 
elseif ($grad[
'type'] == 6) {
 
19521                     $out .= 
' /BitsPerCoordinate 16';
 
19522                     $out .= 
' /BitsPerComponent 8';
 
19523                     $out .= 
' /Decode[0 1 0 1 0 1 0 1 0 1]';
 
19524                     $out .= 
' /BitsPerFlag 8';
 
19525                     $stream = $this->_getrawstream($grad[
'stream']);
 
19526                     $out .= 
' /Length '.strlen($stream);
 
19528                     $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
19530                $out .= 
"\n".
'endobj';
 
19532                if ($grad[
'transparency']) {
 
19533                     $shading_transparency = preg_replace(
'/\/ColorSpace \/[^\s]+/si', 
'/ColorSpace /DeviceGray', $out);
 
19534                     $shading_transparency = preg_replace(
'/\/Function [0-9]+ /si', 
'/Function '.$ft.
' ', $shading_transparency);
 
19536                $this->gradients[
$id][
'id'] = $this->n;
 
19539                $out = 
'<< /Type /Pattern /PatternType 2';
 
19540                $out .= 
' /Shading '.$this->gradients[
$id][
'id'].
' 0 R';
 
19542                $out .= 
"\n".
'endobj';
 
19544                $this->gradients[
$id][
'pattern'] = $this->n;
 
19546                if ($grad[
'transparency']) {
 
19548                     $idgs = 
$id + $idt;
 
19550                     $this->_out($shading_transparency);
 
19551                     $this->gradients[$idgs][
'id'] = $this->n;
 
19553                     $out = 
'<< /Type /Pattern /PatternType 2';
 
19554                     $out .= 
' /Shading '.$this->gradients[$idgs][
'id'].
' 0 R';
 
19556                     $out .= 
"\n".
'endobj';
 
19558                     $this->gradients[$idgs][
'pattern'] = $this->n;
 
19560                     $oid = $this->_newobj();
 
19561                     $this->xobjects[
'LX'.$oid] = array(
'n' => $oid);
 
19563                     $stream = 
'q /a0 gs /Pattern cs /p'.$idgs.
' scn 0 0 '.$this->wPt.
' '.$this->hPt.
' re f Q';
 
19564                     if ($this->compress) {
 
19565                          $filter = 
' /Filter /FlateDecode';
 
19566                          $stream = gzcompress($stream);
 
19568                     $stream = $this->_getrawstream($stream);
 
19569                     $out = 
'<< /Type /XObject /Subtype /Form /FormType 1'.$filter;
 
19570                     $out .= 
' /Length '.strlen($stream);
 
19571                     $rect = sprintf(
'%F %F', $this->wPt, $this->hPt);
 
19572                     $out .= 
' /BBox [0 0 '.$rect.
']';
 
19573                     $out .= 
' /Group << /Type /Group /S /Transparency /CS /DeviceGray >>';
 
19574                     $out .= 
' /Resources <<';
 
19575                     $out .= 
' /ExtGState << /a0 << /ca 1 /CA 1 >> >>';
 
19576                     $out .= 
' /Pattern << /p'.$idgs.
' '.$this->gradients[$idgs][
'pattern'].
' 0 R >>';
 
19579                     $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
19580                     $out .= 
"\n".
'endobj';
 
19584                     $out = 
'<< /Type /Mask /S /Luminosity /G '.($this->n - 1).
' 0 R >>'.
"\n".
'endobj';
 
19588                     $out = 
'<< /Type /ExtGState /SMask '.($this->n - 1).
' 0 R /AIS false >>'.
"\n".
'endobj';
 
19590                     $this->extgstates[] = array(
'n' => $this->n, 
'name' => 
'TGS'.
$id);
 
19610      public function PieSector($xc, $yc, $r, $a, $b, $style=
'FD', $cw=
true, $o=90) {
 
19611           $this->PieSectorXY($xc, $yc, $r, $r, $a, $b, $style, $cw, $o);
 
19631      public function PieSectorXY($xc, $yc, $rx, $ry, $a, $b, $style=
'FD', $cw=
false, $o=0, $nc=2) {
 
19632           if ($this->state != 2) {
 
19636                $xc = ($this->w - $xc);
 
19638           $op = $this->getPathPaintOperator($style);
 
19640                $line_style = array();
 
19644                $b = (360 - $a + $o);
 
19645                $a = (360 - $d + $o);
 
19650           $this->_outellipticalarc($xc, $yc, $rx, $ry, 0, $a, $b, 
true, $nc);
 
19675      public function ImageEps($file, $x=
'', $y=
'', $w=0, $h=0, $link=
'', $useBoundingBox=
true, $align=
'', $palign=
'', $border=0, $fitonpage=
false, $fixoutvals=
false) {
 
19676           if ($this->state != 2) {
 
19679           if ($this->rasterize_vector_images AND ($w > 0) AND ($h > 0)) {
 
19681                return $this->Image($file, $x, $y, $w, $h, 
'EPS', $link, $align, 
true, 300, $palign, 
false, 
false, $border, 
false, 
false, $fitonpage);
 
19690           list($x, $y) = $this->checkPageRegions($h, $x, $y);
 
19692           if ($file{0} === 
'@') { 
 
19693                $data = substr($file, 1);
 
19695                $data = file_get_contents($file);
 
19697           if (
$data === 
false) {
 
19698                $this->Error(
'EPS file not found: '.$file);
 
19702           preg_match(
"/%%Creator:([^\r\n]+)/", 
$data, $regs); # find Creator
 
19703           if (count($regs) > 1) {
 
19704                $version_str = trim($regs[1]); # e.g. 
"Adobe Illustrator(R) 8.0" 
19705                if (strpos($version_str, 
'Adobe Illustrator') !== 
false) {
 
19706                     $versexp = explode(
' ', $version_str);
 
19707                     $version = (float)array_pop($versexp);
 
19708                     if ($version >= 9) {
 
19709                          $this->Error(
'This version of Adobe Illustrator file is not supported: '.$file);
 
19719           preg_match(
"/%%BoundingBox:([^\r\n]+)/", 
$data, $regs);
 
19720           if (count($regs) > 1) {
 
19721                list($x1, $y1, $x2, $y2) = explode(
' ', trim($regs[1]));
 
19723                $this->Error(
'No BoundingBox found in EPS/AI file: '.$file);
 
19733           $end = strpos(
$data, 
'%%PageTrailer');
 
19734           if ($end===
false) {
 
19735                $end = strpos(
$data, 
'showpage');
 
19741           if (($w <= 0) AND ($h <= 0)) {
 
19742                $w = ($x2 - $x1) / $k;
 
19743                $h = ($y2 - $y1) / $k;
 
19745                $w = ($x2-$x1) / $k * ($h / (($y2 - $y1) / $k));
 
19747                $h = ($y2 - $y1) / $k * ($w / (($x2 - $x1) / $k));
 
19750           list($w, $h, $x, $y) = $this->fitBlock($w, $h, $x, $y, $fitonpage);
 
19751           if ($this->rasterize_vector_images) {
 
19753                return $this->Image($file, $x, $y, $w, $h, 
'EPS', $link, $align, 
true, 300, $palign, 
false, 
false, $border, 
false, 
false, $fitonpage);
 
19756           $scale_x = $w / (($x2 - $x1) / $k);
 
19757           $scale_y = $h / (($y2 - $y1) / $k);
 
19759           $this->img_rb_y = $y + $h;
 
19762                if ($palign == 
'L') {
 
19763                     $ximg = $this->lMargin;
 
19764                } 
elseif ($palign == 
'C') {
 
19765                     $ximg = ($this->w + $this->lMargin - $this->rMargin - $w) / 2;
 
19766                } 
elseif ($palign == 
'R') {
 
19767                     $ximg = $this->w - $this->rMargin - $w;
 
19771                $this->img_rb_x = $ximg;
 
19773                if ($palign == 
'L') {
 
19774                     $ximg = $this->lMargin;
 
19775                } 
elseif ($palign == 
'C') {
 
19776                     $ximg = ($this->w + $this->lMargin - $this->rMargin - $w) / 2;
 
19777                } 
elseif ($palign == 
'R') {
 
19778                     $ximg = $this->w - $this->rMargin - $w;
 
19782                $this->img_rb_x = $ximg + $w;
 
19784           if ($useBoundingBox) {
 
19785                $dx = $ximg * $k - $x1;
 
19786                $dy = $y * $k - $y1;
 
19792           $this->_out(
'q'.$this->epsmarker);
 
19794           $this->_out(sprintf(
'%F %F %F %F %F %F cm', 1, 0, 0, 1, $dx, $dy + ($this->hPt - (2 * $y * $k) - ($y2 - $y1))));
 
19796           if (isset($scale_x)) {
 
19797                $this->_out(sprintf(
'%F %F %F %F %F %F cm', $scale_x, 0, 0, $scale_y, $x1 * (1 - $scale_x), $y2 * (1 - $scale_y)));
 
19800           $lines = preg_split(
'/[\r\n]+/si', 
$data, -1, PREG_SPLIT_NO_EMPTY);
 
19802           $cnt = count($lines);
 
19803           for (
$i=0; 
$i < $cnt; ++
$i) {
 
19804                $line = $lines[
$i];
 
19805                if (($line == 
'') OR ($line{0} == 
'%')) {
 
19808                $len = strlen($line);
 
19811                if (strcasecmp(
'x', substr(trim($line), -1)) == 0) {
 
19812                     if (preg_match(
'/\([^\)]*\)/', $line, $matches) > 0) {
 
19814                          $color_name = $matches[0];
 
19816                          $line = str_replace(
' '.$color_name, 
'', $line);
 
19818                          $color_name = substr($color_name, 1, -1);
 
19821                $chunks = explode(
' ', $line);
 
19822                $cmd = trim(array_pop($chunks));
 
19824                if (($cmd == 
'Xa') OR ($cmd == 
'XA')) {
 
19825                     $b = array_pop($chunks);
 
19826                     $g = array_pop($chunks);
 
19827                     $r = array_pop($chunks);
 
19828                     $this->_out(
''.$r.
' '.$g.
' '.$b.
' '.($cmd==
'Xa'?
'rg':
'RG')); 
 
19839                               foreach ($chunks as $key => $val) {
 
19840                                    if ((($key % 2) == 0) AND (($val < $x1) OR ($val > $x2))) {
 
19842                                    } 
elseif ((($key % 2) != 0) AND (($val < $y1) OR ($val > $y2))) {
 
19870                          $this->_out($line);
 
19874                          if (empty($color_name)) {
 
19876                               list($col_c, $col_m, $col_y, $col_k) = $chunks;
 
19877                               $this->_out(
''.$col_c.
' '.$col_m.
' '.$col_y.
' '.$col_k.
' k');
 
19880                               list($col_c, $col_m, $col_y, $col_k, $col_t) = $chunks;
 
19881                               $this->AddSpotColor($color_name, ($col_c * 100), ($col_m * 100), ($col_y * 100), ($col_k * 100));
 
19882                               $color_cmd = sprintf(
'/CS%d cs %F scn', $this->spot_colors[$color_name][
'i'], (1 - $col_t));
 
19883                               $this->_out($color_cmd);
 
19888                          if (empty($color_name)) {
 
19890                               list($col_c, $col_m, $col_y, $col_k) = $chunks;
 
19891                               $this->_out(
''.$col_c.
' '.$col_m.
' '.$col_y.
' '.$col_k.
' K');
 
19894                               list($col_c, $col_m, $col_y, $col_k, $col_t) = $chunks;
 
19895                               $this->AddSpotColor($color_name, ($col_c * 100), ($col_m * 100), ($col_y * 100), ($col_k * 100));
 
19896                               $color_cmd = sprintf(
'/CS%d CS %F SCN', $this->spot_colors[$color_name][
'i'], (1 - $col_t));
 
19897                               $this->_out($color_cmd);
 
19909                          $line[($len - 1)] = strtolower($cmd);
 
19910                          $this->_out($line);
 
19915                          $this->_out($cmd . 
'*');
 
19922                               $max = min((
$i + 5), $cnt);
 
19923                               for ($j = (
$i + 1); $j < $max; ++$j) {
 
19924                                    $isU = ($isU OR (($lines[$j] == 
'U') OR ($lines[$j] == 
'*U')));
 
19945           $this->_out($this->epsmarker.
'Q');
 
19946           if (!empty($border)) {
 
19954                $this->Cell($w, $h, 
'', $border, 0, 
'', 0, 
'', 0, 
true);
 
19959                $this->Link($ximg, $y, $w, $h, $link, 0);
 
19965                     $this->x = $this->img_rb_x;
 
19969                     $this->y = $y + round($h/2);
 
19970                     $this->x = $this->img_rb_x;
 
19974                     $this->y = $this->img_rb_y;
 
19975                     $this->x = $this->img_rb_x;
 
19979                     $this->SetY($this->img_rb_y);
 
19986           $this->endlinex = $this->img_rb_x;
 
19995           $this->barcode = $bc;
 
20005           return $this->barcode;
 
20038      public function write1DBarcode($code, $type, $x=
'', $y=
'', $w=
'', $h=
'', $xres=
'', $style=
'', $align=
'') {
 
20039           if ($this->empty_string(trim($code))) {
 
20042           require_once(dirname(__FILE__).
'/barcodes.php');
 
20044           $gvars = $this->getGraphicVars();
 
20047           $arrcode = $barcodeobj->getBarcodeArray();
 
20048           if (($arrcode === 
false) OR empty($arrcode) OR ($arrcode[
'maxw'] == 0)) {
 
20049                $this->Error(
'Error in 1D barcode string');
 
20052           if (!isset($style[
'position'])) {
 
20053                $style[
'position'] = 
'';
 
20054           } 
elseif ($style[
'position'] == 
'S') {
 
20056                $style[
'position'] = 
'';
 
20057                $style[
'stretch'] = 
true;
 
20059           if (!isset($style[
'fitwidth'])) {
 
20060                if (!isset($style[
'stretch'])) {
 
20061                     $style[
'fitwidth'] = 
true;
 
20063                     $style[
'fitwidth'] = 
false;
 
20066           if ($style[
'fitwidth']) {
 
20068                $style[
'stretch'] = 
false;
 
20070           if (!isset($style[
'stretch'])) {
 
20071                if (($w === 
'') OR ($w <= 0)) {
 
20072                     $style[
'stretch'] = 
false;
 
20074                     $style[
'stretch'] = 
true;
 
20077           if (!isset($style[
'fgcolor'])) {
 
20078                $style[
'fgcolor'] = array(0,0,0); 
 
20080           if (!isset($style[
'bgcolor'])) {
 
20081                $style[
'bgcolor'] = 
false; 
 
20083           if (!isset($style[
'border'])) {
 
20084                $style[
'border'] = 
false;
 
20087           if (!isset($style[
'text'])) {
 
20088                $style[
'text'] = 
false;
 
20090           if ($style[
'text'] AND isset($style[
'font'])) {
 
20091                if (isset($style[
'fontsize'])) {
 
20092                     $fontsize = $style[
'fontsize'];
 
20094                $this->SetFont($style[
'font'], 
'', $fontsize);
 
20096           if (!isset($style[
'stretchtext'])) {
 
20097                $style[
'stretchtext'] = 4;
 
20106           list($x, $y) = $this->checkPageRegions($h, $x, $y);
 
20107           if (($w === 
'') OR ($w <= 0)) {
 
20109                     $w = $x - $this->lMargin;
 
20111                     $w = $this->w - $this->rMargin - $x;
 
20115           if (!isset($style[
'padding'])) {
 
20117           } 
elseif ($style[
'padding'] === 
'auto') {
 
20118                $padding = 10 * ($w / ($arrcode[
'maxw'] + 20));
 
20120                $padding = floatval($style[
'padding']);
 
20123           if (!isset($style[
'hpadding'])) {
 
20124                $hpadding = $padding;
 
20125           } 
elseif ($style[
'hpadding'] === 
'auto') {
 
20126                $hpadding = 10 * ($w / ($arrcode[
'maxw'] + 20));
 
20128                $hpadding = floatval($style[
'hpadding']);
 
20131           if (!isset($style[
'vpadding'])) {
 
20132                $vpadding = $padding;
 
20133           } 
elseif ($style[
'vpadding'] === 
'auto') {
 
20134                $vpadding = ($hpadding / 2);
 
20136                $vpadding = floatval($style[
'vpadding']);
 
20139           $max_xres = ($w - (2 * $hpadding)) / $arrcode[
'maxw'];
 
20140           if ($style[
'stretch']) {
 
20143                if ($this->empty_string($xres)) {
 
20144                     $xres = (0.141 * $this->k); 
 
20146                if ($xres > $max_xres) {
 
20150                if ((isset($style[
'padding']) AND ($style[
'padding'] === 
'auto'))
 
20151                     OR (isset($style[
'hpadding']) AND ($style[
'hpadding'] === 
'auto'))) {
 
20152                     $hpadding = 10 * $xres;
 
20153                     if (isset($style[
'vpadding']) AND ($style[
'vpadding'] === 
'auto')) {
 
20154                          $vpadding = ($hpadding / 2);
 
20158           if ($style[
'fitwidth']) {
 
20160                $w = (($arrcode[
'maxw'] * $xres) + (2 * $hpadding));
 
20161                if (isset($style[
'cellfitalign'])) {
 
20162                     switch ($style[
'cellfitalign']) {
 
20165                                    $x -= ($wold - $w);
 
20171                                    $x += ($wold - $w);
 
20177                                    $x -= (($wold - $w) / 2);
 
20179                                    $x += (($wold - $w) / 2);
 
20189           $text_height = ($this->cell_height_ratio * $fontsize / $this->k);
 
20191           if (($h === 
'') OR ($h <= 0)) {
 
20193                $h = (($arrcode[
'maxw'] * $xres) / 3) + (2 * $vpadding) + $text_height;
 
20195           $barh = $h - $text_height - (2 * $vpadding);
 
20198                if ($text_height > $h) {
 
20199                     $fontsize = (($h * $this->k) / (4 * $this->cell_height_ratio));
 
20200                     $text_height = ($this->cell_height_ratio * $fontsize / $this->k);
 
20201                     $this->SetFont($style[
'font'], 
'', $fontsize);
 
20203                if ($vpadding > 0) {
 
20204                     $vpadding = (($h - $text_height) / 4);
 
20206                $barh = $h - $text_height - (2 * $vpadding);
 
20209           list($w, $h, $x, $y) = $this->fitBlock($w, $h, $x, $y, 
false);
 
20211           $this->img_rb_y = $y + $h;
 
20214                if ($style[
'position'] == 
'L') {
 
20215                     $xpos = $this->lMargin;
 
20216                } 
elseif ($style[
'position'] == 
'C') {
 
20217                     $xpos = ($this->w + $this->lMargin - $this->rMargin - $w) / 2;
 
20218                } 
elseif ($style[
'position'] == 
'R') {
 
20219                     $xpos = $this->w - $this->rMargin - $w;
 
20223                $this->img_rb_x = $xpos;
 
20225                if ($style[
'position'] == 
'L') {
 
20226                     $xpos = $this->lMargin;
 
20227                } 
elseif ($style[
'position'] == 
'C') {
 
20228                     $xpos = ($this->w + $this->lMargin - $this->rMargin - $w) / 2;
 
20229                } 
elseif ($style[
'position'] == 
'R') {
 
20230                     $xpos = $this->w - $this->rMargin - $w;
 
20234                $this->img_rb_x = $xpos + $w;
 
20236           $xpos_rect = $xpos;
 
20237           if (!isset($style[
'align'])) {
 
20238                $style[
'align'] = 
'C';
 
20240           switch ($style[
'align']) {
 
20242                     $xpos = $xpos_rect + $hpadding;
 
20246                     $xpos = $xpos_rect + ($w - ($arrcode[
'maxw'] * $xres)) - $hpadding;
 
20251                     $xpos = $xpos_rect + (($w - ($arrcode[
'maxw'] * $xres)) / 2);
 
20255           $xpos_text = $xpos;
 
20257           $tempRTL = $this->rtl;
 
20258           $this->rtl = 
false;
 
20260           if ($style[
'bgcolor']) {
 
20261                $this->Rect($xpos_rect, $y, $w, $h, $style[
'border'] ? 
'DF' : 
'F', 
'', $style[
'bgcolor']);
 
20262           } 
elseif ($style[
'border']) {
 
20263                $this->Rect($xpos_rect, $y, $w, $h, 
'D');
 
20266           $this->SetDrawColorArray($style[
'fgcolor']);
 
20267           $this->SetTextColorArray($style[
'fgcolor']);
 
20269           foreach ($arrcode[
'bcode'] as $k => $v) {
 
20270                $bw = ($v[
'w'] * $xres);
 
20273                     $ypos = $y + $vpadding + ($v[
'p'] * $barh / $arrcode[
'maxh']);
 
20274                     $this->Rect($xpos, $ypos, $bw, ($v[
'h'] * $barh / $arrcode[
'maxh']), 
'F', array(), $style[
'fgcolor']);
 
20279           if ($style[
'text']) {
 
20280                if (isset($style[
'label']) AND !$this->empty_string($style[
'label'])) {
 
20281                     $label = $style[
'label'];
 
20285                $txtwidth = ($arrcode[
'maxw'] * $xres);
 
20286                if ($this->GetStringWidth($label) > $txtwidth) {
 
20287                     $style[
'stretchtext'] = 2;
 
20290                $this->x = $xpos_text;
 
20291                $this->y = $y + $vpadding + $barh;
 
20292                $cellpadding = $this->cell_padding;
 
20293                $this->SetCellPadding(0);
 
20294                $this->Cell($txtwidth, 
'', $label, 0, 0, 
'C', 
false, 
'', $style[
'stretchtext'], 
false, 
'T', 
'T');
 
20295                $this->cell_padding = $cellpadding;
 
20298           $this->rtl = $tempRTL;
 
20300           $this->setGraphicVars($gvars);
 
20305                     $this->x = $this->img_rb_x;
 
20309                     $this->y = $y + round($h / 2);
 
20310                     $this->x = $this->img_rb_x;
 
20314                     $this->y = $this->img_rb_y;
 
20315                     $this->x = $this->img_rb_x;
 
20319                     $this->SetY($this->img_rb_y);
 
20326           $this->endlinex = $this->img_rb_x;
 
20344      public function writeBarcode($x, $y, $w, $h, $type, $style, $font, $xres, $code) {
 
20350                'stretch' => 
false,
 
20351                'fitwidth' => 
false,
 
20352                'cellfitalign' => 
'',
 
20355                'fgcolor' => array(0,0,0),
 
20356                'bgcolor' => 
false,
 
20363                $newstyle[
'border'] = 
true;
 
20366                $newstyle[
'bgcolor'] = 
false;
 
20369                $newstyle[
'position'] = 
'C';
 
20371                $newstyle[
'position'] = 
'L';
 
20372           } 
elseif ($style & 16) {
 
20373                $newstyle[
'position'] = 
'R';
 
20375           if ($style & 128) {
 
20376                $newstyle[
'text'] = 
true;
 
20378           if ($style & 256) {
 
20379                $newstyle[
'stretchtext'] = 4;
 
20381           $this->write1DBarcode($code, $type, $x, $y, $w, $h, $xres, $newstyle, 
'');
 
20409      public function write2DBarcode($code, $type, $x=
'', $y=
'', $w=
'', $h=
'', $style=
'', $align=
'', $distort=
false) {
 
20410           if ($this->empty_string(trim($code))) {
 
20413           require_once(dirname(__FILE__).
'/2dbarcodes.php');
 
20415           $gvars = $this->getGraphicVars();
 
20418           $arrcode = $barcodeobj->getBarcodeArray();
 
20419           if (($arrcode === 
false) OR empty($arrcode) OR !isset($arrcode[
'num_rows']) OR ($arrcode[
'num_rows'] == 0) OR !isset($arrcode[
'num_cols']) OR ($arrcode[
'num_cols'] == 0)) {
 
20420                $this->Error(
'Error in 2D barcode string');
 
20423           if (!isset($style[
'position'])) {
 
20424                $style[
'position'] = 
'';
 
20426           if (!isset($style[
'fgcolor'])) {
 
20427                $style[
'fgcolor'] = array(0,0,0); 
 
20429           if (!isset($style[
'bgcolor'])) {
 
20430                $style[
'bgcolor'] = 
false; 
 
20432           if (!isset($style[
'border'])) {
 
20433                $style[
'border'] = 
false;
 
20436           if (!isset($style[
'padding'])) {
 
20437                $style[
'padding'] = 0;
 
20438           } 
elseif ($style[
'padding'] === 
'auto') {
 
20439                $style[
'padding'] = 4;
 
20441           if (!isset($style[
'hpadding'])) {
 
20442                $style[
'hpadding'] = $style[
'padding'];
 
20443           } 
elseif ($style[
'hpadding'] === 
'auto') {
 
20444                $style[
'hpadding'] = 4;
 
20446           if (!isset($style[
'vpadding'])) {
 
20447                $style[
'vpadding'] = $style[
'padding'];
 
20448           } 
elseif ($style[
'vpadding'] === 
'auto') {
 
20449                $style[
'vpadding'] = 4;
 
20451           $hpad = (2 * $style[
'hpadding']);
 
20452           $vpad = (2 * $style[
'vpadding']);
 
20454           if (!isset($style[
'module_width'])) {
 
20455                $style[
'module_width'] = 1; 
 
20457           if (!isset($style[
'module_height'])) {
 
20458                $style[
'module_height'] = 1; 
 
20467           list($x, $y) = $this->checkPageRegions($h, $x, $y);
 
20469           $rows = $arrcode[
'num_rows'];
 
20470           $cols = $arrcode[
'num_cols'];
 
20472           $mw = $style[
'module_width'];
 
20473           $mh = $style[
'module_height'];
 
20474           if (($mw == 0) OR ($mh == 0)) {
 
20475                $this->Error(
'Error in 2D barcode string');
 
20479                $maxw = $x - $this->lMargin;
 
20481                $maxw = $this->w - $this->rMargin - $x;
 
20483           $maxh = ($this->h - $this->tMargin - $this->bMargin);
 
20484           $ratioHW = ((($rows * $mh) + $hpad) / (($cols * $mw) + $vpad));
 
20485           $ratioWH = ((($cols * $mw) + $vpad) / (($rows * $mh) + $hpad));
 
20487                if (($maxw * $ratioHW) > $maxh) {
 
20488                     $maxw = $maxh * $ratioWH;
 
20490                if (($maxh * $ratioWH) > $maxw) {
 
20491                     $maxh = $maxw * $ratioHW;
 
20502           if ((($w === 
'') OR ($w <= 0)) AND (($h === 
'') OR ($h <= 0))) {
 
20503                $w = ($cols + $hpad) * ($mw / $this->k);
 
20504                $h = ($rows + $vpad) * ($mh / $this->k);
 
20505           } 
elseif (($w === 
'') OR ($w <= 0)) {
 
20506                $w = $h * $ratioWH;
 
20507           } 
elseif (($h === 
'') OR ($h <= 0)) {
 
20508                $h = $w * $ratioHW;
 
20511           $bw = ($w * $cols) / ($cols + $hpad);
 
20512           $bh = ($h * $rows) / ($rows + $vpad);
 
20517                if (($cw / $ch) > ($mw / $mh)) {
 
20519                     $cw = $ch * $mw / $mh;
 
20521                     $style[
'hpadding'] = ($w - $bw) / (2 * $cw);
 
20524                     $ch = $cw * $mh / $mw;
 
20526                     $style[
'vpadding'] = ($h - $bh) / (2 * $ch);
 
20530           list($w, $h, $x, $y) = $this->fitBlock($w, $h, $x, $y, 
false);
 
20532           $this->img_rb_y = $y + $h;
 
20535                if ($style[
'position'] == 
'L') {
 
20536                     $xpos = $this->lMargin;
 
20537                } 
elseif ($style[
'position'] == 
'C') {
 
20538                     $xpos = ($this->w + $this->lMargin - $this->rMargin - $w) / 2;
 
20539                } 
elseif ($style[
'position'] == 
'R') {
 
20540                     $xpos = $this->w - $this->rMargin - $w;
 
20544                $this->img_rb_x = $xpos;
 
20546                if ($style[
'position'] == 
'L') {
 
20547                     $xpos = $this->lMargin;
 
20548                } 
elseif ($style[
'position'] == 
'C') {
 
20549                     $xpos = ($this->w + $this->lMargin - $this->rMargin - $w) / 2;
 
20550                } 
elseif ($style[
'position'] == 
'R') {
 
20551                     $xpos = $this->w - $this->rMargin - $w;
 
20555                $this->img_rb_x = $xpos + $w;
 
20557           $xstart = $xpos + ($style[
'hpadding'] * $cw);
 
20558           $ystart = $y + ($style[
'vpadding'] * $ch);
 
20560           $tempRTL = $this->rtl;
 
20561           $this->rtl = 
false;
 
20563           if ($style[
'bgcolor']) {
 
20564                $this->Rect($xpos, $y, $w, $h, $style[
'border'] ? 
'DF' : 
'F', 
'', $style[
'bgcolor']);
 
20565           } 
elseif ($style[
'border']) {
 
20566                $this->Rect($xpos, $y, $w, $h, 
'D');
 
20569           $this->SetDrawColorArray($style[
'fgcolor']);
 
20572           for ($r = 0; $r < $rows; ++$r) {
 
20575                for ($c = 0; $c < $cols; ++$c) {
 
20576                     if ($arrcode[
'bcode'][$r][$c] == 1) {
 
20578                          $this->Rect($xr, $ystart, $cw, $ch, 
'F', array(), $style[
'fgcolor']);
 
20585           $this->rtl = $tempRTL;
 
20587           $this->setGraphicVars($gvars);
 
20592                     $this->x = $this->img_rb_x;
 
20596                     $this->y = $y + round($h/2);
 
20597                     $this->x = $this->img_rb_x;
 
20601                     $this->y = $this->img_rb_y;
 
20602                     $this->x = $this->img_rb_x;
 
20606                     $this->SetY($this->img_rb_y);
 
20613           $this->endlinex = $this->img_rb_x;
 
20637                'left' => $this->lMargin,
 
20638                'right' => $this->rMargin,
 
20639                'top' => $this->tMargin,
 
20640                'bottom' => $this->bMargin,
 
20641                'header' => $this->header_margin,
 
20642                'footer' => $this->footer_margin,
 
20643                'cell' => $this->cell_padding,
 
20644                'padding_left' => $this->cell_padding[
'L'],
 
20645                'padding_top' => $this->cell_padding[
'T'],
 
20646                'padding_right' => $this->cell_padding[
'R'],
 
20647                'padding_bottom' => $this->cell_padding[
'B']
 
20664                'left' => $this->original_lMargin,
 
20665                'right' => $this->original_rMargin
 
20677           return $this->FontSize;
 
20687           return $this->FontSizePt;
 
20697           return $this->FontFamily;
 
20707           return $this->FontStyle;
 
20722      public function fixHTMLCode($html, $default_css=
'', $tagvs=
'', $tidy_options=
'') {
 
20724           if ($tidy_options === 
'') {
 
20725                $tidy_options = array (
 
20727                     'drop-empty-paras' => 0,
 
20728                     'drop-proprietary-attributes' => 1,
 
20729                     'fix-backslash' => 1,
 
20730                     'hide-comments' => 1,
 
20731                     'join-styles' => 1,
 
20732                     'lower-literals' => 1,
 
20734                     'merge-spans' => 1,
 
20735                     'output-xhtml' => 1,
 
20745           $tidy = tidy_parse_string($html, $tidy_options);
 
20747           $tidy->cleanRepair();
 
20749           $tidy_head = tidy_get_head($tidy);
 
20750           $css = $tidy_head->value;
 
20751           $css = preg_replace(
'/<style([^>]+)>/ims', 
'<style>', $css);
 
20752           $css = preg_replace(
'/<\/style>(.*)<style>/ims', 
"\n", $css);
 
20753           $css = str_replace(
'/*<![CDATA[*/', 
'', $css);
 
20754           $css = str_replace(
'/*]]>*/', 
'', $css);
 
20755           preg_match(
'/<style>(.*)<\/style>/ims', $css, $matches);
 
20756           if (isset($matches[1])) {
 
20757                $css = strtolower($matches[1]);
 
20762           $css = 
'<style>'.$default_css.$css.
'</style>';
 
20764           $tidy_body = tidy_get_body($tidy);
 
20765           $html = $tidy_body->value;
 
20767           $html = str_replace(
'<br>', 
'<br />', $html);
 
20769           $html = preg_replace(
'/<div([^>]*)><\/div>/', 
'', $html);
 
20770           $html = preg_replace(
'/<p([^>]*)><\/p>/', 
'', $html);
 
20771           if ($tagvs !== 
'') {
 
20773                $this->setHtmlVSpace($tagvs);
 
20788           if (empty($cssdata)) {
 
20792           $cssdata = preg_replace(
'/\/\*[^\*]*\*\//', 
'', $cssdata);
 
20794           $cssdata = preg_replace(
'/[\s]+/', 
' ', $cssdata);
 
20796           $cssdata = preg_replace(
'/[\s]*([;:\{\}]{1})[\s]*/', 
'\\1', $cssdata);
 
20798           $cssdata = preg_replace(
'/([^\}\{]+)\{\}/', 
'', $cssdata);
 
20800           $cssdata = preg_replace(
'/@media[\s]+([^\{]*)\{/i', 
'@media \\1§', $cssdata);
 
20801           $cssdata = preg_replace(
'/\}\}/si', 
'}§', $cssdata);
 
20803           $cssdata = trim($cssdata);
 
20805           $cssblocks = array();
 
20806           $matches = array();
 
20807           if (preg_match_all(
'/@media[\s]+([^\§]*)§([^§]*)§/i', $cssdata, $matches) > 0) {
 
20808                foreach ($matches[1] as $key => $type) {
 
20809                     $cssblocks[$type] = $matches[2][$key];
 
20812                $cssdata = preg_replace(
'/@media[\s]+([^\§]*)§([^§]*)§/i', 
'', $cssdata);
 
20815           if (isset($cssblocks[
'all']) AND !empty($cssblocks[
'all'])) {
 
20816                $cssdata .= $cssblocks[
'all'];
 
20818           if (isset($cssblocks[
'print']) AND !empty($cssblocks[
'print'])) {
 
20819                $cssdata .= $cssblocks[
'print'];
 
20822           $cssblocks = array();
 
20823           $matches = array();
 
20825           if (substr($cssdata, -1) == 
'}') {
 
20827                $cssdata = substr($cssdata, 0, -1);
 
20829           $matches = explode(
'}', $cssdata);
 
20830           foreach ($matches as $key => $block) {
 
20832                $cssblocks[$key] = explode(
'{', $block);
 
20833                if (!isset($cssblocks[$key][1])) {
 
20835                     unset($cssblocks[$key]);
 
20839           foreach ($cssblocks as $key => $block) {
 
20840                if (strpos($block[0], 
',') > 0) {
 
20841                     $selectors = explode(
',', $block[0]);
 
20842                     foreach ($selectors as $sel) {
 
20843                          $cssblocks[] = array(0 => trim($sel), 1 => $block[1]);
 
20845                     unset($cssblocks[$key]);
 
20849           $cssdata = array();
 
20850           foreach ($cssblocks as $block) {
 
20851                $selector = $block[0];
 
20853                $matches = array();
 
20855                $b = intval(preg_match_all(
'/[\#]/', $selector, $matches)); 
 
20856                $c = intval(preg_match_all(
'/[\[\.]/', $selector, $matches)); 
 
20857                $c += intval(preg_match_all(
'/[\:]link|visited|hover|active|focus|target|lang|enabled|disabled|checked|indeterminate|root|nth|first|last|only|empty|contains|not/i', $selector, $matches)); 
 
20858                $d = intval(preg_match_all(
'/[>\+\~\s]{1}[a-zA-Z0-9]+/', 
' '.$selector, $matches)); 
 
20859                $d += intval(preg_match_all(
'/[\:][\:]/', $selector, $matches)); 
 
20860                $specificity = $a.$b.$c.$d;
 
20862                $cssdata[$specificity.
' '.$selector] = $block[1];
 
20865           ksort($cssdata, SORT_STRING);
 
20881           $tag = $dom[$key][
'value'];
 
20883           if (isset($dom[$key][
'attribute'][
'class']) AND !empty($dom[$key][
'attribute'][
'class'])) {
 
20884                $class = explode(
' ', strtolower($dom[$key][
'attribute'][
'class']));
 
20887           if (isset($dom[$key][
'attribute'][
'id']) AND !empty($dom[$key][
'attribute'][
'id'])) {
 
20888                $id = strtolower($dom[$key][
'attribute'][
'id']);
 
20890           $selector = preg_replace(
'/([>\+\~\s]{1})([\.]{1})([^>\+\~\s]*)/si', 
'\\1*.\\3', $selector);
 
20891           $matches = array();
 
20892           if (preg_match_all(
'/([>\+\~\s]{1})([a-zA-Z0-9\*]+)([^>\+\~\s]*)/si', $selector, $matches, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE) > 0) {
 
20893                $parentop = array_pop($matches[1]);
 
20894                $operator = $parentop[0];
 
20895                $offset = $parentop[1];
 
20896                $lasttag = array_pop($matches[2]);
 
20897                $lasttag = strtolower(trim($lasttag[0]));
 
20898                if (($lasttag == 
'*') OR ($lasttag == $tag)) {
 
20900                     $attrib = array_pop($matches[3]);
 
20901                     $attrib = strtolower(trim($attrib[0]));
 
20902                     if (!empty($attrib)) {
 
20904                          switch ($attrib{0}) {
 
20906                                    if (in_array(substr($attrib, 1), 
$class)) {
 
20912                                    if (substr($attrib, 1) == 
$id) {
 
20918                                    $attrmatch = array();
 
20919                                    if (preg_match(
'/\[([a-zA-Z0-9]*)[\s]*([\~\^\$\*\|\=]*)[\s]*["]?([^"\]]*)["]?\]/i', $attrib, $attrmatch) > 0) {
 
20920                                         $att = strtolower($attrmatch[1]);
 
20921                                         $val = $attrmatch[3];
 
20922                                         if (isset($dom[$key][
'attribute'][$att])) {
 
20923                                              switch ($attrmatch[2]) {
 
20925                                                        if ($dom[$key][
'attribute'][$att] == $val) {
 
20931                                                        if (in_array($val, explode(
' ', $dom[$key][
'attribute'][$att]))) {
 
20937                                                        if ($val == substr($dom[$key][
'attribute'][$att], 0, strlen($val))) {
 
20943                                                        if ($val == substr($dom[$key][
'attribute'][$att], -strlen($val))) {
 
20949                                                        if (strpos($dom[$key][
'attribute'][$att], $val) !== 
false) {
 
20955                                                        if ($dom[$key][
'attribute'][$att] == $val) {
 
20957                                                        } 
elseif (preg_match(
'/'.$val.
'[\-]{1}/i', $dom[$key][
'attribute'][$att]) > 0) {
 
20971                                    if ($attrib{1} == 
':') { 
 
20984                     if ($valid AND ($offset > 0)) {
 
20987                          $selector = substr($selector, 0, $offset);
 
20988                          switch ($operator) {
 
20990                                    while ($dom[$key][
'parent'] > 0) {
 
20991                                         if ($this->isValidCSSSelectorForTag($dom, $dom[$key][
'parent'], $selector)) {
 
20995                                              $key = $dom[$key][
'parent'];
 
21001                                    $valid = $this->isValidCSSSelectorForTag($dom, $dom[$key][
'parent'], $selector);
 
21005                                    for (
$i = ($key - 1); 
$i > $dom[$key][
'parent']; --
$i) {
 
21006                                         if ($dom[
$i][
'tag'] AND $dom[
$i][
'opening']) {
 
21007                                              $valid = $this->isValidCSSSelectorForTag($dom, $i, $selector);
 
21014                                    for (
$i = ($key - 1); 
$i > $dom[$key][
'parent']; --
$i) {
 
21015                                         if ($dom[
$i][
'tag'] AND $dom[
$i][
'opening']) {
 
21016                                              if ($this->isValidCSSSelectorForTag($dom, $i, $selector)) {
 
21040           $cssarray = array(); 
 
21042           $selectors = array();
 
21043           if (isset($dom[($dom[$key][
'parent'])][
'csssel'])) {
 
21044                $selectors = $dom[($dom[$key][
'parent'])][
'csssel'];
 
21047           foreach($css as $selector => $style) {
 
21048                $pos = strpos($selector, 
' ');
 
21050                $specificity = substr($selector, 0, $pos);
 
21052                $selector = substr($selector, $pos);
 
21054                if ($this->isValidCSSSelectorForTag($dom, $key, $selector)) {
 
21055                     if (!in_array($selector, $selectors)) {
 
21057                          $cssarray[] = array(
'k' => $selector, 
's' => $specificity, 
'c' => $style);
 
21058                          $selectors[] = $selector;
 
21062           if (isset($dom[$key][
'attribute'][
'style'])) {
 
21064                $cssarray[] = array(
'k' => 
'', 
's' => 
'1000', 
'c' => $dom[$key][
'attribute'][
'style']);
 
21067           $cssordered = array();
 
21068           foreach ($cssarray as $key => $val) {
 
21069                $skey = sprintf(
'%04d', $key);
 
21070                $cssordered[$val[
's'].
'_'.$skey] = $val;
 
21073           ksort($cssordered, SORT_STRING);
 
21074           return array($selectors, $cssordered);
 
21086           foreach ($css as $style) {
 
21088                $csscmds = explode(
';', $style[
'c']);
 
21089                foreach ($csscmds as $cmd) {
 
21090                     if (!empty($cmd)) {
 
21091                          $pos = strpos($cmd, 
':');
 
21092                          if ($pos !== 
false) {
 
21093                               $cmd = substr($cmd, 0, ($pos + 1));
 
21094                               if (strpos($tagstyle, $cmd) !== 
false) {
 
21096                                    $tagstyle = preg_replace(
'/'.$cmd.
'[^;]+/i', 
'', $tagstyle);
 
21101                $tagstyle .= 
';'.$style[
'c'];
 
21104           $tagstyle = preg_replace(
'/[;]+/', 
';', $tagstyle);
 
21116           if ($width == 
'thin') {
 
21117                $width = (2 / $this->k);
 
21118           } 
elseif ($width == 
'medium') {
 
21119                $width = (4 / $this->k);
 
21120           } 
elseif ($width == 
'thick') {
 
21121                $width = (6 / $this->k);
 
21123                $width = $this->getHTMLUnitToUnits($width, 1, 
'px', 
false);
 
21136           switch (strtolower($style)) {
 
21172           $bprop = preg_split(
'/[\s]+/', trim($cssborder));
 
21174           switch (count($bprop)) {
 
21176                     $width = $bprop[0];
 
21177                     $style = $bprop[1];
 
21178                     $color = $bprop[2];
 
21183                     $style = $bprop[0];
 
21184                     $color = $bprop[1];
 
21189                     $style = $bprop[0];
 
21200           if ($style == 
'none') {
 
21203           $border[
'cap'] = 
'square';
 
21204           $border[
'join'] = 
'miter';
 
21205           $border[
'dash'] = $this->getCSSBorderDashStyle($style);
 
21206           if ($border[
'dash'] < 0) {
 
21209           $border[
'width'] = $this->getCSSBorderWidth($width);
 
21210           $border[
'color'] = $this->convertHTMLColorToDec($color);
 
21223           $padding = preg_split(
'/[\s]+/', trim($csspadding));
 
21224           $cell_padding = array(); 
 
21225           switch (count($padding)) {
 
21227                     $cell_padding[
'T'] = $padding[0];
 
21228                     $cell_padding[
'R'] = $padding[1];
 
21229                     $cell_padding[
'B'] = $padding[2];
 
21230                     $cell_padding[
'L'] = $padding[3];
 
21234                     $cell_padding[
'T'] = $padding[0];
 
21235                     $cell_padding[
'R'] = $padding[1];
 
21236                     $cell_padding[
'B'] = $padding[2];
 
21237                     $cell_padding[
'L'] = $padding[1];
 
21241                     $cell_padding[
'T'] = $padding[0];
 
21242                     $cell_padding[
'R'] = $padding[1];
 
21243                     $cell_padding[
'B'] = $padding[0];
 
21244                     $cell_padding[
'L'] = $padding[1];
 
21248                     $cell_padding[
'T'] = $padding[0];
 
21249                     $cell_padding[
'R'] = $padding[0];
 
21250                     $cell_padding[
'B'] = $padding[0];
 
21251                     $cell_padding[
'L'] = $padding[0];
 
21255                     return $this->cell_padding;
 
21259                $width = $this->w - $this->lMargin - $this->rMargin;
 
21261           $cell_padding[
'T'] = $this->getHTMLUnitToUnits($cell_padding[
'T'], $width, 
'px', 
false);
 
21262           $cell_padding[
'R'] = $this->getHTMLUnitToUnits($cell_padding[
'R'], $width, 
'px', 
false);
 
21263           $cell_padding[
'B'] = $this->getHTMLUnitToUnits($cell_padding[
'B'], $width, 
'px', 
false);
 
21264           $cell_padding[
'L'] = $this->getHTMLUnitToUnits($cell_padding[
'L'], $width, 
'px', 
false);
 
21265           return $cell_padding;
 
21277           $margin = preg_split(
'/[\s]+/', trim($cssmargin));
 
21278           $cell_margin = array(); 
 
21279           switch (count($margin)) {
 
21281                     $cell_margin[
'T'] = $margin[0];
 
21282                     $cell_margin[
'R'] = $margin[1];
 
21283                     $cell_margin[
'B'] = $margin[2];
 
21284                     $cell_margin[
'L'] = $margin[3];
 
21288                     $cell_margin[
'T'] = $margin[0];
 
21289                     $cell_margin[
'R'] = $margin[1];
 
21290                     $cell_margin[
'B'] = $margin[2];
 
21291                     $cell_margin[
'L'] = $margin[1];
 
21295                     $cell_margin[
'T'] = $margin[0];
 
21296                     $cell_margin[
'R'] = $margin[1];
 
21297                     $cell_margin[
'B'] = $margin[0];
 
21298                     $cell_margin[
'L'] = $margin[1];
 
21302                     $cell_margin[
'T'] = $margin[0];
 
21303                     $cell_margin[
'R'] = $margin[0];
 
21304                     $cell_margin[
'B'] = $margin[0];
 
21305                     $cell_margin[
'L'] = $margin[0];
 
21309                     return $this->cell_margin;
 
21313                $width = $this->w - $this->lMargin - $this->rMargin;
 
21315           $cell_margin[
'T'] = $this->getHTMLUnitToUnits(str_replace(
'auto', 
'0', $cell_margin[
'T']), $width, 
'px', 
false);
 
21316           $cell_margin[
'R'] = $this->getHTMLUnitToUnits(str_replace(
'auto', 
'0', $cell_margin[
'R']), $width, 
'px', 
false);
 
21317           $cell_margin[
'B'] = $this->getHTMLUnitToUnits(str_replace(
'auto', 
'0', $cell_margin[
'B']), $width, 
'px', 
false);
 
21318           $cell_margin[
'L'] = $this->getHTMLUnitToUnits(str_replace(
'auto', 
'0', $cell_margin[
'L']), $width, 
'px', 
false);
 
21319           return $cell_margin;
 
21331           $space = preg_split(
'/[\s]+/', trim($cssbspace));
 
21332           $border_spacing = array(); 
 
21333           switch (count($space)) {
 
21335                     $border_spacing[
'H'] = $space[0];
 
21336                     $border_spacing[
'V'] = $space[1];
 
21340                     $border_spacing[
'H'] = $space[0];
 
21341                     $border_spacing[
'V'] = $space[0];
 
21345                     return array(
'H' => 0, 
'V' => 0);
 
21349                $width = $this->w - $this->lMargin - $this->rMargin;
 
21351           $border_spacing[
'H'] = $this->getHTMLUnitToUnits($border_spacing[
'H'], $width, 
'px', 
false);
 
21352           $border_spacing[
'V'] = $this->getHTMLUnitToUnits($border_spacing[
'V'], $width, 
'px', 
false);
 
21353           return $border_spacing;
 
21366           $spacing = trim($spacing);
 
21367           switch ($spacing) {
 
21373                     if ($parent == 
'normal') {
 
21381                     $val = $this->getHTMLUnitToUnits($spacing, 0, 
'px', 
false);
 
21397           $stretch = trim($stretch);
 
21398           switch ($stretch) {
 
21399                case 'ultra-condensed': {
 
21403                case 'extra-condensed': {
 
21407                case 'condensed': {
 
21411                case 'semi-condensed': {
 
21419                case 'semi-expanded': {
 
21427                case 'extra-expanded': {
 
21431                case 'ultra-expanded': {
 
21436                     $val = $parent + 10;
 
21440                     $val = $parent - 10;
 
21444                     if ($parent == 
'normal') {
 
21452                     $val = $this->getHTMLUnitToUnits($stretch, 100, 
'%', 
false);
 
21469           $matches = array();
 
21470           if (preg_match_all(
'/<cssarray>([^<]*)<\/cssarray>/isU', $html, $matches) > 0) {
 
21471                if (isset($matches[1][0])) {
 
21472                     $css = array_merge($css, unserialize($this->unhtmlentities($matches[1][0])));
 
21474                $html = preg_replace(
'/<cssarray>(.*?)<\/cssarray>/isU', 
'', $html);
 
21477           $matches = array();
 
21478           if (preg_match_all(
'/<link([^>]*)>/isU', $html, $matches) > 0) {
 
21479                foreach ($matches[1] as $key => $link) {
 
21481                     if (preg_match(
'/type[\s]*=[\s]*"text\/css"/', $link, $type)) {
 
21483                          preg_match(
'/media[\s]*=[\s]*"([^"]*)"/', $link, $type);
 
21486                          if (empty($type) OR (isset($type[1]) AND (($type[1] == 
'all') OR ($type[1] == 
'print')))) {
 
21488                               if (preg_match(
'/href[\s]*=[\s]*"([^"]*)"/', $link, $type) > 0) {
 
21490                                    $cssdata = file_get_contents(trim($type[1]));
 
21491                                    $css = array_merge($css, $this->extractCSSproperties($cssdata));
 
21498           $matches = array();
 
21499           if (preg_match_all(
'/<style([^>]*)>([^<]*)<\/style>/isU', $html, $matches) > 0) {
 
21500                foreach ($matches[1] as $key => $media) {
 
21502                     preg_match(
'/media[\s]*=[\s]*"([^"]*)"/', $media, $type);
 
21505                     if (empty($type) OR (isset($type[1]) AND (($type[1] == 
'all') OR ($type[1] == 
'print')))) {
 
21506                          $cssdata = $matches[2][$key];
 
21507                          $css = array_merge($css, $this->extractCSSproperties($cssdata));
 
21512           $csstagarray = 
'<cssarray>'.htmlentities(serialize($css)).
'</cssarray>';
 
21514           $html = preg_replace(
'/<head([^>]*)>(.*?)<\/head>/siU', 
'', $html);
 
21515           $html = preg_replace(
'/<style([^>]*)>([^<]*)<\/style>/isU', 
'', $html);
 
21517           $blocktags = array(
'blockquote',
'br',
'dd',
'dl',
'div',
'dt',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'hr',
'li',
'ol',
'p',
'pre',
'ul',
'tcpdf',
'table',
'tr',
'td');
 
21519           $selfclosingtags = array(
'area',
'base',
'basefont',
'br',
'hr',
'input',
'img',
'link',
'meta');
 
21521           $html = strip_tags($html, 
'<marker/><a><b><blockquote><body><br><br/><dd><del><div><dl><dt><em><font><form><h1><h2><h3><h4><h5><h6><hr><hr/><i><img><input><label><li><ol><option><p><pre><s><select><small><span><strike><strong><sub><sup><table><tablehead><tcpdf><td><textarea><th><thead><tr><tt><u><ul>');
 
21523           $html = preg_replace(
'/<pre/', 
'<xre', $html); 
 
21524           $html = preg_replace(
'/<(table|tr|td|th|tcpdf|blockquote|dd|div|dl|dt|form|h1|h2|h3|h4|h5|h6|br|hr|li|ol|ul|p)([^>]*)>[\n\r\t]+/', 
'<\\1\\2>', $html);
 
21525           $html = preg_replace(
'@(\r\n|\r)@', 
"\n", $html);
 
21526           $repTable = array(
"\t" => 
' ', 
"\0" => 
' ', 
"\x0B" => 
' ', 
"\\" => 
"\\\\");
 
21527           $html = strtr($html, $repTable);
 
21529           while (($offset < strlen($html)) AND ($pos = strpos($html, 
'</pre>', $offset)) !== 
false) {
 
21530                $html_a = substr($html, 0, $offset);
 
21531                $html_b = substr($html, $offset, ($pos - $offset + 6));
 
21532                while (preg_match(
"'<xre([^>]*)>(.*?)\n(.*?)</pre>'si", $html_b)) {
 
21534                     $html_b = preg_replace(
"'<xre([^>]*)>(.*?)\n(.*?)</pre>'si", 
"<xre\\1>\\2<br />\\3</pre>", $html_b);
 
21536                while (preg_match(
"'<xre([^>]*)>(.*?)".$this->re_space[
'p'].
"(.*?)</pre>'".$this->re_space[
'm'], $html_b)) {
 
21538                     $html_b = preg_replace(
"'<xre([^>]*)>(.*?)".$this->re_space[
'p'].
"(.*?)</pre>'".$this->re_space[
'm'], 
"<xre\\1>\\2 \\3</pre>", $html_b);
 
21540                $html = $html_a.$html_b.substr($html, $pos + 6);
 
21541                $offset = strlen($html_a.$html_b);
 
21544           while (($offset < strlen($html)) AND ($pos = strpos($html, 
'</textarea>', $offset)) !== 
false) {
 
21545                $html_a = substr($html, 0, $offset);
 
21546                $html_b = substr($html, $offset, ($pos - $offset + 11));
 
21547                while (preg_match(
"'<textarea([^>]*)>(.*?)\n(.*?)</textarea>'si", $html_b)) {
 
21549                     $html_b = preg_replace(
"'<textarea([^>]*)>(.*?)\n(.*?)</textarea>'si", 
"<textarea\\1>\\2<TBR>\\3</textarea>", $html_b);
 
21550                     $html_b = preg_replace(
"'<textarea([^>]*)>(.*?)[\"](.*?)</textarea>'si", 
"<textarea\\1>\\2''\\3</textarea>", $html_b);
 
21552                $html = $html_a.$html_b.substr($html, $pos + 11);
 
21553                $offset = strlen($html_a.$html_b);
 
21555           $html = preg_replace(
'/([\s]*)<option/si', 
'<option', $html);
 
21556           $html = preg_replace(
'/<\/option>([\s]*)/si', 
'</option>', $html);
 
21558           while (($offset < strlen($html)) AND ($pos = strpos($html, 
'</option>', $offset)) !== 
false) {
 
21559                $html_a = substr($html, 0, $offset);
 
21560                $html_b = substr($html, $offset, ($pos - $offset + 9));
 
21561                while (preg_match(
"'<option([^>]*)>(.*?)</option>'si", $html_b)) {
 
21562                     $html_b = preg_replace(
"'<option([\s]+)value=\"([^\"]*)\"([^>]*)>(.*?)</option>'si", 
"\\2#!TaB!#\\4#!NwL!#", $html_b);
 
21563                     $html_b = preg_replace(
"'<option([^>]*)>(.*?)</option>'si", 
"\\2#!NwL!#", $html_b);
 
21565                $html = $html_a.$html_b.substr($html, $pos + 9);
 
21566                $offset = strlen($html_a.$html_b);
 
21568           if (preg_match(
"'</select'si", $html)) {
 
21569                $html = preg_replace(
"'<select([^>]*)>'si", 
"<select\\1 opt=\"", $html);
 
21570                $html = preg_replace(
"'#!NwL!#</select>'si", 
"\" />", $html);
 
21572           $html = str_replace(
"\n", 
' ', $html);
 
21574           $html = str_replace(
'<TBR>', 
"\n", $html);
 
21576           $html = preg_replace(
'/[\s]+<\/(table|tr|ul|ol|dl)>/', 
'</\\1>', $html);
 
21577           $html = preg_replace(
'/'.$this->re_space[
'p'].
'+<\/(td|th|li|dt|dd)>/'.$this->re_space[
'm'], 
'</\\1>', $html);
 
21578           $html = preg_replace(
'/[\s]+<(tr|td|th|li|dt|dd)/', 
'<\\1', $html);
 
21579           $html = preg_replace(
'/'.$this->re_space[
'p'].
'+<(ul|ol|dl|br)/'.$this->re_space[
'm'], 
'<\\1', $html);
 
21580           $html = preg_replace(
'/<\/(table|tr|td|th|blockquote|dd|dt|dl|div|dt|h1|h2|h3|h4|h5|h6|hr|li|ol|ul|p)>[\s]+</', 
'</\\1><', $html);
 
21581           $html = preg_replace(
'/<\/(td|th)>/', 
'<marker style="font-size:0"/></\\1>', $html);
 
21582           $html = preg_replace(
'/<\/table>([\s]*)<marker style="font-size:0"\/>/', 
'</table>', $html);
 
21583           $html = preg_replace(
'/'.$this->re_space[
'p'].
'+<img/'.$this->re_space[
'm'], chr(32).
'<img', $html);
 
21584           $html = preg_replace(
'/<img([^>]*)>[\s]+([^<])/xi', 
'<img\\1> \\2', $html);
 
21585           $html = preg_replace(
'/<img([^>]*)>/xi', 
'<img\\1><span><marker style="font-size:0"/></span>', $html);
 
21586           $html = preg_replace(
'/<xre/', 
'<pre', $html); 
 
21587           $html = preg_replace(
'/<textarea([^>]*)>([^<]*)<\/textarea>/xi', 
'<textarea\\1 value="\\2" />', $html);
 
21588           $html = preg_replace(
'/<li([^>]*)><\/li>/', 
'<li\\1> </li>', $html);
 
21589           $html = preg_replace(
'/<li([^>]*)>'.$this->re_space[
'p'].
'*<img/'.$this->re_space[
'm'], 
'<li\\1><font size="1"> </font><img', $html);
 
21590           $html = preg_replace(
'/<([^>\/]*)>[\s]/', 
'<\\1> ', $html); 
 
21591           $html = preg_replace(
'/[\s]<\/([^>]*)>/', 
' </\\1>', $html); 
 
21592           $html = preg_replace(
'/<su([bp])/', 
'<zws/><su\\1', $html); 
 
21593           $html = preg_replace(
'/<\/su([bp])>/', 
'</su\\1><zws/>', $html); 
 
21594           $html = preg_replace(
'/'.$this->re_space[
'p'].
'+/'.$this->re_space[
'm'], chr(32), $html); 
 
21596           $html = $this->stringTrim($html);
 
21598           $html = preg_replace(
'/^<img/', 
'<span style="font-size:0"><br /></span> <img', $html, 1);
 
21600           $tagpattern = 
'/(<[^>]+>)/';
 
21602           $a = preg_split($tagpattern, $html, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
 
21604           $maxel = count($a);
 
21609           $dom[$key] = array();
 
21612           $dom[$key][
'tag'] = 
false;
 
21613           $dom[$key][
'block'] = 
false;
 
21614           $dom[$key][
'value'] = 
'';
 
21615           $dom[$key][
'parent'] = 0;
 
21616           $dom[$key][
'hide'] = 
false;
 
21617           $dom[$key][
'fontname'] = $this->FontFamily;
 
21618           $dom[$key][
'fontstyle'] = $this->FontStyle;
 
21619           $dom[$key][
'fontsize'] = $this->FontSizePt;
 
21620           $dom[$key][
'font-stretch'] = $this->font_stretching;
 
21621           $dom[$key][
'letter-spacing'] = $this->font_spacing;
 
21622           $dom[$key][
'stroke'] = $this->textstrokewidth;
 
21623           $dom[$key][
'fill'] = (($this->textrendermode % 2) == 0);
 
21624           $dom[$key][
'clip'] = ($this->textrendermode > 3);
 
21625           $dom[$key][
'line-height'] = $this->cell_height_ratio;
 
21626           $dom[$key][
'bgcolor'] = 
false;
 
21627           $dom[$key][
'fgcolor'] = $this->fgcolor; 
 
21628           $dom[$key][
'strokecolor'] = $this->strokecolor;
 
21629           $dom[$key][
'align'] = 
'';
 
21630           $dom[$key][
'listtype'] = 
'';
 
21631           $dom[$key][
'text-indent'] = 0;
 
21632           $dom[$key][
'border'] = array();
 
21633           $dom[$key][
'dir'] = $this->rtl?
'rtl':
'ltr';
 
21637           array_push($level, 0); 
 
21638           while ($elkey < $maxel) {
 
21639                $dom[$key] = array();
 
21640                $element = $a[$elkey];
 
21641                $dom[$key][
'elkey'] = $elkey;
 
21642                if (preg_match($tagpattern, $element)) {
 
21644                     $element = substr($element, 1, -1);
 
21646                     preg_match(
'/[\/]?([a-zA-Z0-9]*)/', $element, $tag);
 
21647                     $tagname = strtolower($tag[1]);
 
21649                     if ($tagname == 
'thead') {
 
21650                          if ($element{0} == 
'/') {
 
21658                     $dom[$key][
'tag'] = 
true;
 
21659                     $dom[$key][
'value'] = $tagname;
 
21660                     if (in_array($dom[$key][
'value'], $blocktags)) {
 
21661                          $dom[$key][
'block'] = 
true;
 
21663                          $dom[$key][
'block'] = 
false;
 
21665                     if ($element{0} == 
'/') {
 
21667                          $dom[$key][
'opening'] = 
false;
 
21668                          $dom[$key][
'parent'] = end($level);
 
21670                          $dom[$key][
'hide'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'hide'];
 
21671                          $dom[$key][
'fontname'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'fontname'];
 
21672                          $dom[$key][
'fontstyle'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'fontstyle'];
 
21673                          $dom[$key][
'fontsize'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'fontsize'];
 
21674                          $dom[$key][
'font-stretch'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'font-stretch'];
 
21675                          $dom[$key][
'letter-spacing'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'letter-spacing'];
 
21676                          $dom[$key][
'stroke'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'stroke'];
 
21677                          $dom[$key][
'fill'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'fill'];
 
21678                          $dom[$key][
'clip'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'clip'];
 
21679                          $dom[$key][
'line-height'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'line-height'];
 
21680                          $dom[$key][
'bgcolor'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'bgcolor'];
 
21681                          $dom[$key][
'fgcolor'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'fgcolor'];
 
21682                          $dom[$key][
'strokecolor'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'strokecolor'];
 
21683                          $dom[$key][
'align'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'align'];
 
21684                          $dom[$key][
'dir'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'dir'];
 
21685                          if (isset($dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'listtype'])) {
 
21686                               $dom[$key][
'listtype'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'listtype'];
 
21689                          if (($dom[$key][
'value'] == 
'tr') AND (!isset($dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'cols']))) {
 
21690                               $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'cols'] = $dom[($dom[$key][
'parent'])][
'cols'];
 
21692                          if (($dom[$key][
'value'] == 
'td') OR ($dom[$key][
'value'] == 
'th')) {
 
21693                               $dom[($dom[$key][
'parent'])][
'content'] = $csstagarray;
 
21694                               for (
$i = ($dom[$key][
'parent'] + 1); 
$i < $key; ++
$i) {
 
21695                                    $dom[($dom[$key][
'parent'])][
'content'] .= $a[$dom[
$i][
'elkey']];
 
21699                               $dom[($dom[$key][
'parent'])][
'content'] = str_replace(
'<table', 
'<table nested="true"', $dom[($dom[$key][
'parent'])][
'content']);
 
21701                               $dom[($dom[$key][
'parent'])][
'content'] = str_replace(
'<thead>', 
'', $dom[($dom[$key][
'parent'])][
'content']);
 
21702                               $dom[($dom[$key][
'parent'])][
'content'] = str_replace(
'</thead>', 
'', $dom[($dom[$key][
'parent'])][
'content']);
 
21705                          if (($dom[$key][
'value'] == 
'tr') AND ($dom[($dom[$key][
'parent'])][
'thead'] === 
true)) {
 
21706                               if ($this->empty_string($dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'thead'])) {
 
21707                                    $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'thead'] = $csstagarray.$a[$dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'elkey']];
 
21709                               for (
$i = $dom[$key][
'parent']; 
$i <= $key; ++
$i) {
 
21710                                    $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'thead'] .= $a[$dom[
$i][
'elkey']];
 
21712                               if (!isset($dom[($dom[$key][
'parent'])][
'attribute'])) {
 
21713                                    $dom[($dom[$key][
'parent'])][
'attribute'] = array();
 
21716                               $dom[($dom[$key][
'parent'])][
'attribute'][
'nobr'] = 
'true';
 
21718                          if (($dom[$key][
'value'] == 
'table') AND (!$this->empty_string($dom[($dom[$key][
'parent'])][
'thead']))) {
 
21720                               $dom[($dom[$key][
'parent'])][
'thead'] = str_replace(
' nobr="true"', 
'', $dom[($dom[$key][
'parent'])][
'thead']);
 
21721                               $dom[($dom[$key][
'parent'])][
'thead'] .= 
'</tablehead>';
 
21725                          $dom[$key][
'opening'] = 
true;
 
21726                          $dom[$key][
'parent'] = end($level);
 
21727                          if ((substr($element, -1, 1) == 
'/') OR (in_array($dom[$key][
'value'], $selfclosingtags))) {
 
21729                               $dom[$key][
'self'] = 
true;
 
21732                               array_push($level, $key);
 
21733                               $dom[$key][
'self'] = 
false;
 
21738                               $parentkey = $dom[$key][
'parent'];
 
21739                               $dom[$key][
'hide'] = $dom[$parentkey][
'hide'];
 
21740                               $dom[$key][
'fontname'] = $dom[$parentkey][
'fontname'];
 
21741                               $dom[$key][
'fontstyle'] = $dom[$parentkey][
'fontstyle'];
 
21742                               $dom[$key][
'fontsize'] = $dom[$parentkey][
'fontsize'];
 
21743                               $dom[$key][
'font-stretch'] = $dom[$parentkey][
'font-stretch'];
 
21744                               $dom[$key][
'letter-spacing'] = $dom[$parentkey][
'letter-spacing'];
 
21745                               $dom[$key][
'stroke'] = $dom[$parentkey][
'stroke'];
 
21746                               $dom[$key][
'fill'] = $dom[$parentkey][
'fill'];
 
21747                               $dom[$key][
'clip'] = $dom[$parentkey][
'clip'];
 
21748                               $dom[$key][
'line-height'] = $dom[$parentkey][
'line-height'];
 
21749                               $dom[$key][
'bgcolor'] = $dom[$parentkey][
'bgcolor'];
 
21750                               $dom[$key][
'fgcolor'] = $dom[$parentkey][
'fgcolor'];
 
21751                               $dom[$key][
'strokecolor'] = $dom[$parentkey][
'strokecolor'];
 
21752                               $dom[$key][
'align'] = $dom[$parentkey][
'align'];
 
21753                               $dom[$key][
'listtype'] = $dom[$parentkey][
'listtype'];
 
21754                               $dom[$key][
'text-indent'] = $dom[$parentkey][
'text-indent'];
 
21755                               $dom[$key][
'border'] = array();
 
21756                               $dom[$key][
'dir'] = $dom[$parentkey][
'dir'];
 
21759                          preg_match_all(
'/([^=\s]*)[\s]*=[\s]*"([^"]*)"/', $element, $attr_array, PREG_PATTERN_ORDER);
 
21760                          $dom[$key][
'attribute'] = array(); 
 
21761                          while (list(
$id, $name) = each($attr_array[1])) {
 
21762                               $dom[$key][
'attribute'][strtolower($name)] = $attr_array[2][
$id];
 
21764                          if (!empty($css)) {
 
21766                               list($dom[$key][
'csssel'], $dom[$key][
'cssdata']) = $this->getCSSdataArray($dom, $key, $css);
 
21767                               $dom[$key][
'attribute'][
'style'] = $this->getTagStyleFromCSSarray($dom[$key][
'cssdata']);
 
21770                          if (isset($dom[$key][
'attribute'][
'style']) AND !empty($dom[$key][
'attribute'][
'style'])) {
 
21772                               preg_match_all(
'/([^;:\s]*):([^;]*)/', $dom[$key][
'attribute'][
'style'], $style_array, PREG_PATTERN_ORDER);
 
21773                               $dom[$key][
'style'] = array(); 
 
21774                               while (list(
$id, $name) = each($style_array[1])) {
 
21776                                    $dom[$key][
'style'][strtolower($name)] = trim($style_array[2][
$id]);
 
21780                               if (isset($dom[$key][
'style'][
'direction'])) {
 
21781                                    $dom[$key][
'dir'] = $dom[$key][
'style'][
'direction'];
 
21784                               if (isset($dom[$key][
'style'][
'display'])) {
 
21785                                    $dom[$key][
'hide'] = (trim(strtolower($dom[$key][
'style'][
'display'])) == 
'none');
 
21788                               if (isset($dom[$key][
'style'][
'font-family'])) {
 
21789                                    $dom[$key][
'fontname'] = $this->getFontFamilyName($dom[$key][
'style'][
'font-family']);
 
21792                               if (isset($dom[$key][
'style'][
'list-style-type'])) {
 
21793                                    $dom[$key][
'listtype'] = trim(strtolower($dom[$key][
'style'][
'list-style-type']));
 
21794                                    if ($dom[$key][
'listtype'] == 
'inherit') {
 
21795                                         $dom[$key][
'listtype'] = $dom[$parentkey][
'listtype'];
 
21799                               if (isset($dom[$key][
'style'][
'text-indent'])) {
 
21800                                    $dom[$key][
'text-indent'] = $this->getHTMLUnitToUnits($dom[$key][
'style'][
'text-indent']);
 
21801                                    if ($dom[$key][
'text-indent'] == 
'inherit') {
 
21802                                         $dom[$key][
'text-indent'] = $dom[$parentkey][
'text-indent'];
 
21806                               if (isset($dom[$key][
'style'][
'font-size'])) {
 
21807                                    $fsize = trim($dom[$key][
'style'][
'font-size']);
 
21811                                              $dom[$key][
'fontsize'] = $dom[0][
'fontsize'] - 4;
 
21815                                              $dom[$key][
'fontsize'] = $dom[0][
'fontsize'] - 3;
 
21819                                              $dom[$key][
'fontsize'] = $dom[0][
'fontsize'] - 2;
 
21823                                              $dom[$key][
'fontsize'] = $dom[0][
'fontsize'];
 
21827                                              $dom[$key][
'fontsize'] = $dom[0][
'fontsize'] + 2;
 
21831                                              $dom[$key][
'fontsize'] = $dom[0][
'fontsize'] + 4;
 
21835                                              $dom[$key][
'fontsize'] = $dom[0][
'fontsize'] + 6;
 
21840                                              $dom[$key][
'fontsize'] = $dom[$parentkey][
'fontsize'] - 3;
 
21844                                              $dom[$key][
'fontsize'] = $dom[$parentkey][
'fontsize'] + 3;
 
21848                                              $dom[$key][
'fontsize'] = $this->getHTMLUnitToUnits($fsize, $dom[$parentkey][
'fontsize'], 
'pt', 
true);
 
21853                               if (isset($dom[$key][
'style'][
'font-stretch'])) {
 
21854                                    $dom[$key][
'font-stretch'] = $this->getCSSFontStretching($dom[$key][
'style'][
'font-stretch'], $dom[$parentkey][
'font-stretch']);
 
21857                               if (isset($dom[$key][
'style'][
'letter-spacing'])) {
 
21858                                    $dom[$key][
'letter-spacing'] = $this->getCSSFontSpacing($dom[$key][
'style'][
'letter-spacing'], $dom[$parentkey][
'letter-spacing']);
 
21861                               if (isset($dom[$key][
'style'][
'line-height'])) {
 
21862                                    $lineheight = trim($dom[$key][
'style'][
'line-height']);
 
21863                                    switch ($lineheight) {
 
21866                                              $dom[$key][
'line-height'] = $dom[0][
'line-height'];
 
21870                                              if (is_numeric($lineheight)) {
 
21871                                                   $lineheight = $lineheight * 100;
 
21873                                              $dom[$key][
'line-height'] = $this->getHTMLUnitToUnits($lineheight, 1, 
'%', 
true);
 
21878                               if (isset($dom[$key][
'style'][
'font-weight'])) {
 
21879                                    if (strtolower($dom[$key][
'style'][
'font-weight']{0}) == 
'n') {
 
21880                                         if (strpos($dom[$key][
'fontstyle'], 
'B') !== 
false) {
 
21881                                              $dom[$key][
'fontstyle'] = str_replace(
'B', 
'', $dom[$key][
'fontstyle']);
 
21883                                    } 
elseif (strtolower($dom[$key][
'style'][
'font-weight']{0}) == 
'b') {
 
21884                                         $dom[$key][
'fontstyle'] .= 
'B';
 
21887                               if (isset($dom[$key][
'style'][
'font-style']) AND (strtolower($dom[$key][
'style'][
'font-style']{0}) == 
'i')) {
 
21888                                    $dom[$key][
'fontstyle'] .= 
'I';
 
21891                               if (isset($dom[$key][
'style'][
'color']) AND (!$this->empty_string($dom[$key][
'style'][
'color']))) {
 
21892                                    $dom[$key][
'fgcolor'] = $this->convertHTMLColorToDec($dom[$key][
'style'][
'color']);
 
21893                               } 
elseif ($dom[$key][
'value'] == 
'a') {
 
21894                                    $dom[$key][
'fgcolor'] = $this->htmlLinkColorArray;
 
21897                               if (isset($dom[$key][
'style'][
'background-color']) AND (!$this->empty_string($dom[$key][
'style'][
'background-color']))) {
 
21898                                    $dom[$key][
'bgcolor'] = $this->convertHTMLColorToDec($dom[$key][
'style'][
'background-color']);
 
21901                               if (isset($dom[$key][
'style'][
'text-decoration'])) {
 
21902                                    $decors = explode(
' ', strtolower($dom[$key][
'style'][
'text-decoration']));
 
21903                                    foreach ($decors as $dec) {
 
21905                                         if (!$this->empty_string($dec)) {
 
21906                                              if ($dec{0} == 
'u') {
 
21908                                                   $dom[$key][
'fontstyle'] .= 
'U';
 
21909                                              } 
elseif ($dec{0} == 
'l') {
 
21911                                                   $dom[$key][
'fontstyle'] .= 
'D';
 
21912                                              } 
elseif ($dec{0} == 
'o') {
 
21914                                                   $dom[$key][
'fontstyle'] .= 
'O';
 
21918                               } 
elseif ($dom[$key][
'value'] == 
'a') {
 
21919                                    $dom[$key][
'fontstyle'] = $this->htmlLinkFontStyle;
 
21922                               if (isset($dom[$key][
'style'][
'width'])) {
 
21923                                    $dom[$key][
'width'] = $dom[$key][
'style'][
'width'];
 
21926                               if (isset($dom[$key][
'style'][
'height'])) {
 
21927                                    $dom[$key][
'height'] = $dom[$key][
'style'][
'height'];
 
21930                               if (isset($dom[$key][
'style'][
'text-align'])) {
 
21931                                    $dom[$key][
'align'] = strtoupper($dom[$key][
'style'][
'text-align']{0});
 
21934                               if (isset($dom[$key][
'style'][
'border'])) {
 
21935                                    $borderstyle = $this->getCSSBorderStyle($dom[$key][
'style'][
'border']);
 
21936                                    if (!empty($borderstyle)) {
 
21937                                         $dom[$key][
'border'][
'LTRB'] = $borderstyle;
 
21940                               if (isset($dom[$key][
'style'][
'border-color'])) {
 
21941                                    $brd_colors = preg_split(
'/[\s]+/', trim($dom[$key][
'style'][
'border-color']));
 
21942                                    if (isset($brd_colors[3])) {
 
21943                                         $dom[$key][
'border'][
'L'][
'color'] = $this->convertHTMLColorToDec($brd_colors[3]);
 
21945                                    if (isset($brd_colors[1])) {
 
21946                                         $dom[$key][
'border'][
'R'][
'color'] = $this->convertHTMLColorToDec($brd_colors[1]);
 
21948                                    if (isset($brd_colors[0])) {
 
21949                                         $dom[$key][
'border'][
'T'][
'color'] = $this->convertHTMLColorToDec($brd_colors[0]);
 
21951                                    if (isset($brd_colors[2])) {
 
21952                                         $dom[$key][
'border'][
'B'][
'color'] = $this->convertHTMLColorToDec($brd_colors[2]);
 
21955                               if (isset($dom[$key][
'style'][
'border-width'])) {
 
21956                                    $brd_widths = preg_split(
'/[\s]+/', trim($dom[$key][
'style'][
'border-width']));
 
21957                                    if (isset($brd_widths[3])) {
 
21958                                         $dom[$key][
'border'][
'L'][
'width'] = $this->getCSSBorderWidth($brd_widths[3]);
 
21960                                    if (isset($brd_widths[1])) {
 
21961                                         $dom[$key][
'border'][
'R'][
'width'] = $this->getCSSBorderWidth($brd_widths[1]);
 
21963                                    if (isset($brd_widths[0])) {
 
21964                                         $dom[$key][
'border'][
'T'][
'width'] = $this->getCSSBorderWidth($brd_widths[0]);
 
21966                                    if (isset($brd_widths[2])) {
 
21967                                         $dom[$key][
'border'][
'B'][
'width'] = $this->getCSSBorderWidth($brd_widths[2]);
 
21970                               if (isset($dom[$key][
'style'][
'border-style'])) {
 
21971                                    $brd_styles = preg_split(
'/[\s]+/', trim($dom[$key][
'style'][
'border-style']));
 
21972                                    if (isset($brd_styles[3]) AND ($brd_styles[3]!=
'none')) {
 
21973                                         $dom[$key][
'border'][
'L'][
'cap'] = 
'square';
 
21974                                         $dom[$key][
'border'][
'L'][
'join'] = 
'miter';
 
21975                                         $dom[$key][
'border'][
'L'][
'dash'] = $this->getCSSBorderDashStyle($brd_styles[3]);
 
21976                                         if ($dom[$key][
'border'][
'L'][
'dash'] < 0) {
 
21977                                              $dom[$key][
'border'][
'L'] = array();
 
21980                                    if (isset($brd_styles[1])) {
 
21981                                         $dom[$key][
'border'][
'R'][
'cap'] = 
'square';
 
21982                                         $dom[$key][
'border'][
'R'][
'join'] = 
'miter';
 
21983                                         $dom[$key][
'border'][
'R'][
'dash'] = $this->getCSSBorderDashStyle($brd_styles[1]);
 
21984                                         if ($dom[$key][
'border'][
'R'][
'dash'] < 0) {
 
21985                                              $dom[$key][
'border'][
'R'] = array();
 
21988                                    if (isset($brd_styles[0])) {
 
21989                                         $dom[$key][
'border'][
'T'][
'cap'] = 
'square';
 
21990                                         $dom[$key][
'border'][
'T'][
'join'] = 
'miter';
 
21991                                         $dom[$key][
'border'][
'T'][
'dash'] = $this->getCSSBorderDashStyle($brd_styles[0]);
 
21992                                         if ($dom[$key][
'border'][
'T'][
'dash'] < 0) {
 
21993                                              $dom[$key][
'border'][
'T'] = array();
 
21996                                    if (isset($brd_styles[2])) {
 
21997                                         $dom[$key][
'border'][
'B'][
'cap'] = 
'square';
 
21998                                         $dom[$key][
'border'][
'B'][
'join'] = 
'miter';
 
21999                                         $dom[$key][
'border'][
'B'][
'dash'] = $this->getCSSBorderDashStyle($brd_styles[2]);
 
22000                                         if ($dom[$key][
'border'][
'B'][
'dash'] < 0) {
 
22001                                              $dom[$key][
'border'][
'B'] = array();
 
22005                               $cellside = array(
'L' => 
'left', 
'R' => 
'right', 
'T' => 
'top', 
'B' => 
'bottom');
 
22006                               foreach ($cellside as $bsk => $bsv) {
 
22007                                    if (isset($dom[$key][
'style'][
'border-'.$bsv])) {
 
22008                                         $borderstyle = $this->getCSSBorderStyle($dom[$key][
'style'][
'border-'.$bsv]);
 
22009                                         if (!empty($borderstyle)) {
 
22010                                              $dom[$key][
'border'][$bsk] = $borderstyle;
 
22013                                    if (isset($dom[$key][
'style'][
'border-'.$bsv.
'-color'])) {
 
22014                                         $dom[$key][
'border'][$bsk][
'color'] = $this->convertHTMLColorToDec($dom[$key][
'style'][
'border-'.$bsv.
'-color']);
 
22016                                    if (isset($dom[$key][
'style'][
'border-'.$bsv.
'-width'])) {
 
22017                                         $dom[$key][
'border'][$bsk][
'width'] = $this->getCSSBorderWidth($dom[$key][
'style'][
'border-'.$bsv.
'-width']);
 
22019                                    if (isset($dom[$key][
'style'][
'border-'.$bsv.
'-style'])) {
 
22020                                         $dom[$key][
'border'][$bsk][
'dash'] = $this->getCSSBorderDashStyle($dom[$key][
'style'][
'border-'.$bsv.
'-style']);
 
22021                                         if ($dom[$key][
'border'][$bsk][
'dash'] < 0) {
 
22022                                              $dom[$key][
'border'][$bsk] = array();
 
22027                               if (isset($dom[$key][
'style'][
'padding'])) {
 
22028                                    $dom[$key][
'padding'] = $this->getCSSPadding($dom[$key][
'style'][
'padding']);
 
22030                                    $dom[$key][
'padding'] = $this->cell_padding;
 
22032                               foreach ($cellside as $psk => $psv) {
 
22033                                    if (isset($dom[$key][
'style'][
'padding-'.$psv])) {
 
22034                                         $dom[$key][
'padding'][$psk] = $this->getHTMLUnitToUnits($dom[$key][
'style'][
'padding-'.$psv], 0, 
'px', 
false);
 
22038                               if (isset($dom[$key][
'style'][
'margin'])) {
 
22039                                    $dom[$key][
'margin'] = $this->getCSSMargin($dom[$key][
'style'][
'margin']);
 
22041                                    $dom[$key][
'margin'] = $this->cell_margin;
 
22043                               foreach ($cellside as $psk => $psv) {
 
22044                                    if (isset($dom[$key][
'style'][
'margin-'.$psv])) {
 
22045                                         $dom[$key][
'margin'][$psk] = $this->getHTMLUnitToUnits(str_replace(
'auto', 
'0', $dom[$key][
'style'][
'margin-'.$psv]), 0, 
'px', 
false);
 
22049                               if (isset($dom[$key][
'style'][
'border-spacing'])) {
 
22050                                    $dom[$key][
'border-spacing'] = $this->getCSSBorderMargin($dom[$key][
'style'][
'border-spacing']);
 
22053                               if (isset($dom[$key][
'style'][
'page-break-inside']) AND ($dom[$key][
'style'][
'page-break-inside'] == 
'avoid')) {
 
22054                                    $dom[$key][
'attribute'][
'nobr'] = 
'true';
 
22057                               if (isset($dom[$key][
'style'][
'page-break-before'])) {
 
22058                                    if ($dom[$key][
'style'][
'page-break-before'] == 
'always') {
 
22059                                         $dom[$key][
'attribute'][
'pagebreak'] = 
'true';
 
22060                                    } 
elseif ($dom[$key][
'style'][
'page-break-before'] == 
'left') {
 
22061                                         $dom[$key][
'attribute'][
'pagebreak'] = 
'left';
 
22062                                    } 
elseif ($dom[$key][
'style'][
'page-break-before'] == 
'right') {
 
22063                                         $dom[$key][
'attribute'][
'pagebreak'] = 
'right';
 
22067                               if (isset($dom[$key][
'style'][
'page-break-after'])) {
 
22068                                    if ($dom[$key][
'style'][
'page-break-after'] == 
'always') {
 
22069                                         $dom[$key][
'attribute'][
'pagebreakafter'] = 
'true';
 
22070                                    } 
elseif ($dom[$key][
'style'][
'page-break-after'] == 
'left') {
 
22071                                         $dom[$key][
'attribute'][
'pagebreakafter'] = 
'left';
 
22072                                    } 
elseif ($dom[$key][
'style'][
'page-break-after'] == 
'right') {
 
22073                                         $dom[$key][
'attribute'][
'pagebreakafter'] = 
'right';
 
22077                          if (isset($dom[$key][
'attribute'][
'display'])) {
 
22078                               $dom[$key][
'hide'] = (trim(strtolower($dom[$key][
'attribute'][
'display'])) == 
'none');
 
22080                          if (isset($dom[$key][
'attribute'][
'border']) AND ($dom[$key][
'attribute'][
'border'] != 0)) {
 
22081                               $borderstyle = $this->getCSSBorderStyle($dom[$key][
'attribute'][
'border'].
' solid black');
 
22082                               if (!empty($borderstyle)) {
 
22083                                    $dom[$key][
'border'][
'LTRB'] = $borderstyle;
 
22087                          if ($dom[$key][
'value'] == 
'font') {
 
22089                               if (isset($dom[$key][
'attribute'][
'face'])) {
 
22090                                    $dom[$key][
'fontname'] = $this->getFontFamilyName($dom[$key][
'attribute'][
'face']);
 
22093                               if (isset($dom[$key][
'attribute'][
'size'])) {
 
22095                                         if ($dom[$key][
'attribute'][
'size']{0} == 
'+') {
 
22096                                              $dom[$key][
'fontsize'] = $dom[($dom[$key][
'parent'])][
'fontsize'] + intval(substr($dom[$key][
'attribute'][
'size'], 1));
 
22097                                         } 
elseif ($dom[$key][
'attribute'][
'size']{0} == 
'-') {
 
22098                                              $dom[$key][
'fontsize'] = $dom[($dom[$key][
'parent'])][
'fontsize'] - intval(substr($dom[$key][
'attribute'][
'size'], 1));
 
22100                                              $dom[$key][
'fontsize'] = intval($dom[$key][
'attribute'][
'size']);
 
22103                                         $dom[$key][
'fontsize'] = intval($dom[$key][
'attribute'][
'size']);
 
22108                          if ((($dom[$key][
'value'] == 
'ul') OR ($dom[$key][
'value'] == 
'ol') OR ($dom[$key][
'value'] == 
'dl'))
 
22109                               AND (!isset($dom[$key][
'align']) OR $this->empty_string($dom[$key][
'align']) OR ($dom[$key][
'align'] != 
'J'))) {
 
22111                                    $dom[$key][
'align'] = 
'R';
 
22113                                    $dom[$key][
'align'] = 
'L';
 
22116                          if (($dom[$key][
'value'] == 
'small') OR ($dom[$key][
'value'] == 
'sup') OR ($dom[$key][
'value'] == 
'sub')) {
 
22117                               if (!isset($dom[$key][
'attribute'][
'size']) AND !isset($dom[$key][
'style'][
'font-size'])) {
 
22118                                    $dom[$key][
'fontsize'] = $dom[$key][
'fontsize'] * 
K_SMALL_RATIO;
 
22121                          if (($dom[$key][
'value'] == 
'strong') OR ($dom[$key][
'value'] == 
'b')) {
 
22122                               $dom[$key][
'fontstyle'] .= 
'B';
 
22124                          if (($dom[$key][
'value'] == 
'em') OR ($dom[$key][
'value'] == 
'i')) {
 
22125                               $dom[$key][
'fontstyle'] .= 
'I';
 
22127                          if ($dom[$key][
'value'] == 
'u') {
 
22128                               $dom[$key][
'fontstyle'] .= 
'U';
 
22130                          if (($dom[$key][
'value'] == 
'del') OR ($dom[$key][
'value'] == 
's') OR ($dom[$key][
'value'] == 
'strike')) {
 
22131                               $dom[$key][
'fontstyle'] .= 
'D';
 
22133                          if (!isset($dom[$key][
'style'][
'text-decoration']) AND ($dom[$key][
'value'] == 
'a')) {
 
22134                               $dom[$key][
'fontstyle'] = $this->htmlLinkFontStyle;
 
22136                          if (($dom[$key][
'value'] == 
'pre') OR ($dom[$key][
'value'] == 
'tt')) {
 
22137                               $dom[$key][
'fontname'] = $this->default_monospaced_font;
 
22139                          if (($dom[$key][
'value']{0} == 
'h') AND (intval($dom[$key][
'value']{1}) > 0) AND (intval($dom[$key][
'value']{1}) < 7)) {
 
22141                               if (!isset($dom[$key][
'attribute'][
'size']) AND !isset($dom[$key][
'style'][
'font-size'])) {
 
22142                                    $headsize = (4 - intval($dom[$key][
'value']{1})) * 2;
 
22143                                    $dom[$key][
'fontsize'] = $dom[0][
'fontsize'] + $headsize;
 
22145                               if (!isset($dom[$key][
'style'][
'font-weight'])) {
 
22146                                    $dom[$key][
'fontstyle'] .= 
'B';
 
22149                          if (($dom[$key][
'value'] == 
'table')) {
 
22150                               $dom[$key][
'rows'] = 0; 
 
22151                               $dom[$key][
'trids'] = array(); 
 
22152                               $dom[$key][
'thead'] = 
''; 
 
22154                          if (($dom[$key][
'value'] == 
'tr')) {
 
22155                               $dom[$key][
'cols'] = 0;
 
22157                                    $dom[$key][
'thead'] = 
true;
 
22160                                    $dom[$key][
'thead'] = 
false;
 
22162                                    ++$dom[($dom[$key][
'parent'])][
'rows'];
 
22164                                    array_push($dom[($dom[$key][
'parent'])][
'trids'], $key);
 
22167                          if (($dom[$key][
'value'] == 
'th') OR ($dom[$key][
'value'] == 
'td')) {
 
22168                               if (isset($dom[$key][
'attribute'][
'colspan'])) {
 
22169                                    $colspan = intval($dom[$key][
'attribute'][
'colspan']);
 
22173                               $dom[$key][
'attribute'][
'colspan'] = $colspan;
 
22174                               $dom[($dom[$key][
'parent'])][
'cols'] += $colspan;
 
22177                          if (isset($dom[$key][
'attribute'][
'dir'])) {
 
22178                               $dom[$key][
'dir'] = $dom[$key][
'attribute'][
'dir'];
 
22181                          if (isset($dom[$key][
'attribute'][
'color']) AND (!$this->empty_string($dom[$key][
'attribute'][
'color']))) {
 
22182                               $dom[$key][
'fgcolor'] = $this->convertHTMLColorToDec($dom[$key][
'attribute'][
'color']);
 
22183                          } 
elseif (!isset($dom[$key][
'style'][
'color']) AND ($dom[$key][
'value'] == 
'a')) {
 
22184                               $dom[$key][
'fgcolor'] = $this->htmlLinkColorArray;
 
22187                          if (isset($dom[$key][
'attribute'][
'bgcolor']) AND (!$this->empty_string($dom[$key][
'attribute'][
'bgcolor']))) {
 
22188                               $dom[$key][
'bgcolor'] = $this->convertHTMLColorToDec($dom[$key][
'attribute'][
'bgcolor']);
 
22191                          if (isset($dom[$key][
'attribute'][
'strokecolor']) AND (!$this->empty_string($dom[$key][
'attribute'][
'strokecolor']))) {
 
22192                               $dom[$key][
'strokecolor'] = $this->convertHTMLColorToDec($dom[$key][
'attribute'][
'strokecolor']);
 
22195                          if (isset($dom[$key][
'attribute'][
'width'])) {
 
22196                               $dom[$key][
'width'] = $dom[$key][
'attribute'][
'width'];
 
22199                          if (isset($dom[$key][
'attribute'][
'height'])) {
 
22200                               $dom[$key][
'height'] = $dom[$key][
'attribute'][
'height'];
 
22203                          if (isset($dom[$key][
'attribute'][
'align']) AND (!$this->empty_string($dom[$key][
'attribute'][
'align'])) AND ($dom[$key][
'value'] !== 
'img')) {
 
22204                               $dom[$key][
'align'] = strtoupper($dom[$key][
'attribute'][
'align']{0});
 
22207                          if (isset($dom[$key][
'attribute'][
'stroke'])) {
 
22209                               $dom[$key][
'stroke'] = $this->getHTMLUnitToUnits($dom[$key][
'attribute'][
'stroke'], $dom[$key][
'fontsize'], 
'pt', 
true);
 
22211                          if (isset($dom[$key][
'attribute'][
'fill'])) {
 
22213                               if ($dom[$key][
'attribute'][
'fill'] == 
'true') {
 
22214                                    $dom[$key][
'fill'] = 
true;
 
22216                                    $dom[$key][
'fill'] = 
false;
 
22219                          if (isset($dom[$key][
'attribute'][
'clip'])) {
 
22221                               if ($dom[$key][
'attribute'][
'clip'] == 
'true') {
 
22222                                    $dom[$key][
'clip'] = 
true;
 
22224                                    $dom[$key][
'clip'] = 
false;
 
22230                     $dom[$key][
'tag'] = 
false;
 
22231                     $dom[$key][
'block'] = 
false;
 
22233                     $dom[$key][
'value'] = stripslashes($this->unhtmlentities($element));
 
22234                     $dom[$key][
'parent'] = end($level);
 
22235                     $dom[$key][
'dir'] = $dom[$dom[$key][
'parent']][
'dir'];
 
22251           $spacestr = chr(32);
 
22252           if ($this->isUnicodeFont()) {
 
22253                $spacestr = chr(0).chr(32);
 
22277      public function writeHTMLCell($w, $h, $x, $y, $html=
'', $border=0, $ln=0, $fill=
false, $reseth=
true, $align=
'', $autopadding=
true) {
 
22278           return $this->MultiCell($w, $h, $html, $border, $align, $fill, $ln, $x, $y, $reseth, 0, 
true, $autopadding, 0, 
'T', 
false);
 
22293      public function writeHTML($html, $ln=
true, $fill=
false, $reseth=
false, $cell=
false, $align=
'') {
 
22294           $gvars = $this->getGraphicVars();
 
22296           $prev_cell_margin = $this->cell_margin;
 
22297           $prev_cell_padding = $this->cell_padding;
 
22298           $prevPage = $this->page;
 
22299           $prevlMargin = $this->lMargin;
 
22300           $prevrMargin = $this->rMargin;
 
22301           $curfontname = $this->FontFamily;
 
22302           $curfontstyle = $this->FontStyle;
 
22303           $curfontsize = $this->FontSizePt;
 
22304           $curfontascent = $this->getFontAscent($curfontname, $curfontstyle, $curfontsize);
 
22305           $curfontdescent = $this->getFontDescent($curfontname, $curfontstyle, $curfontsize);
 
22306           $curfontstretcing = $this->font_stretching;
 
22307           $curfonttracking = $this->font_spacing;
 
22308           $this->newline = 
true;
 
22310           $startlinepage = $this->page;
 
22311           $minstartliney = $this->y;
 
22312           $maxbottomliney = 0;
 
22313           $startlinex = $this->x;
 
22314           $startliney = $this->y;
 
22318           $this_method_vars = array();
 
22320           $fontaligned = 
false;
 
22321           $reverse_dir = 
false; 
 
22322           $this->premode = 
false;
 
22323           if ($this->inxobj) {
 
22325                $pask = count($this->xobjects[$this->xobjid][
'annotations']);
 
22326           } 
elseif (isset($this->PageAnnots[$this->page])) {
 
22327                $pask = count($this->PageAnnots[$this->page]);
 
22331           if ($this->inxobj) {
 
22333                $startlinepos = strlen($this->xobjects[$this->xobjid][
'outdata']);
 
22334           } 
elseif (!$this->InFooter) {
 
22335                if (isset($this->footerlen[$this->page])) {
 
22336                     $this->footerpos[$this->page] = $this->pagelen[$this->page] - $this->footerlen[$this->page];
 
22338                     $this->footerpos[$this->page] = $this->pagelen[$this->page];
 
22340                $startlinepos = $this->footerpos[$this->page];
 
22343                $startlinepos = $this->pagelen[$this->page];
 
22348                $w = $this->x - $this->lMargin;
 
22350                $w = $this->w - $this->rMargin - $this->x;
 
22352           $w -= ($this->cell_padding[
'L'] + $this->cell_padding[
'R']);
 
22355                     $this->x -= $this->cell_padding[
'R'];
 
22356                     $this->lMargin += $this->cell_padding[
'R'];
 
22358                     $this->x += $this->cell_padding[
'L'];
 
22359                     $this->rMargin += $this->cell_padding[
'L'];
 
22362           if ($this->customlistindent >= 0) {
 
22363                $this->listindent = $this->customlistindent;
 
22365                $this->listindent = $this->GetStringWidth(
'000000');
 
22367           $this->listindentlevel = 0;
 
22369           $prev_cell_height_ratio = $this->cell_height_ratio;
 
22370           $prev_listnum = $this->listnum;
 
22371           $prev_listordered = $this->listordered;
 
22372           $prev_listcount = $this->listcount;
 
22373           $prev_lispacer = $this->lispacer;
 
22374           $this->listnum = 0;
 
22375           $this->listordered = array();
 
22376           $this->listcount = array();
 
22377           $this->lispacer = 
'';
 
22378           if (($this->empty_string($this->lasth)) OR ($reseth)) {
 
22380                $this->resetLastH();
 
22382           $dom = $this->getHtmlDomArray($html);
 
22383           $maxel = count($dom);
 
22385           $hidden_node_key = -1;
 
22386           while ($key < $maxel) {
 
22387                if ($dom[$key][
'tag']) {
 
22388                     if ($dom[$key][
'opening']) {
 
22389                          if (($hidden_node_key <= 0) AND $dom[$key][
'hide']) {
 
22391                               $hidden_node_key = $key;
 
22393                     } 
elseif (($hidden_node_key > 0) AND ($dom[$key][
'parent'] == $hidden_node_key)) {
 
22395                          $hidden_node_key = 0;
 
22398                if ($hidden_node_key >= 0) {
 
22401                     if ($hidden_node_key == 0) {
 
22403                          $hidden_node_key = -1;
 
22407                if ($dom[$key][
'tag'] AND isset($dom[$key][
'attribute'][
'pagebreak'])) {
 
22409                     if (($dom[$key][
'attribute'][
'pagebreak'] == 
'true') OR ($dom[$key][
'attribute'][
'pagebreak'] == 
'left') OR ($dom[$key][
'attribute'][
'pagebreak'] == 
'right')) {
 
22411                          $this->checkPageBreak($this->PageBreakTrigger + 1);
 
22412                          $this->htmlvspace = ($this->PageBreakTrigger + 1);
 
22414                     if ((($dom[$key][
'attribute'][
'pagebreak'] == 
'left') AND (((!$this->rtl) AND (($this->page % 2) == 0)) OR (($this->rtl) AND (($this->page % 2) != 0))))
 
22415                          OR (($dom[$key][
'attribute'][
'pagebreak'] == 
'right') AND (((!$this->rtl) AND (($this->page % 2) != 0)) OR (($this->rtl) AND (($this->page % 2) == 0))))) {
 
22417                          $this->checkPageBreak($this->PageBreakTrigger + 1);
 
22418                          $this->htmlvspace = ($this->PageBreakTrigger + 1);
 
22421                if ($dom[$key][
'tag'] AND $dom[$key][
'opening'] AND isset($dom[$key][
'attribute'][
'nobr']) AND ($dom[$key][
'attribute'][
'nobr'] == 
'true')) {
 
22422                     if (isset($dom[($dom[$key][
'parent'])][
'attribute'][
'nobr']) AND ($dom[($dom[$key][
'parent'])][
'attribute'][
'nobr'] == 
'true')) {
 
22423                          $dom[$key][
'attribute'][
'nobr'] = 
false;
 
22426                          $this->startTransaction();
 
22428                          $this_method_vars[
'html'] = $html;
 
22429                          $this_method_vars[
'ln'] = $ln;
 
22430                          $this_method_vars[
'fill'] = $fill;
 
22431                          $this_method_vars[
'reseth'] = $reseth;
 
22432                          $this_method_vars[
'cell'] = $cell;
 
22433                          $this_method_vars[
'align'] = $align;
 
22434                          $this_method_vars[
'gvars'] = $gvars;
 
22435                          $this_method_vars[
'prevPage'] = $prevPage;
 
22436                          $this_method_vars[
'prev_cell_margin'] = $prev_cell_margin;
 
22437                          $this_method_vars[
'prev_cell_padding'] = $prev_cell_padding;
 
22438                          $this_method_vars[
'prevlMargin'] = $prevlMargin;
 
22439                          $this_method_vars[
'prevrMargin'] = $prevrMargin;
 
22440                          $this_method_vars[
'curfontname'] = $curfontname;
 
22441                          $this_method_vars[
'curfontstyle'] = $curfontstyle;
 
22442                          $this_method_vars[
'curfontsize'] = $curfontsize;
 
22443                          $this_method_vars[
'curfontascent'] = $curfontascent;
 
22444                          $this_method_vars[
'curfontdescent'] = $curfontdescent;
 
22445                          $this_method_vars[
'curfontstretcing'] = $curfontstretcing;
 
22446                          $this_method_vars[
'curfonttracking'] = $curfonttracking;
 
22447                          $this_method_vars[
'minstartliney'] = $minstartliney;
 
22448                          $this_method_vars[
'maxbottomliney'] = $maxbottomliney;
 
22449                          $this_method_vars[
'yshift'] = $yshift;
 
22450                          $this_method_vars[
'startlinepage'] = $startlinepage;
 
22451                          $this_method_vars[
'startlinepos'] = $startlinepos;
 
22452                          $this_method_vars[
'startlinex'] = $startlinex;
 
22453                          $this_method_vars[
'startliney'] = $startliney;
 
22454                          $this_method_vars[
'newline'] = $newline;
 
22455                          $this_method_vars[
'loop'] = $loop;
 
22456                          $this_method_vars[
'curpos'] = $curpos;
 
22457                          $this_method_vars[
'pask'] = $pask;
 
22458                          $this_method_vars[
'lalign'] = $lalign;
 
22459                          $this_method_vars[
'plalign'] = $plalign;
 
22460                          $this_method_vars[
'w'] = $w;
 
22461                          $this_method_vars[
'prev_cell_height_ratio'] = $prev_cell_height_ratio;
 
22462                          $this_method_vars[
'prev_listnum'] = $prev_listnum;
 
22463                          $this_method_vars[
'prev_listordered'] = $prev_listordered;
 
22464                          $this_method_vars[
'prev_listcount'] = $prev_listcount;
 
22465                          $this_method_vars[
'prev_lispacer'] = $prev_lispacer;
 
22466                          $this_method_vars[
'fontaligned'] = $fontaligned;
 
22467                          $this_method_vars[
'key'] = $key;
 
22468                          $this_method_vars[
'dom'] = $dom;
 
22472                if (($dom[$key][
'value'] == 
'tr') AND isset($dom[$key][
'thead']) AND $dom[$key][
'thead']) {
 
22473                     if (isset($dom[$key][
'parent']) AND isset($dom[$dom[$key][
'parent']][
'thead']) AND !$this->empty_string($dom[$dom[$key][
'parent']][
'thead'])) {
 
22474                          $this->inthead = 
true;
 
22476                          $this->writeHTML($this->thead, 
false, 
false, 
false, 
false, 
'');
 
22478                          if (($this->y < $this->start_transaction_y) OR ($this->checkPageBreak($this->lasth, 
'', 
false))) {
 
22481                               $this->rollbackTransaction(
true);
 
22483                               foreach ($this_method_vars as $vkey => $vval) {
 
22487                               $tmp_thead = $this->thead;
 
22491                               if ((!$this->checkPageBreak($this->PageBreakTrigger + 1)) AND ($this->y < $pre_y)) {
 
22493                                    $startliney = $this->y;
 
22495                               $this->start_transaction_page = $this->page;
 
22496                               $this->start_transaction_y = $this->y;
 
22498                               $this->thead = $tmp_thead;
 
22500                               if (isset($dom[$dom[$key][
'parent']][
'attribute'][
'cellspacing'])) {
 
22501                                    $tmp_cellspacing = $this->getHTMLUnitToUnits($dom[$dom[$key][
'parent']][
'attribute'][
'cellspacing'], 1, 
'px');
 
22502                               } 
elseif (isset($dom[$dom[$key][
'parent']][
'border-spacing'])) {
 
22503                                    $tmp_cellspacing = $dom[$dom[$key][
'parent']][
'border-spacing'][
'V'];
 
22505                                    $tmp_cellspacing = 0;
 
22507                               $dom[$dom[$key][
'parent']][
'borderposition'][
'page'] = $this->page;
 
22508                               $dom[$dom[$key][
'parent']][
'borderposition'][
'column'] = $this->current_column;
 
22509                               $dom[$dom[$key][
'parent']][
'borderposition'][
'y'] = $this->y + $tmp_cellspacing;
 
22510                               $xoffset = ($this->x - $dom[$dom[$key][
'parent']][
'borderposition'][
'x']);
 
22511                               $dom[$dom[$key][
'parent']][
'borderposition'][
'x'] += $xoffset;
 
22512                               $dom[$dom[$key][
'parent']][
'borderposition'][
'xmax'] += $xoffset;
 
22514                               $this->writeHTML($this->thead, 
false, 
false, 
false, 
false, 
'');
 
22518                     while ( ($key < $maxel) AND (!(
 
22519                          ($dom[$key][
'tag'] AND $dom[$key][
'opening'] AND ($dom[$key][
'value'] == 
'tr') AND (!isset($dom[$key][
'thead']) OR !$dom[$key][
'thead']))
 
22520                          OR ($dom[$key][
'tag'] AND (!$dom[$key][
'opening']) AND ($dom[$key][
'value'] == 
'table'))) )) {
 
22524                if ($dom[$key][
'tag'] OR ($key == 0)) {
 
22525                     if ((($dom[$key][
'value'] == 
'table') OR ($dom[$key][
'value'] == 
'tr')) AND (isset($dom[$key][
'align']))) {
 
22526                          $dom[$key][
'align'] = ($this->rtl) ? 
'R' : 
'L';
 
22529                     if ((!$this->newline) AND ($dom[$key][
'value'] == 
'img') AND (isset($dom[$key][
'height'])) AND ($dom[$key][
'height'] > 0)) {
 
22531                          $imgh = $this->getHTMLUnitToUnits($dom[$key][
'height'], $this->lasth, 
'px');
 
22532                          $autolinebreak = 
false;
 
22533                          if (isset($dom[$key][
'width']) AND ($dom[$key][
'width'] > 0)) {
 
22534                               $imgw = $this->getHTMLUnitToUnits($dom[$key][
'width'], 1, 
'px', 
false);
 
22535                               if (($imgw <= ($this->w - $this->lMargin - $this->rMargin - $this->cell_padding[
'L'] - $this->cell_padding[
'R']))
 
22536                                    AND ((($this->rtl) AND (($this->x - $imgw) < ($this->lMargin + $this->cell_padding[
'L'])))
 
22537                                    OR ((!$this->rtl) AND (($this->x + $imgw) > ($this->w - $this->rMargin - $this->cell_padding[
'R']))))) {
 
22539                                    $autolinebreak = 
true;
 
22540                                    $this->Ln(
'', $cell);
 
22541                                    if ((!$dom[($key-1)][
'tag']) AND ($dom[($key-1)][
'value'] == 
' ')) {
 
22547                          if (!$autolinebreak) {
 
22548                               if ($this->inPageBody()) {
 
22551                                    if ((!$this->checkPageBreak($imgh)) AND ($this->y < $pre_y)) {
 
22553                                         $startliney = $this->y;
 
22556                               if ($this->page > $startlinepage) {
 
22558                                    if (isset($this->footerlen[$startlinepage])) {
 
22559                                         $curpos = $this->pagelen[$startlinepage] - $this->footerlen[$startlinepage];
 
22562                                    $pagebuff = $this->getPageBuffer($startlinepage);
 
22563                                    $linebeg = substr($pagebuff, $startlinepos, ($curpos - $startlinepos));
 
22564                                    $tstart = substr($pagebuff, 0, $startlinepos);
 
22565                                    $tend = substr($this->getPageBuffer($startlinepage), $curpos);
 
22567                                    $this->setPageBuffer($startlinepage, $tstart.
''.$tend);
 
22568                                    $pagebuff = $this->getPageBuffer($this->page);
 
22569                                    $tstart = substr($pagebuff, 0, $this->cntmrk[$this->page]);
 
22570                                    $tend = substr($pagebuff, $this->cntmrk[$this->page]);
 
22572                                    $yshift = ($minstartliney - $this->y);
 
22573                                    if ($fontaligned) {
 
22574                                         $yshift += ($curfontsize / $this->k);
 
22576                                    $try = sprintf(
'1 0 0 1 0 %F cm', ($yshift * $this->k));
 
22577                                    $this->setPageBuffer($this->page, $tstart.
"\nq\n".$try.
"\n".$linebeg.
"\nQ\n".$tend);
 
22579                                    if (isset($this->PageAnnots[$this->page])) {
 
22580                                         $next_pask = count($this->PageAnnots[$this->page]);
 
22584                                    if (isset($this->PageAnnots[$startlinepage])) {
 
22585                                         foreach ($this->PageAnnots[$startlinepage] as $pak => $pac) {
 
22586                                              if ($pak >= $pask) {
 
22587                                                   $this->PageAnnots[$this->page][] = $pac;
 
22588                                                   unset($this->PageAnnots[$startlinepage][$pak]);
 
22589                                                   $npak = count($this->PageAnnots[$this->page]) - 1;
 
22590                                                   $this->PageAnnots[$this->page][$npak][
'y'] -= $yshift;
 
22594                                    $pask = $next_pask;
 
22595                                    $startlinepos = $this->cntmrk[$this->page];
 
22596                                    $startlinepage = $this->page;
 
22597                                    $startliney = $this->y;
 
22598                                    $this->newline = 
false;
 
22600                               $this->y += ((($curfontsize * $this->cell_height_ratio / $this->k) + $curfontascent - $curfontdescent) / 2) - $imgh;
 
22601                               $minstartliney = min($this->y, $minstartliney);
 
22602                               $maxbottomliney = ($startliney + ($this->FontSize * $this->cell_height_ratio));
 
22604                     } 
elseif (isset($dom[$key][
'fontname']) OR isset($dom[$key][
'fontstyle']) OR isset($dom[$key][
'fontsize']) OR isset($dom[$key][
'line-height'])) {
 
22606                          $pfontname = $curfontname;
 
22607                          $pfontstyle = $curfontstyle;
 
22608                          $pfontsize = $curfontsize;
 
22609                          $fontname = isset($dom[$key][
'fontname']) ? $dom[$key][
'fontname'] : $curfontname;
 
22610                          $fontstyle = isset($dom[$key][
'fontstyle']) ? $dom[$key][
'fontstyle'] : $curfontstyle;
 
22611                          $fontsize = isset($dom[$key][
'fontsize']) ? $dom[$key][
'fontsize'] : $curfontsize;
 
22612                          $fontascent = $this->getFontAscent($fontname, $fontstyle, $fontsize);
 
22613                          $fontdescent = $this->getFontDescent($fontname, $fontstyle, $fontsize);
 
22614                          if (($fontname != $curfontname) OR ($fontstyle != $curfontstyle) OR ($fontsize != $curfontsize)
 
22615                               OR ($this->cell_height_ratio != $dom[$key][
'line-height'])
 
22616                               OR ($dom[$key][
'tag'] AND $dom[$key][
'opening'] AND ($dom[$key][
'value'] == 
'li')) ) {
 
22617                               if (($key < ($maxel - 1)) AND (
 
22618                                         ($dom[$key][
'tag'] AND $dom[$key][
'opening'] AND ($dom[$key][
'value'] == 
'li'))
 
22619                                         OR ($this->cell_height_ratio != $dom[$key][
'line-height'])
 
22620                                         OR (!$this->newline AND is_numeric($fontsize) AND is_numeric($curfontsize) AND ($fontsize >= 0) AND ($curfontsize >= 0) AND ($fontsize != $curfontsize))
 
22622                                    if ($this->page > $startlinepage) {
 
22624                                         if (isset($this->footerlen[$startlinepage])) {
 
22625                                              $curpos = $this->pagelen[$startlinepage] - $this->footerlen[$startlinepage];
 
22628                                         $pagebuff = $this->getPageBuffer($startlinepage);
 
22629                                         $linebeg = substr($pagebuff, $startlinepos, ($curpos - $startlinepos));
 
22630                                         $tstart = substr($pagebuff, 0, $startlinepos);
 
22631                                         $tend = substr($this->getPageBuffer($startlinepage), $curpos);
 
22633                                         $this->setPageBuffer($startlinepage, $tstart.
''.$tend);
 
22634                                         $pagebuff = $this->getPageBuffer($this->page);
 
22635                                         $tstart = substr($pagebuff, 0, $this->cntmrk[$this->page]);
 
22636                                         $tend = substr($pagebuff, $this->cntmrk[$this->page]);
 
22638                                         $yshift = ($minstartliney - $this->y);
 
22639                                         $try = sprintf(
'1 0 0 1 0 %F cm', ($yshift * $this->k));
 
22640                                         $this->setPageBuffer($this->page, $tstart.
"\nq\n".$try.
"\n".$linebeg.
"\nQ\n".$tend);
 
22642                                         if (isset($this->PageAnnots[$this->page])) {
 
22643                                              $next_pask = count($this->PageAnnots[$this->page]);
 
22647                                         if (isset($this->PageAnnots[$startlinepage])) {
 
22648                                              foreach ($this->PageAnnots[$startlinepage] as $pak => $pac) {
 
22649                                                   if ($pak >= $pask) {
 
22650                                                        $this->PageAnnots[$this->page][] = $pac;
 
22651                                                        unset($this->PageAnnots[$startlinepage][$pak]);
 
22652                                                        $npak = count($this->PageAnnots[$this->page]) - 1;
 
22653                                                        $this->PageAnnots[$this->page][$npak][
'y'] -= $yshift;
 
22657                                         $pask = $next_pask;
 
22658                                         $startlinepos = $this->cntmrk[$this->page];
 
22659                                         $startlinepage = $this->page;
 
22660                                         $startliney = $this->y;
 
22662                                    if (!isset($dom[$key][
'line-height'])) {
 
22663                                         $dom[$key][
'line-height'] = $this->cell_height_ratio;
 
22665                                    if (!$dom[$key][
'block']) {
 
22666                                         if (!(isset($dom[($key + 1)]) AND $dom[($key + 1)][
'tag'] AND (!$dom[($key + 1)][
'opening']) AND ($dom[($key + 1)][
'value'] != 
'li') AND $dom[$key][
'tag'] AND (!$dom[$key][
'opening']))) {
 
22667                                              $this->y += (((($curfontsize * $this->cell_height_ratio) - ($fontsize * $dom[$key][
'line-height'])) / $this->k) + $curfontascent - $fontascent - $curfontdescent + $fontdescent) / 2;
 
22669                                         if (($dom[$key][
'value'] != 
'sup') AND ($dom[$key][
'value'] != 
'sub')) {
 
22670                                              $current_line_align_data = array($key, $minstartliney, $maxbottomliney);
 
22671                                              if (isset($line_align_data) AND (($line_align_data[0] == ($key - 1)) OR (($line_align_data[0] == ($key - 2)) AND (isset($dom[($key - 1)])) AND (preg_match(
'/^([\s]+)$/', $dom[($key - 1)][
'value']) > 0)))) {
 
22672                                                   $minstartliney = min($this->y, $line_align_data[1]);
 
22673                                                   $maxbottomliney = max(($this->y + (($fontsize * $this->cell_height_ratio) / $this->k)), $line_align_data[2]);
 
22675                                                   $minstartliney = min($this->y, $minstartliney);
 
22676                                                   $maxbottomliney = max(($this->y + (($fontsize * $this->cell_height_ratio) / $this->k)), $maxbottomliney);
 
22678                                              $line_align_data = $current_line_align_data;
 
22681                                    $this->cell_height_ratio = $dom[$key][
'line-height'];
 
22682                                    $fontaligned = 
true;
 
22684                               $this->SetFont($fontname, $fontstyle, $fontsize);
 
22686                               $this->resetLastH();
 
22687                               $curfontname = $fontname;
 
22688                               $curfontstyle = $fontstyle;
 
22689                               $curfontsize = $fontsize;
 
22690                               $curfontascent = $fontascent;
 
22691                               $curfontdescent = $fontdescent;
 
22695                     $textstroke = isset($dom[$key][
'stroke']) ? $dom[$key][
'stroke'] : $this->textstrokewidth;
 
22696                     $textfill = isset($dom[$key][
'fill']) ? $dom[$key][
'fill'] : (($this->textrendermode % 2) == 0);
 
22697                     $textclip = isset($dom[$key][
'clip']) ? $dom[$key][
'clip'] : ($this->textrendermode > 3);
 
22698                     $this->setTextRenderingMode($textstroke, $textfill, $textclip);
 
22699                     if (isset($dom[$key][
'font-stretch']) AND ($dom[$key][
'font-stretch'] !== 
false)) {
 
22700                          $this->setFontStretching($dom[$key][
'font-stretch']);
 
22702                     if (isset($dom[$key][
'letter-spacing']) AND ($dom[$key][
'letter-spacing'] !== 
false)) {
 
22703                          $this->setFontSpacing($dom[$key][
'letter-spacing']);
 
22705                     if (($plalign == 
'J') AND $dom[$key][
'block']) {
 
22709                     $curpos = $this->pagelen[$startlinepage];
 
22710                     if (isset($dom[$key][
'bgcolor']) AND ($dom[$key][
'bgcolor'] !== 
false)) {
 
22711                          $this->SetFillColorArray($dom[$key][
'bgcolor']);
 
22714                          $wfill = $fill | 
false;
 
22716                     if (isset($dom[$key][
'fgcolor']) AND ($dom[$key][
'fgcolor'] !== 
false)) {
 
22717                          $this->SetTextColorArray($dom[$key][
'fgcolor']);
 
22719                     if (isset($dom[$key][
'strokecolor']) AND ($dom[$key][
'strokecolor'] !== 
false)) {
 
22720                          $this->SetDrawColorArray($dom[$key][
'strokecolor']);
 
22722                     if (isset($dom[$key][
'align'])) {
 
22723                          $lalign = $dom[$key][
'align'];
 
22725                     if ($this->empty_string($lalign)) {
 
22730                if ($this->newline AND (strlen($dom[$key][
'value']) > 0) AND ($dom[$key][
'value'] != 
'td') AND ($dom[$key][
'value'] != 
'th')) {
 
22732                     $fontaligned = 
false;
 
22734                     if (isset($startlinex)) {
 
22735                          $yshift = ($minstartliney - $startliney);
 
22736                          if (($yshift > 0) OR ($this->page > $startlinepage)) {
 
22741                          $linew = abs($this->endlinex - $startlinex);
 
22742                          if ($this->inxobj) {
 
22744                               $pstart = substr($this->xobjects[$this->xobjid][
'outdata'], 0, $startlinepos);
 
22745                               if (isset($opentagpos)) {
 
22746                                    $midpos = $opentagpos;
 
22751                                    $pmid = substr($this->xobjects[$this->xobjid][
'outdata'], $startlinepos, ($midpos - $startlinepos));
 
22752                                    $pend = substr($this->xobjects[$this->xobjid][
'outdata'], $midpos);
 
22754                                    $pmid = substr($this->xobjects[$this->xobjid][
'outdata'], $startlinepos);
 
22758                               $pstart = substr($this->getPageBuffer($startlinepage), 0, $startlinepos);
 
22759                               if (isset($opentagpos) AND isset($this->footerlen[$startlinepage]) AND (!$this->InFooter)) {
 
22760                                    $this->footerpos[$startlinepage] = $this->pagelen[$startlinepage] - $this->footerlen[$startlinepage];
 
22761                                    $midpos = min($opentagpos, $this->footerpos[$startlinepage]);
 
22762                               } 
elseif (isset($opentagpos)) {
 
22763                                    $midpos = $opentagpos;
 
22764                               } 
elseif (isset($this->footerlen[$startlinepage]) AND (!$this->InFooter)) {
 
22765                                    $this->footerpos[$startlinepage] = $this->pagelen[$startlinepage] - $this->footerlen[$startlinepage];
 
22766                                    $midpos = $this->footerpos[$startlinepage];
 
22771                                    $pmid = substr($this->getPageBuffer($startlinepage), $startlinepos, ($midpos - $startlinepos));
 
22772                                    $pend = substr($this->getPageBuffer($startlinepage), $midpos);
 
22774                                    $pmid = substr($this->getPageBuffer($startlinepage), $startlinepos);
 
22778                          if ((isset($plalign) AND ((($plalign == 
'C') OR ($plalign == 
'J') OR (($plalign == 
'R') AND (!$this->rtl)) OR (($plalign == 
'L') AND ($this->rtl)))))) {
 
22781                               if (($plalign == 
'J') AND $this->isRTLTextDir() AND ($this->num_columns > 1)) {
 
22782                                    $tw += $this->cell_padding[
'R'];
 
22784                               if ($this->lMargin != $prevlMargin) {
 
22785                                    $tw += ($prevlMargin - $this->lMargin);
 
22787                               if ($this->rMargin != $prevrMargin) {
 
22788                                    $tw += ($prevrMargin - $this->rMargin);
 
22790                               $one_space_width = $this->GetStringWidth(chr(32));
 
22792                               if ($this->isRTLTextDir()) { 
 
22794                                    $pos1 = $this->revstrpos($pmid, 
'[(');
 
22796                                         $pos1 = intval($pos1);
 
22797                                         if ($this->isUnicodeFont()) {
 
22798                                              $pos2 = intval($this->revstrpos($pmid, 
'[('.chr(0).chr(32)));
 
22801                                              $pos2 = intval($this->revstrpos($pmid, 
'[('.chr(32)));
 
22804                                         if ($pos1 == $pos2) {
 
22805                                              $pmid = substr($pmid, 0, ($pos1 + 2)).substr($pmid, ($pos1 + 2 + $spacelen));
 
22806                                              if (substr($pmid, $pos1, 4) == 
'[()]') {
 
22807                                                   $linew -= $one_space_width;
 
22808                                              } 
elseif ($pos1 == strpos($pmid, 
'[(')) {
 
22815                                    $pos1 = $this->revstrpos($pmid, 
')]');
 
22817                                         $pos1 = intval($pos1);
 
22818                                         if ($this->isUnicodeFont()) {
 
22819                                              $pos2 = intval($this->revstrpos($pmid, chr(0).chr(32).
')]')) + 2;
 
22822                                              $pos2 = intval($this->revstrpos($pmid, chr(32).
')]')) + 1;
 
22825                                         if ($pos1 == $pos2) {
 
22826                                              $pmid = substr($pmid, 0, ($pos1 - $spacelen)).substr($pmid, $pos1);
 
22827                                              $linew -= $one_space_width;
 
22831                               $mdiff = ($tw - $linew);
 
22832                               if ($plalign == 
'C') {
 
22834                                         $t_x = -($mdiff / 2);
 
22836                                         $t_x = ($mdiff / 2);
 
22838                               } 
elseif ($plalign == 
'R') {
 
22841                               } 
elseif ($plalign == 
'L') {
 
22844                               } 
elseif (($plalign == 
'J') AND ($plalign == $lalign)) {
 
22846                                    if ($this->isRTLTextDir()) {
 
22853                                    $pmidtemp = preg_replace(
'/[\\\][\(]/x', 
'\\#!#OP#!#', $pmidtemp);
 
22854                                    $pmidtemp = preg_replace(
'/[\\\][\)]/x', 
'\\#!#CP#!#', $pmidtemp);
 
22856                                    if (preg_match_all(
'/\[\(([^\)]*)\)\]/x', $pmidtemp, $lnstring, PREG_PATTERN_ORDER)) {
 
22857                                         $spacestr = $this->getSpaceString();
 
22858                                         $maxkk = count($lnstring[1]) - 1;
 
22859                                         for ($kk=0; $kk <= $maxkk; ++$kk) {
 
22861                                              $lnstring[1][$kk] = str_replace(
'#!#OP#!#', 
'(', $lnstring[1][$kk]);
 
22862                                              $lnstring[1][$kk] = str_replace(
'#!#CP#!#', 
')', $lnstring[1][$kk]);
 
22864                                              $lnstring[2][$kk] = substr_count($lnstring[1][$kk], $spacestr);
 
22866                                              $ns += $lnstring[2][$kk];
 
22867                                              $lnstring[3][$kk] = $ns;
 
22873                                         $spacewidth = ($mdiff / ($ns - $no)) * $this->k;
 
22874                                         $spacewidthu = -1000 * ($mdiff + (($ns + $no) * $one_space_width)) / $ns / $this->FontSize;
 
22875                                         if ($this->font_spacing != 0) {
 
22877                                              $osw = -1000 * $this->font_spacing / $this->FontSize;
 
22878                                              $spacewidthu += $osw;
 
22885                                         $prev_epsposbeg = 0;
 
22887                                         if ($this->isRTLTextDir()) {
 
22888                                              $textpos = $this->wPt;
 
22891                                         while (preg_match(
'/([0-9\.\+\-]*)[\s](Td|cm|m|l|c|re)[\s]/x', $pmid, $strpiece, PREG_OFFSET_CAPTURE, $offset) == 1) {
 
22893                                              $stroffset = strpos($pmid, 
'[(', $offset);
 
22894                                              if (($stroffset !== 
false) AND ($stroffset <= $strpiece[2][1])) {
 
22896                                                   $offset = strpos($pmid, 
')]', $stroffset);
 
22897                                                   while (($offset !== 
false) AND ($pmid[($offset - 1)] == 
'\\')) {
 
22898                                                        $offset = strpos($pmid, 
')]', ($offset + 1));
 
22900                                                   if ($offset === 
false) {
 
22901                                                        $this->Error(
'HTML Justification: malformed PDF code.');
 
22905                                              if ($this->isRTLTextDir()) {
 
22906                                                   $spacew = ($spacewidth * ($nsmax - $ns));
 
22908                                                   $spacew = ($spacewidth * $ns);
 
22910                                              $offset = $strpiece[2][1] + strlen($strpiece[2][0]);
 
22911                                              $epsposbeg = strpos($pmid, 
'q'.$this->epsmarker, $offset);
 
22912                                              $epsposend = strpos($pmid, $this->epsmarker.
'Q', $offset) + strlen($this->epsmarker.
'Q');
 
22913                                              if ((($epsposbeg > 0) AND ($epsposend > 0) AND ($offset > $epsposbeg) AND ($offset < $epsposend))
 
22914                                                   OR (($epsposbeg === 
false) AND ($epsposend > 0) AND ($offset < $epsposend))) {
 
22916                                                   $trx = sprintf(
'1 0 0 1 %F 0 cm', $spacew);
 
22917                                                   $epsposbeg = strpos($pmid, 
'q'.$this->epsmarker, ($prev_epsposbeg - 6));
 
22918                                                   $pmid_b = substr($pmid, 0, $epsposbeg);
 
22919                                                   $pmid_m = substr($pmid, $epsposbeg, ($epsposend - $epsposbeg));
 
22920                                                   $pmid_e = substr($pmid, $epsposend);
 
22921                                                   $pmid = $pmid_b.
"\nq\n".$trx.
"\n".$pmid_m.
"\nQ\n".$pmid_e;
 
22922                                                   $offset = $epsposend;
 
22926                                              $prev_epsposbeg = $epsposbeg;
 
22929                                              switch ($strpiece[2][0]) {
 
22935                                                        preg_match(
'/([0-9\.\+\-]*)[\s]('.$strpiece[1][0].
')[\s]('.$strpiece[2][0].
')([\s]*)/x', $pmid, $xmatches);
 
22936                                                        $currentxpos = $xmatches[1];
 
22937                                                        $textpos = $currentxpos;
 
22938                                                        if (($strcount <= $maxkk) AND ($strpiece[2][0] == 
'Td')) {
 
22939                                                             $ns = $lnstring[3][$strcount];
 
22940                                                             if ($this->isRTLTextDir()) {
 
22941                                                                  $spacew = ($spacewidth * ($nsmax - $ns));
 
22946                                                        $pmid = preg_replace_callback(
'/([0-9\.\+\-]*)[\s]('.$strpiece[1][0].
')[\s]('.$strpiece[2][0].
')([\s]*)/x',
 
22947                                                             create_function(
'$matches', 
'global $spacew; 
22948                                                             $newx = sprintf("%F",(floatval($matches[1]) + $spacew)); 
22949                                                             return "".$newx." ".$matches[2]." x*#!#*x".$matches[3].$matches[4];'), $pmid, 1);
 
22954                                                        if (!$this->empty_string($this->lispacer)) {
 
22955                                                             $this->lispacer = 
'';
 
22958                                                        preg_match(
'/([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]('.$strpiece[1][0].
')[\s](re)([\s]*)/x', $pmid, $xmatches);
 
22959                                                        $currentxpos = $xmatches[1];
 
22960                                                        global $x_diff, $w_diff;
 
22963                                                        if ($this->isRTLTextDir()) { 
 
22964                                                             if ($currentxpos < $textpos) {
 
22965                                                                  $x_diff = ($spacewidth * ($nsmax - $lnstring[3][$strcount]));
 
22966                                                                  $w_diff = ($spacewidth * $lnstring[2][$strcount]);
 
22968                                                                  if ($strcount > 0) {
 
22969                                                                       $x_diff = ($spacewidth * ($nsmax - $lnstring[3][($strcount - 1)]));
 
22970                                                                       $w_diff = ($spacewidth * $lnstring[2][($strcount - 1)]);
 
22974                                                             if ($currentxpos > $textpos) {
 
22975                                                                  if ($strcount > 0) {
 
22976                                                                       $x_diff = ($spacewidth * $lnstring[3][($strcount - 1)]);
 
22978                                                                  $w_diff = ($spacewidth * $lnstring[2][$strcount]);
 
22980                                                                  if ($strcount > 1) {
 
22981                                                                       $x_diff = ($spacewidth * $lnstring[3][($strcount - 2)]);
 
22983                                                                  if ($strcount > 0) {
 
22984                                                                       $w_diff = ($spacewidth * $lnstring[2][($strcount - 1)]);
 
22988                                                        $pmid = preg_replace_callback(
'/('.$xmatches[1].
')[\s]('.$xmatches[2].
')[\s]('.$xmatches[3].
')[\s]('.$strpiece[1][0].
')[\s](re)([\s]*)/x',
 
22989                                                             create_function(
'$matches', 
'global $x_diff, $w_diff; 
22990                                                             $newx = sprintf("%F",(floatval($matches[1]) + $x_diff)); 
22991                                                             $neww = sprintf("%F",(floatval($matches[3]) + $w_diff)); 
22992                                                             return "".$newx." ".$matches[2]." ".$neww." ".$matches[4]." x*#!#*x".$matches[5].$matches[6];'), $pmid, 1);
 
22997                                                        preg_match(
'/([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]('.$strpiece[1][0].
')[\s](c)([\s]*)/x', $pmid, $xmatches);
 
22998                                                        $currentxpos = $xmatches[1];
 
23000                                                        $pmid = preg_replace_callback(
'/('.$xmatches[1].
')[\s]('.$xmatches[2].
')[\s]('.$xmatches[3].
')[\s]('.$xmatches[4].
')[\s]('.$xmatches[5].
')[\s]('.$strpiece[1][0].
')[\s](c)([\s]*)/x',
 
23001                                                             create_function(
'$matches', 
'global $spacew; 
23002                                                             $newx1 = sprintf("%F",(floatval($matches[1]) + $spacew)); 
23003                                                             $newx2 = sprintf("%F",(floatval($matches[3]) + $spacew)); 
23004                                                             $newx3 = sprintf("%F",(floatval($matches[5]) + $spacew)); 
23005                                                             return "".$newx1." ".$matches[2]." ".$newx2." ".$matches[4]." ".$newx3." ".$matches[6]." x*#!#*x".$matches[7].$matches[8];'), $pmid, 1);
 
23010                                              $cxpos = ($currentxpos / $this->k);
 
23011                                              $lmpos = ($this->lMargin + $this->cell_padding[
'L'] + $this->feps);
 
23012                                              if ($this->inxobj) {
 
23014                                                   foreach ($this->xobjects[$this->xobjid][
'annotations'] as $pak => $pac) {
 
23015                                                        if (($pac[
'y'] >= $minstartliney) AND (($pac[
'x'] * $this->k) >= ($currentxpos - $this->feps)) AND (($pac[
'x'] * $this->k) <= ($currentxpos + $this->feps))) {
 
23016                                                             if ($cxpos > $lmpos) {
 
23017                                                                  $this->xobjects[$this->xobjid][
'annotations'][$pak][
'x'] += ($spacew / $this->k);
 
23018                                                                  $this->xobjects[$this->xobjid][
'annotations'][$pak][
'w'] += (($spacewidth * $pac[
'numspaces']) / $this->k);
 
23020                                                                  $this->xobjects[$this->xobjid][
'annotations'][$pak][
'w'] += (($spacewidth * $pac[
'numspaces']) / $this->k);
 
23025                                              } 
elseif (isset($this->PageAnnots[$this->page])) {
 
23026                                                   foreach ($this->PageAnnots[$this->page] as $pak => $pac) {
 
23027                                                        if (($pac[
'y'] >= $minstartliney) AND (($pac[
'x'] * $this->k) >= ($currentxpos - $this->feps)) AND (($pac[
'x'] * $this->k) <= ($currentxpos + $this->feps))) {
 
23028                                                             if ($cxpos > $lmpos) {
 
23029                                                                  $this->PageAnnots[$this->page][$pak][
'x'] += ($spacew / $this->k);
 
23030                                                                  $this->PageAnnots[$this->page][$pak][
'w'] += (($spacewidth * $pac[
'numspaces']) / $this->k);
 
23032                                                                  $this->PageAnnots[$this->page][$pak][
'w'] += (($spacewidth * $pac[
'numspaces']) / $this->k);
 
23040                                         $pmid = str_replace(
'x*#!#*x', 
'', $pmid);
 
23041                                         if ($this->isUnicodeFont()) {
 
23043                                              $spacew = $spacewidthu;
 
23044                                              if ($this->font_stretching != 100) {
 
23046                                                   $spacew /= ($this->font_stretching / 100);
 
23050                                              $pmidtemp = preg_replace(
'/[\\\][\(]/x', 
'\\#!#OP#!#', $pmidtemp);
 
23051                                              $pmidtemp = preg_replace(
'/[\\\][\)]/x', 
'\\#!#CP#!#', $pmidtemp);
 
23052                                              $pmid = preg_replace_callback(
"/\[\(([^\)]*)\)\]/x",
 
23053                                                             create_function(
'$matches', 
'global $spacew; 
23054                                                             $matches[1] = str_replace("#!#OP#!#", "(", $matches[1]); 
23055                                                             $matches[1] = str_replace("#!#CP#!#", ")", $matches[1]); 
23056                                                             return "[(".str_replace(chr(0).chr(32), ") ".sprintf("%F", $spacew)." (", $matches[1]).")]";'), $pmidtemp);
 
23057                                              if ($this->inxobj) {
 
23059                                                   $this->xobjects[$this->xobjid][
'outdata'] = $pstart.
"\n".$pmid.
"\n".$pend;
 
23061                                                   $this->setPageBuffer($startlinepage, $pstart.
"\n".$pmid.
"\n".$pend);
 
23063                                              $endlinepos = strlen($pstart.
"\n".$pmid.
"\n");
 
23066                                              if ($this->font_stretching != 100) {
 
23068                                                   $spacewidth /= ($this->font_stretching / 100);
 
23070                                              $rs = sprintf(
'%F Tw', $spacewidth);
 
23071                                              $pmid = preg_replace(
"/\[\(/x", $rs.
' [(', $pmid);
 
23072                                              if ($this->inxobj) {
 
23074                                                   $this->xobjects[$this->xobjid][
'outdata'] = $pstart.
"\n".$pmid.
"\nBT 0 Tw ET\n".$pend;
 
23076                                                   $this->setPageBuffer($startlinepage, $pstart.
"\n".$pmid.
"\nBT 0 Tw ET\n".$pend);
 
23078                                              $endlinepos = strlen($pstart.
"\n".$pmid.
"\nBT 0 Tw ET\n");
 
23083                          if (($t_x != 0) OR ($yshift < 0)) {
 
23085                               $trx = sprintf(
'1 0 0 1 %F %F cm', ($t_x * $this->k), ($yshift * $this->k));
 
23086                               $pstart .= 
"\nq\n".$trx.
"\n".$pmid.
"\nQ\n";
 
23087                               $endlinepos = strlen($pstart);
 
23088                               if ($this->inxobj) {
 
23090                                    $this->xobjects[$this->xobjid][
'outdata'] = $pstart.$pend;
 
23091                                    foreach ($this->xobjects[$this->xobjid][
'annotations'] as $pak => $pac) {
 
23092                                         if ($pak >= $pask) {
 
23093                                              $this->xobjects[$this->xobjid][
'annotations'][$pak][
'x'] += $t_x;
 
23094                                              $this->xobjects[$this->xobjid][
'annotations'][$pak][
'y'] -= $yshift;
 
23098                                    $this->setPageBuffer($startlinepage, $pstart.$pend);
 
23100                                    if (isset($this->PageAnnots[$this->page])) {
 
23101                                         foreach ($this->PageAnnots[$this->page] as $pak => $pac) {
 
23102                                              if ($pak >= $pask) {
 
23103                                                   $this->PageAnnots[$this->page][$pak][
'x'] += $t_x;
 
23104                                                   $this->PageAnnots[$this->page][$pak][
'y'] -= $yshift;
 
23109                               $this->y -= $yshift;
 
23112                     $pbrk = $this->checkPageBreak($this->lasth);
 
23113                     $this->newline = 
false;
 
23114                     $startlinex = $this->x;
 
23115                     $startliney = $this->y;
 
23116                     if ($dom[$dom[$key][
'parent']][
'value'] == 
'sup') {
 
23117                          $startliney -= ((0.3 * $this->FontSizePt) / $this->k);
 
23118                     } 
elseif ($dom[$dom[$key][
'parent']][
'value'] == 
'sub') {
 
23119                          $startliney -= (($this->FontSizePt / 0.7) / $this->k);
 
23121                          $minstartliney = $startliney;
 
23122                          $maxbottomliney = ($this->y + (($fontsize * $this->cell_height_ratio) / $this->k));
 
23124                     $startlinepage = $this->page;
 
23125                     if (isset($endlinepos) AND (!$pbrk)) {
 
23126                          $startlinepos = $endlinepos;
 
23128                          if ($this->inxobj) {
 
23130                               $startlinepos = strlen($this->xobjects[$this->xobjid][
'outdata']);
 
23131                          } 
elseif (!$this->InFooter) {
 
23132                               if (isset($this->footerlen[$this->page])) {
 
23133                                    $this->footerpos[$this->page] = $this->pagelen[$this->page] - $this->footerlen[$this->page];
 
23135                                    $this->footerpos[$this->page] = $this->pagelen[$this->page];
 
23137                               $startlinepos = $this->footerpos[$this->page];
 
23139                               $startlinepos = $this->pagelen[$this->page];
 
23142                     unset($endlinepos);
 
23143                     $plalign = $lalign;
 
23144                     if (isset($this->PageAnnots[$this->page])) {
 
23145                          $pask = count($this->PageAnnots[$this->page]);
 
23149                     if (!($dom[$key][
'tag'] AND !$dom[$key][
'opening'] AND ($dom[$key][
'value'] == 
'table')
 
23150                          AND (isset($this->emptypagemrk[$this->page]))
 
23151                          AND ($this->emptypagemrk[$this->page] == $this->pagelen[$this->page]))) {
 
23152                          $this->SetFont($fontname, $fontstyle, $fontsize);
 
23154                               $this->SetFillColorArray($this->bgcolor);
 
23158                if (isset($opentagpos)) {
 
23159                     unset($opentagpos);
 
23161                if ($dom[$key][
'tag']) {
 
23162                     if ($dom[$key][
'opening']) {
 
23164                          if (isset($dom[$key][
'text-indent']) AND $dom[$key][
'block']) {
 
23165                               $this->textindent = $dom[$key][
'text-indent'];
 
23166                               $this->newline = 
true;
 
23169                          if ($dom[$key][
'value'] == 
'table') {
 
23172                                    $wtmp = $this->x - $this->lMargin;
 
23174                                    $wtmp = $this->w - $this->rMargin - $this->x;
 
23177                               if (isset($dom[$key][
'attribute'][
'cellspacing'])) {
 
23178                                    $clsp = $this->getHTMLUnitToUnits($dom[$key][
'attribute'][
'cellspacing'], 1, 
'px');
 
23179                                    $cellspacing = array(
'H' => $clsp, 
'V' => $clsp);
 
23180                               } 
elseif (isset($dom[$key][
'border-spacing'])) {
 
23181                                    $cellspacing = $dom[$key][
'border-spacing'];
 
23183                                    $cellspacing = array(
'H' => 0, 
'V' => 0);
 
23186                               if (isset($dom[$key][
'width'])) {
 
23187                                    $table_width = $this->getHTMLUnitToUnits($dom[$key][
'width'], $wtmp, 
'px');
 
23189                                    $table_width = $wtmp;
 
23191                               $table_width -= (2 * $cellspacing[
'H']);
 
23192                               if (!$this->inthead) {
 
23193                                    $this->y += $cellspacing[
'V'];
 
23196                                    $cellspacingx = -$cellspacing[
'H'];
 
23198                                    $cellspacingx = $cellspacing[
'H'];
 
23201                               $table_columns_width = ($table_width - ($cellspacing[
'H'] * ($dom[$key][
'cols'] - 1)));
 
23203                               $table_min_column_width = ($table_columns_width / $dom[$key][
'cols']);
 
23205                               $table_colwidths = array_fill(0, $dom[$key][
'cols'], $table_min_column_width);
 
23208                          if ($dom[$key][
'value'] == 
'tr') {
 
23213                          if (($dom[$key][
'value'] == 
'td') OR ($dom[$key][
'value'] == 
'th')) {
 
23214                               $trid = $dom[$key][
'parent'];
 
23215                               $table_el = $dom[$trid][
'parent'];
 
23216                               if (!isset($dom[$table_el][
'cols'])) {
 
23217                                    $dom[$table_el][
'cols'] = $dom[$trid][
'cols'];
 
23221                               if (isset($dom[$key][
'border']) AND !empty($dom[$key][
'border'])) {
 
23222                                    $tdborder = $dom[$key][
'border'];
 
23224                               $colspan = $dom[$key][
'attribute'][
'colspan'];
 
23225                               $old_cell_padding = $this->cell_padding;
 
23226                               if (isset($dom[($dom[$trid][
'parent'])][
'attribute'][
'cellpadding'])) {
 
23227                                    $crclpd = $this->getHTMLUnitToUnits($dom[($dom[$trid][
'parent'])][
'attribute'][
'cellpadding'], 1, 
'px');
 
23228                                    $current_cell_padding = array(
'L' => $crclpd, 
'T' => $crclpd, 
'R' => $crclpd, 
'B' => $crclpd);
 
23229                               } 
elseif (isset($dom[($dom[$trid][
'parent'])][
'padding'])) {
 
23230                                    $current_cell_padding = $dom[($dom[$trid][
'parent'])][
'padding'];
 
23232                                    $current_cell_padding = array(
'L' => 0, 
'T' => 0, 
'R' => 0, 
'B' => 0);
 
23234                               $this->cell_padding = $current_cell_padding;
 
23235                               if (isset($dom[$key][
'height'])) {
 
23237                                    $cellh = $this->getHTMLUnitToUnits($dom[$key][
'height'], 0, 
'px');
 
23241                               if (isset($dom[$key][
'content'])) {
 
23242                                    $cell_content = stripslashes($dom[$key][
'content']);
 
23244                                    $cell_content = 
' ';
 
23246                               $tagtype = $dom[$key][
'value'];
 
23248                               while (($key < $maxel) AND (!(($dom[$key][
'tag']) AND (!$dom[$key][
'opening']) AND ($dom[$key][
'value'] == $tagtype) AND ($dom[$key][
'parent'] == $parentid)))) {
 
23252                               if (!isset($dom[$trid][
'startpage'])) {
 
23253                                    $dom[$trid][
'startpage'] = $this->page;
 
23255                                    $this->setPage($dom[$trid][
'startpage']);
 
23257                               if (!isset($dom[$trid][
'startcolumn'])) {
 
23258                                    $dom[$trid][
'startcolumn'] = $this->current_column;
 
23259                               } 
elseif ($this->current_column != $dom[$trid][
'startcolumn']) {
 
23261                                    $this->selectColumn($dom[$trid][
'startcolumn']);
 
23264                               if (!isset($dom[$trid][
'starty'])) {
 
23265                                    $dom[$trid][
'starty'] = $this->y;
 
23267                                    $this->y = $dom[$trid][
'starty'];
 
23269                               if (!isset($dom[$trid][
'startx'])) {
 
23270                                    $dom[$trid][
'startx'] = $this->x;
 
23271                                    $this->x += $cellspacingx;
 
23273                                    $this->x += ($cellspacingx / 2);
 
23275                               if (isset($dom[$parentid][
'attribute'][
'rowspan'])) {
 
23276                                    $rowspan = intval($dom[$parentid][
'attribute'][
'rowspan']);
 
23281                               if (isset($dom[$table_el][
'rowspans'])) {
 
23283                                    $rskmax = count($dom[$table_el][
'rowspans']);
 
23284                                    while ($rsk < $rskmax) {
 
23285                                         $trwsp = $dom[$table_el][
'rowspans'][$rsk];
 
23286                                         $rsstartx = $trwsp[
'startx'];
 
23287                                         $rsendx = $trwsp[
'endx'];
 
23289                                         if ($trwsp[
'startpage'] < $this->page) {
 
23290                                              if (($this->rtl) AND ($this->pagedim[$this->page][
'orm'] != $this->pagedim[$trwsp[
'startpage']][
'orm'])) {
 
23291                                                   $dl = ($this->pagedim[$this->page][
'orm'] - $this->pagedim[$trwsp[
'startpage']][
'orm']);
 
23294                                              } 
elseif ((!$this->rtl) AND ($this->pagedim[$this->page][
'olm'] != $this->pagedim[$trwsp[
'startpage']][
'olm'])) {
 
23295                                                   $dl = ($this->pagedim[$this->page][
'olm'] - $this->pagedim[$trwsp[
'startpage']][
'olm']);
 
23300                                         if (($trwsp[
'rowspan'] > 0)
 
23301                                              AND ($rsstartx > ($this->x - $cellspacing[
'H'] - $current_cell_padding[
'L'] - $this->feps))
 
23302                                              AND ($rsstartx < ($this->x + $cellspacing[
'H'] + $current_cell_padding[
'R'] + $this->feps))
 
23303                                              AND (($trwsp[
'starty'] < ($this->y - $this->feps)) OR ($trwsp[
'startpage'] < $this->page) OR ($trwsp[
'startcolumn'] < $this->current_column))) {
 
23305                                              $this->x = $rsendx + $cellspacingx;
 
23307                                              $colid += $trwsp[
'colspan'];
 
23308                                              if (($trwsp[
'rowspan'] == 1)
 
23309                                                   AND (isset($dom[$trid][
'endy']))
 
23310                                                   AND (isset($dom[$trid][
'endpage']))
 
23311                                                   AND (isset($dom[$trid][
'endcolumn']))
 
23312                                                   AND ($trwsp[
'endpage'] == $dom[$trid][
'endpage'])
 
23313                                                   AND ($trwsp[
'endcolumn'] == $dom[$trid][
'endcolumn'])) {
 
23315                                                   $dom[$table_el][
'rowspans'][$rsk][
'endy'] = max($dom[$trid][
'endy'], $trwsp[
'endy']);
 
23316                                                   $dom[$trid][
'endy'] = $dom[$table_el][
'rowspans'][$rsk][
'endy'];
 
23324                               if (isset($dom[$parentid][
'width'])) {
 
23326                                    $cellw = $this->getHTMLUnitToUnits($dom[$parentid][
'width'], $table_columns_width, 
'px');
 
23327                                    $tmpcw = ($cellw / $colspan);
 
23328                                    for (
$i = 0; 
$i < $colspan; ++
$i) {
 
23329                                         $table_colwidths[($colid + 
$i)] = $tmpcw;
 
23334                                    for (
$i = 0; 
$i < $colspan; ++
$i) {
 
23335                                         $cellw += $table_colwidths[($colid + 
$i)];
 
23338                               $cellw += (($colspan - 1) * $cellspacing[
'H']);
 
23340                               $colid += $colspan;
 
23342                               if ($rowspan > 1) {
 
23343                                    $trsid = array_push($dom[$table_el][
'rowspans'], array(
'trid' => $trid, 
'rowspan' => $rowspan, 
'mrowspan' => $rowspan, 
'colspan' => $colspan, 
'startpage' => $this->page, 
'startcolumn' => $this->current_column, 
'startx' => $this->x, 
'starty' => $this->y));
 
23345                               $cellid = array_push($dom[$trid][
'cellpos'], array(
'startx' => $this->x));
 
23346                               if ($rowspan > 1) {
 
23347                                    $dom[$trid][
'cellpos'][($cellid - 1)][
'rowspanid'] = ($trsid - 1);
 
23350                               if (isset($dom[$parentid][
'bgcolor']) AND ($dom[$parentid][
'bgcolor'] !== 
false)) {
 
23351                                    $dom[$trid][
'cellpos'][($cellid - 1)][
'bgcolor'] = $dom[$parentid][
'bgcolor'];
 
23354                               if (isset($tdborder) AND !empty($tdborder)) {
 
23355                                    $dom[$trid][
'cellpos'][($cellid - 1)][
'border'] = $tdborder;
 
23357                               $prevLastH = $this->lasth;
 
23360                                    $this->colxshift[
'x'] = $this->w - $this->x - $this->rMargin;
 
23362                                    $this->colxshift[
'x'] = $this->x - $this->lMargin;
 
23364                               $this->colxshift[
's'] = $cellspacing;
 
23365                               $this->colxshift[
'p'] = $current_cell_padding;
 
23367                               $this->MultiCell($cellw, $cellh, $cell_content, 
false, $lalign, 
false, 2, 
'', 
'', 
true, 0, 
true, 
true, 0, 
'T', 
false);
 
23369                               $this->colxshift = array(
'x' => 0, 
's' => array(
'H' => 0, 
'V' => 0), 
'p' => array(
'L' => 0, 
'T' => 0, 
'R' => 0, 
'B' => 0));
 
23370                               $this->lasth = $prevLastH;
 
23371                               $this->cell_padding = $old_cell_padding;
 
23372                               $dom[$trid][
'cellpos'][($cellid - 1)][
'endx'] = $this->x;
 
23374                               if ($rowspan <= 1) {
 
23375                                    if (isset($dom[$trid][
'endy'])) {
 
23376                                         if (($this->page == $dom[$trid][
'endpage']) AND ($this->current_column == $dom[$trid][
'endcolumn'])) {
 
23377                                              $dom[$trid][
'endy'] = max($this->y, $dom[$trid][
'endy']);
 
23378                                         } 
elseif (($this->page > $dom[$trid][
'endpage']) OR ($this->current_column > $dom[$trid][
'endcolumn'])) {
 
23379                                              $dom[$trid][
'endy'] = $this->y;
 
23382                                         $dom[$trid][
'endy'] = $this->y;
 
23384                                    if (isset($dom[$trid][
'endpage'])) {
 
23385                                         $dom[$trid][
'endpage'] = max($this->page, $dom[$trid][
'endpage']);
 
23387                                         $dom[$trid][
'endpage'] = $this->page;
 
23389                                    if (isset($dom[$trid][
'endcolumn'])) {
 
23390                                         $dom[$trid][
'endcolumn'] = max($this->current_column, $dom[$trid][
'endcolumn']);
 
23392                                         $dom[$trid][
'endcolumn'] = $this->current_column;
 
23396                                    $dom[$table_el][
'rowspans'][($trsid - 1)][
'endx'] = $this->x;
 
23397                                    $dom[$table_el][
'rowspans'][($trsid - 1)][
'endy'] = $this->y;
 
23398                                    $dom[$table_el][
'rowspans'][($trsid - 1)][
'endpage'] = $this->page;
 
23399                                    $dom[$table_el][
'rowspans'][($trsid - 1)][
'endcolumn'] = $this->current_column;
 
23401                               if (isset($dom[$table_el][
'rowspans'])) {
 
23403                                    foreach ($dom[$table_el][
'rowspans'] as $k => $trwsp) {
 
23404                                         if ($trwsp[
'rowspan'] > 0) {
 
23405                                              if (isset($dom[$trid][
'endpage'])) {
 
23406                                                   if (($trwsp[
'endpage'] == $dom[$trid][
'endpage']) AND ($trwsp[
'endcolumn'] == $dom[$trid][
'endcolumn'])) {
 
23407                                                        $dom[$table_el][
'rowspans'][$k][
'endy'] = max($dom[$trid][
'endy'], $trwsp[
'endy']);
 
23408                                                   } 
elseif (($trwsp[
'endpage'] < $dom[$trid][
'endpage']) OR ($trwsp[
'endcolumn'] < $dom[$trid][
'endcolumn'])) {
 
23409                                                        $dom[$table_el][
'rowspans'][$k][
'endy'] = $dom[$trid][
'endy'];
 
23410                                                        $dom[$table_el][
'rowspans'][$k][
'endpage'] = $dom[$trid][
'endpage'];
 
23411                                                        $dom[$table_el][
'rowspans'][$k][
'endcolumn'] = $dom[$trid][
'endcolumn'];
 
23413                                                        $dom[$trid][
'endy'] = $this->pagedim[$dom[$trid][
'endpage']][
'hk'] - $this->pagedim[$dom[$trid][
'endpage']][
'bm'];
 
23419                               $this->x += ($cellspacingx / 2);
 
23422                               if (!isset($opentagpos)) {
 
23423                                    if ($this->inxobj) {
 
23425                                         $opentagpos = strlen($this->xobjects[$this->xobjid][
'outdata']);
 
23426                                    } 
elseif (!$this->InFooter) {
 
23427                                         if (isset($this->footerlen[$this->page])) {
 
23428                                              $this->footerpos[$this->page] = $this->pagelen[$this->page] - $this->footerlen[$this->page];
 
23430                                              $this->footerpos[$this->page] = $this->pagelen[$this->page];
 
23432                                         $opentagpos = $this->footerpos[$this->page];
 
23435                               $dom = $this->openHTMLTagHandler($dom, $key, $cell);
 
23438                          $prev_numpages = $this->numpages;
 
23439                          $old_bordermrk = $this->bordermrk[$this->page];
 
23440                          $dom = $this->closeHTMLTagHandler($dom, $key, $cell, $maxbottomliney);
 
23441                          if ($this->bordermrk[$this->page] > $old_bordermrk) {
 
23442                               $startlinepos += ($this->bordermrk[$this->page] - $old_bordermrk);
 
23444                          if ($prev_numpages > $this->numpages) {
 
23445                               $startlinepage = $this->page;
 
23448                } 
elseif (strlen($dom[$key][
'value']) > 0) {
 
23450                     if (!$this->empty_string($this->lispacer) AND ($this->lispacer != 
'^')) {
 
23451                          $this->SetFont($pfontname, $pfontstyle, $pfontsize);
 
23452                          $this->resetLastH();
 
23453                          $minstartliney = $this->y;
 
23454                          $maxbottomliney = ($startliney + ($this->FontSize * $this->cell_height_ratio));
 
23455                          $this->putHtmlListBullet($this->listnum, $this->lispacer, $pfontsize);
 
23456                          $this->SetFont($curfontname, $curfontstyle, $curfontsize);
 
23457                          $this->resetLastH();
 
23458                          if (is_numeric($pfontsize) AND ($pfontsize > 0) AND is_numeric($curfontsize) AND ($curfontsize > 0) AND ($pfontsize != $curfontsize)) {
 
23459                               $pfontascent = $this->getFontAscent($pfontname, $pfontstyle, $pfontsize);
 
23460                               $pfontdescent = $this->getFontDescent($pfontname, $pfontstyle, $pfontsize);
 
23461                               $this->y += ((($pfontsize - $curfontsize) * $this->cell_height_ratio / $this->k) + $pfontascent - $curfontascent - $pfontdescent + $curfontdescent) / 2;
 
23462                               $minstartliney = min($this->y, $minstartliney);
 
23463                               $maxbottomliney = max(($this->y + (($pfontsize * $this->cell_height_ratio) / $this->k)), $maxbottomliney);
 
23467                     $this->htmlvspace = 0;
 
23468                     if ((!$this->premode) AND $this->isRTLTextDir()) {
 
23472                          if (preg_match(
'/^('.$this->re_space[
'p'].
'+)/'.$this->re_space[
'm'], $dom[$key][
'value'], $matches)) {
 
23473                               $lsp = $matches[1];
 
23475                          if (preg_match(
'/('.$this->re_space[
'p'].
'+)$/'.$this->re_space[
'm'], $dom[$key][
'value'], $matches)) {
 
23476                               $rsp = $matches[1];
 
23478                          $dom[$key][
'value'] = $rsp.$this->stringTrim($dom[$key][
'value']).$lsp;
 
23481                          if (!$this->premode) {
 
23482                               $prelen = strlen($dom[$key][
'value']);
 
23483                               if ($this->isRTLTextDir()) {
 
23485                                    $dom[$key][
'value'] = $this->stringRightTrim($dom[$key][
'value']);
 
23488                                    $dom[$key][
'value'] = $this->stringLeftTrim($dom[$key][
'value']);
 
23490                               $postlen = strlen($dom[$key][
'value']);
 
23491                               if (($postlen == 0) AND ($prelen > 0)) {
 
23492                                    $dom[$key][
'trimmed_space'] = 
true;
 
23496                          $firstblock = 
true;
 
23498                          $firstblock = 
false;
 
23500                          $dom[$key][
'value'] = preg_replace(
'/^'.$this->re_space[
'p'].
'+$/'.$this->re_space[
'm'], chr(32), $dom[$key][
'value']);
 
23504                          $this->x -= $this->textindent;
 
23506                          $this->x += $this->textindent;
 
23508                     if (!isset($dom[$key][
'trimmed_space']) OR !$dom[$key][
'trimmed_space']) {
 
23509                          $strlinelen = $this->GetStringWidth($dom[$key][
'value']);
 
23510                          if (!empty($this->HREF) AND (isset($this->HREF[
'url']))) {
 
23513                               if (isset($dom[($dom[$key][
'parent'])][
'fgcolor']) AND ($dom[($dom[$key][
'parent'])][
'fgcolor'] !== 
false)) {
 
23514                                    $hrefcolor = $dom[($dom[$key][
'parent'])][
'fgcolor'];
 
23517                               if (isset($dom[($dom[$key][
'parent'])][
'fontstyle']) AND ($dom[($dom[$key][
'parent'])][
'fontstyle'] !== 
false)) {
 
23518                                    $hrefstyle = $dom[($dom[$key][
'parent'])][
'fontstyle'];
 
23520                               $strrest = $this->addHtmlLink($this->HREF[
'url'], $dom[$key][
'value'], $wfill, 
true, $hrefcolor, $hrefstyle, 
true);
 
23524                                    $cwa = ($this->x - $this->lMargin);
 
23526                                    $cwa = ($this->w - $this->rMargin - $this->x);
 
23528                               if (($strlinelen < $cwa) AND (isset($dom[($key + 1)])) AND ($dom[($key + 1)][
'tag']) AND (!$dom[($key + 1)][
'block'])) {
 
23530                                    $nkey = ($key + 1);
 
23531                                    $write_block = 
true;
 
23532                                    $same_textdir = 
true;
 
23533                                    $tmp_fontname = $this->FontFamily;
 
23534                                    $tmp_fontstyle = $this->FontStyle;
 
23535                                    $tmp_fontsize = $this->FontSizePt;
 
23536                                    while ($write_block AND isset($dom[$nkey])) {
 
23537                                         if ($dom[$nkey][
'tag']) {
 
23538                                              if ($dom[$nkey][
'block']) {
 
23540                                                   $write_block = 
false;
 
23542                                              $tmp_fontname = isset($dom[$nkey][
'fontname']) ? $dom[$nkey][
'fontname'] : $this->FontFamily;
 
23543                                              $tmp_fontstyle = isset($dom[$nkey][
'fontstyle']) ? $dom[$nkey][
'fontstyle'] : $this->FontStyle;
 
23544                                              $tmp_fontsize = isset($dom[$nkey][
'fontsize']) ? $dom[$nkey][
'fontsize'] : $this->FontSizePt;
 
23545                                              $same_textdir = ($dom[$nkey][
'dir'] == $dom[$key][
'dir']);
 
23547                                              $nextstr = preg_split(
'/'.$this->re_space[
'p'].
'+/'.$this->re_space[
'm'], $dom[$nkey][
'value']);
 
23548                                              if (isset($nextstr[0]) AND $same_textdir) {
 
23549                                                   $wadj += $this->GetStringWidth($nextstr[0], $tmp_fontname, $tmp_fontstyle, $tmp_fontsize);
 
23550                                                   if (isset($nextstr[1])) {
 
23551                                                        $write_block = 
false;
 
23558                               if (($wadj > 0) AND (($strlinelen + $wadj) >= $cwa)) {
 
23560                                    $nextstr = preg_split(
'/'.$this->re_space[
'p'].
'/'.$this->re_space[
'm'], $dom[$key][
'value']);
 
23561                                    $numblks = count($nextstr);
 
23562                                    if ($numblks > 1) {
 
23564                                         $wadj = ($cwa - $strlinelen + $this->GetStringWidth($nextstr[($numblks - 1)]));
 
23567                                         $wadj = $this->GetStringWidth($nextstr[0]);
 
23571                               if (($wadj > 0) AND (($this->rtl AND ($this->tmprtl === 
'L')) OR (!$this->rtl AND ($this->tmprtl === 
'R')))) {
 
23573                                    $reverse_dir = 
true;
 
23574                                    $this->rtl = !$this->rtl;
 
23575                                    $revshift = ($strlinelen + $wadj + 0.000001); 
 
23577                                         $this->x += $revshift;
 
23579                                         $this->x -= $revshift;
 
23584                               $strrest = $this->Write($this->lasth, $dom[$key][
'value'], 
'', $wfill, 
'', 
false, 0, 
true, $firstblock, 0, $wadj);
 
23586                               if ($reverse_dir AND ($wadj == 0)) {
 
23588                                    $this->rtl = !$this->rtl;
 
23589                                    $reverse_dir = 
false;
 
23593                     $this->textindent = 0;
 
23594                     if (strlen($strrest) > 0) {
 
23596                          $this->newline = 
true;
 
23597                          if ($strrest == $dom[$key][
'value']) {
 
23603                          $dom[$key][
'value'] = $strrest;
 
23606                                    $this->x -= $this->cell_padding[
'R'];
 
23608                                    $this->x += $this->cell_padding[
'L'];
 
23617                           if ($this->font_spacing > 0) {
 
23619                                    $this->x -= $this->font_spacing;
 
23621                                    $this->x += $this->font_spacing;
 
23627                if (isset($dom[$key][
'tag']) AND $dom[$key][
'tag'] AND (!isset($dom[$key][
'opening']) OR !$dom[$key][
'opening']) AND isset($dom[($dom[$key][
'parent'])][
'attribute'][
'nobr']) AND ($dom[($dom[$key][
'parent'])][
'attribute'][
'nobr'] == 
'true')) {
 
23629                     if ((!$undo) AND (($this->y < $this->start_transaction_y) OR (($dom[$key][
'value'] == 
'tr') AND ($dom[($dom[$key][
'parent'])][
'endy'] < $this->start_transaction_y)))) {
 
23632                          $this->rollbackTransaction(
true);
 
23634                          foreach ($this_method_vars as $vkey => $vval) {
 
23639                          if ((!$this->checkPageBreak($this->PageBreakTrigger + 1)) AND ($this->y < $pre_y)) {
 
23640                               $startliney = $this->y;
 
23649           if (isset($startlinex)) {
 
23650                $yshift = ($minstartliney - $startliney);
 
23651                if (($yshift > 0) OR ($this->page > $startlinepage)) {
 
23656                $linew = abs($this->endlinex - $startlinex);
 
23657                if ($this->inxobj) {
 
23659                     $pstart = substr($this->xobjects[$this->xobjid][
'outdata'], 0, $startlinepos);
 
23660                     if (isset($opentagpos)) {
 
23661                          $midpos = $opentagpos;
 
23666                          $pmid = substr($this->xobjects[$this->xobjid][
'outdata'], $startlinepos, ($midpos - $startlinepos));
 
23667                          $pend = substr($this->xobjects[$this->xobjid][
'outdata'], $midpos);
 
23669                          $pmid = substr($this->xobjects[$this->xobjid][
'outdata'], $startlinepos);
 
23673                     $pstart = substr($this->getPageBuffer($startlinepage), 0, $startlinepos);
 
23674                     if (isset($opentagpos) AND isset($this->footerlen[$startlinepage]) AND (!$this->InFooter)) {
 
23675                          $this->footerpos[$startlinepage] = $this->pagelen[$startlinepage] - $this->footerlen[$startlinepage];
 
23676                          $midpos = min($opentagpos, $this->footerpos[$startlinepage]);
 
23677                     } 
elseif (isset($opentagpos)) {
 
23678                          $midpos = $opentagpos;
 
23679                     } 
elseif (isset($this->footerlen[$startlinepage]) AND (!$this->InFooter)) {
 
23680                          $this->footerpos[$startlinepage] = $this->pagelen[$startlinepage] - $this->footerlen[$startlinepage];
 
23681                          $midpos = $this->footerpos[$startlinepage];
 
23686                          $pmid = substr($this->getPageBuffer($startlinepage), $startlinepos, ($midpos - $startlinepos));
 
23687                          $pend = substr($this->getPageBuffer($startlinepage), $midpos);
 
23689                          $pmid = substr($this->getPageBuffer($startlinepage), $startlinepos);
 
23693                if ((isset($plalign) AND ((($plalign == 
'C') OR (($plalign == 
'R') AND (!$this->rtl)) OR (($plalign == 
'L') AND ($this->rtl)))))) {
 
23696                     if ($this->lMargin != $prevlMargin) {
 
23697                          $tw += ($prevlMargin - $this->lMargin);
 
23699                     if ($this->rMargin != $prevrMargin) {
 
23700                          $tw += ($prevrMargin - $this->rMargin);
 
23702                     $one_space_width = $this->GetStringWidth(chr(32));
 
23704                     if ($this->isRTLTextDir()) { 
 
23706                          $pos1 = $this->revstrpos($pmid, 
'[(');
 
23708                               $pos1 = intval($pos1);
 
23709                               if ($this->isUnicodeFont()) {
 
23710                                    $pos2 = intval($this->revstrpos($pmid, 
'[('.chr(0).chr(32)));
 
23713                                    $pos2 = intval($this->revstrpos($pmid, 
'[('.chr(32)));
 
23716                               if ($pos1 == $pos2) {
 
23717                                    $pmid = substr($pmid, 0, ($pos1 + 2)).substr($pmid, ($pos1 + 2 + $spacelen));
 
23718                                    if (substr($pmid, $pos1, 4) == 
'[()]') {
 
23719                                         $linew -= $one_space_width;
 
23720                                    } 
elseif ($pos1 == strpos($pmid, 
'[(')) {
 
23727                          $pos1 = $this->revstrpos($pmid, 
')]');
 
23729                               $pos1 = intval($pos1);
 
23730                               if ($this->isUnicodeFont()) {
 
23731                                    $pos2 = intval($this->revstrpos($pmid, chr(0).chr(32).
')]')) + 2;
 
23734                                    $pos2 = intval($this->revstrpos($pmid, chr(32).
')]')) + 1;
 
23737                               if ($pos1 == $pos2) {
 
23738                                    $pmid = substr($pmid, 0, ($pos1 - $spacelen)).substr($pmid, $pos1);
 
23739                                    $linew -= $one_space_width;
 
23743                     $mdiff = ($tw - $linew);
 
23744                     if ($plalign == 
'C') {
 
23746                               $t_x = -($mdiff / 2);
 
23748                               $t_x = ($mdiff / 2);
 
23750                     } 
elseif ($plalign == 
'R') {
 
23753                     } 
elseif ($plalign == 
'L') {
 
23758                if (($t_x != 0) OR ($yshift < 0)) {
 
23760                     $trx = sprintf(
'1 0 0 1 %F %F cm', ($t_x * $this->k), ($yshift * $this->k));
 
23761                     $pstart .= 
"\nq\n".$trx.
"\n".$pmid.
"\nQ\n";
 
23762                     $endlinepos = strlen($pstart);
 
23763                     if ($this->inxobj) {
 
23765                          $this->xobjects[$this->xobjid][
'outdata'] = $pstart.$pend;
 
23766                          foreach ($this->xobjects[$this->xobjid][
'annotations'] as $pak => $pac) {
 
23767                               if ($pak >= $pask) {
 
23768                                    $this->xobjects[$this->xobjid][
'annotations'][$pak][
'x'] += $t_x;
 
23769                                    $this->xobjects[$this->xobjid][
'annotations'][$pak][
'y'] -= $yshift;
 
23773                          $this->setPageBuffer($startlinepage, $pstart.$pend);
 
23775                          if (isset($this->PageAnnots[$this->page])) {
 
23776                               foreach ($this->PageAnnots[$this->page] as $pak => $pac) {
 
23777                                    if ($pak >= $pask) {
 
23778                                         $this->PageAnnots[$this->page][$pak][
'x'] += $t_x;
 
23779                                         $this->PageAnnots[$this->page][$pak][
'y'] -= $yshift;
 
23784                     $this->y -= $yshift;
 
23789           $this->setGraphicVars($gvars);
 
23790           if ($this->num_columns > 1) {
 
23791                $this->selectColumn();
 
23792           } 
elseif ($this->page > $prevPage) {
 
23793                $this->lMargin = $this->pagedim[$this->page][
'olm'];
 
23794                $this->rMargin = $this->pagedim[$this->page][
'orm'];
 
23797           $this->cell_height_ratio = $prev_cell_height_ratio;
 
23798           $this->listnum = $prev_listnum;
 
23799           $this->listordered = $prev_listordered;
 
23800           $this->listcount = $prev_listcount;
 
23801           $this->lispacer = $prev_lispacer;
 
23802           if ($ln AND (!($cell AND ($dom[$key-1][
'value'] == 
'table')))) {
 
23803                $this->Ln($this->lasth);
 
23804                if ($this->y < $maxbottomliney) {
 
23805                     $this->y = $maxbottomliney;
 
23821           $parent = $dom[($dom[$key][
'parent'])];
 
23822           $firsttag = ($key == 1);
 
23824           if (isset($tag[
'dir'])) {
 
23825                $this->setTempRTL($tag[
'dir']);
 
23827                $this->tmprtl = 
false;
 
23829           if ($tag[
'block']) {
 
23833                if (isset($this->tagvspaces[$tag[
'value']][0][
'h']) AND ($this->tagvspaces[$tag[
'value']][0][
'h'] >= 0)) {
 
23834                     $cur_h = $this->tagvspaces[$tag[
'value']][0][
'h'];
 
23835                } 
elseif (isset($tag[
'fontsize'])) {
 
23836                     $cur_h = ($tag[
'fontsize'] / $this->k) * $this->cell_height_ratio;
 
23838                     $cur_h = $this->FontSize * $this->cell_height_ratio;
 
23840                if (isset($this->tagvspaces[$tag[
'value']][0][
'n'])) {
 
23841                     $n = $this->tagvspaces[$tag[
'value']][0][
'n'];
 
23842                } 
elseif (preg_match(
'/[h][0-9]/', $tag[
'value']) > 0) {
 
23847                if ((!isset($this->tagvspaces[$tag[
'value']])) AND (in_array($tag[
'value'], array(
'div', 
'dt', 
'dd', 
'li', 
'br')))) {
 
23850                     $hb = ($n * $cur_h);
 
23852                if (($this->htmlvspace <= 0) AND ($n > 0)) {
 
23853                     if (isset($parent[
'fontsize'])) {
 
23854                          $hbz = (($parent[
'fontsize'] / $this->k) * $this->cell_height_ratio);
 
23856                          $hbz = $this->FontSize * $this->cell_height_ratio;
 
23859                if (isset($dom[($key - 1)]) AND ($dom[($key - 1)][
'value'] == 
'table')) {
 
23865           switch($tag[
'value']) {
 
23869                     $dom[$key][
'rowspans'] = array();
 
23870                     if (!isset($dom[$key][
'attribute'][
'nested']) OR ($dom[$key][
'attribute'][
'nested'] != 
'true')) {
 
23871                          $this->htmlvspace = 0;
 
23873                          if (!$this->empty_string($dom[$key][
'thead'])) {
 
23875                               $this->thead = $dom[$key][
'thead'];
 
23876                               if (!isset($this->theadMargins) OR (empty($this->theadMargins))) {
 
23877                                    $this->theadMargins = array();
 
23878                                    $this->theadMargins[
'cell_padding'] = $this->cell_padding;
 
23879                                    $this->theadMargins[
'lmargin'] = $this->lMargin;
 
23880                                    $this->theadMargins[
'rmargin'] = $this->rMargin;
 
23881                                    $this->theadMargins[
'page'] = $this->page;
 
23882                                    $this->theadMargins[
'cell'] = $cell;
 
23887                     $dom[$key][
'old_cell_padding'] = $this->cell_padding;
 
23888                     if (isset($tag[
'attribute'][
'cellpadding'])) {
 
23889                          $pad = $this->getHTMLUnitToUnits($tag[
'attribute'][
'cellpadding'], 1, 
'px');
 
23890                          $this->SetCellPadding($pad);
 
23891                     } 
elseif (isset($tag[
'padding'])) {
 
23892                          $this->cell_padding = $tag[
'padding'];
 
23894                     if (isset($tag[
'attribute'][
'cellspacing'])) {
 
23895                          $cs = $this->getHTMLUnitToUnits($tag[
'attribute'][
'cellspacing'], 1, 
'px');
 
23896                     } 
elseif (isset($tag[
'border-spacing'])) {
 
23897                          $cs = $tag[
'border-spacing'][
'V'];
 
23899                     $prev_y = $this->y;
 
23900                     if ($this->checkPageBreak(((2 * $cp) + (2 * $cs) + $this->lasth), 
'', 
false) OR ($this->y < $prev_y)) {
 
23901                          $this->inthead = 
true;
 
23903                          $this->checkPageBreak($this->PageBreakTrigger + 1);
 
23909                     $dom[$key][
'cellpos'] = array();
 
23913                     if ((isset($tag[
'height'])) AND ($tag[
'height'] != 
'')) {
 
23914                          $hrHeight = $this->getHTMLUnitToUnits($tag[
'height'], 1, 
'px');
 
23916                          $hrHeight = $this->GetLineWidth();
 
23918                     $this->addHTMLVertSpace($hbz, ($hrHeight / 2), $cell, $firsttag);
 
23919                     $x = $this->GetX();
 
23920                     $y = $this->GetY();
 
23921                     $wtmp = $this->w - $this->lMargin - $this->rMargin;
 
23923                          $wtmp -= ($this->cell_padding[
'L'] + $this->cell_padding[
'R']);
 
23925                     if ((isset($tag[
'width'])) AND ($tag[
'width'] != 
'')) {
 
23926                          $hrWidth = $this->getHTMLUnitToUnits($tag[
'width'], $wtmp, 
'px');
 
23930                     $prevlinewidth = $this->GetLineWidth();
 
23931                     $this->SetLineWidth($hrHeight);
 
23932                     $this->Line($x, $y, $x + $hrWidth, $y);
 
23933                     $this->SetLineWidth($prevlinewidth);
 
23934                     $this->addHTMLVertSpace(($hrHeight / 2), 0, $cell, !isset($dom[($key + 1)]));
 
23938                     if (array_key_exists(
'href', $tag[
'attribute'])) {
 
23939                          $this->HREF[
'url'] = $tag[
'attribute'][
'href'];
 
23944                     if (isset($tag[
'attribute'][
'src'])) {
 
23945                          if ($tag[
'attribute'][
'src']{0} === 
'@') {
 
23947                               $tag[
'attribute'][
'src'] = 
'@'.base64_decode(substr($tag[
'attribute'][
'src'], 1));
 
23951                               if (preg_match(
'%^/{2}%', $tag[
'attribute'][
'src'])) {
 
23952                                    $tag[
'attribute'][
'src'] = 
'http:'.$tag[
'attribute'][
'src'];
 
23955                               if (($tag[
'attribute'][
'src'][0] == 
'/') AND !empty($_SERVER[
'DOCUMENT_ROOT']) AND ($_SERVER[
'DOCUMENT_ROOT'] != 
'/')) {
 
23956                                    $findroot = strpos($tag[
'attribute'][
'src'], $_SERVER[
'DOCUMENT_ROOT']);
 
23957                                    if (($findroot === 
false) OR ($findroot > 1)) {
 
23958                                         if (substr($_SERVER[
'DOCUMENT_ROOT'], -1) == 
'/') {
 
23959                                              $tag[
'attribute'][
'src'] = substr($_SERVER[
'DOCUMENT_ROOT'], 0, -1).$tag[
'attribute'][
'src'];
 
23961                                              $tag[
'attribute'][
'src'] = $_SERVER[
'DOCUMENT_ROOT'].$tag[
'attribute'][
'src'];
 
23965                               $tag[
'attribute'][
'src'] = htmlspecialchars_decode(urldecode($tag[
'attribute'][
'src']));
 
23966                               $type = $this->getImageFileType($tag[
'attribute'][
'src']);
 
23967                               $testscrtype = @parse_url($tag[
'attribute'][
'src']);
 
23968                               if (!isset($testscrtype[
'query']) OR empty($testscrtype[
'query'])) {
 
23973                          if (!isset($tag[
'width'])) {
 
23976                          if (!isset($tag[
'height'])) {
 
23977                               $tag[
'height'] = 0;
 
23982                               $tag[
'attribute'][
'align'] = 
'bottom';
 
23984                          switch($tag[
'attribute'][
'align']) {
 
24005                          if (isset($this->HREF[
'url']) AND !$this->empty_string($this->HREF[
'url'])) {
 
24006                               $imglink = $this->HREF[
'url'];
 
24007                               if ($imglink{0} == 
'#') {
 
24009                                    $lnkdata = explode(
',', $imglink);
 
24010                                    if (isset($lnkdata[0])) {
 
24011                                         $page = intval(substr($lnkdata[0], 1));
 
24012                                         if (empty($page) OR ($page <= 0)) {
 
24013                                              $page = $this->page;
 
24015                                         if (isset($lnkdata[1]) AND (strlen($lnkdata[1]) > 0)) {
 
24016                                              $lnky = floatval($lnkdata[1]);
 
24020                                         $imglink = $this->AddLink();
 
24021                                         $this->SetLink($imglink, $lnky, $page);
 
24026                          if (isset($tag[
'border']) AND !empty($tag[
'border'])) {
 
24028                               $border = $tag[
'border'];
 
24031                          if (isset($tag[
'width'])) {
 
24032                               $iw = $this->getHTMLUnitToUnits($tag[
'width'], 1, 
'px', 
false);
 
24035                          if (isset($tag[
'height'])) {
 
24036                               $ih = $this->getHTMLUnitToUnits($tag[
'height'], 1, 
'px', 
false);
 
24038                          if (($type == 
'eps') OR ($type == 
'ai')) {
 
24039                               $this->ImageEps($tag[
'attribute'][
'src'], $xpos, $this->y, $iw, $ih, $imglink, 
true, $align, 
'', $border, 
true);
 
24040                          } 
elseif ($type == 
'svg') {
 
24041                               $this->ImageSVG($tag[
'attribute'][
'src'], $xpos, $this->y, $iw, $ih, $imglink, $align, 
'', $border, 
true);
 
24043                               $this->Image($tag[
'attribute'][
'src'], $xpos, $this->y, $iw, $ih, 
'', $imglink, $align, 
false, 300, 
'', 
false, 
false, $border, 
false, 
false, 
true);
 
24051                                    $this->y = (($this->img_rb_y + $prevy - ($tag[
'fontsize'] / $this->k)) / 2) ;
 
24055                                    $this->y = $this->img_rb_y - ($tag[
'fontsize'] / $this->k);
 
24064                     if ($this->listnum == 1) {
 
24065                          $this->addHTMLVertSpace($hbz, $hb, $cell, $firsttag);
 
24067                          $this->addHTMLVertSpace(0, 0, $cell, $firsttag);
 
24072                     $this->addHTMLVertSpace($hbz, $hb, $cell, $firsttag);
 
24077                          $this->rMargin += $this->listindent;
 
24079                          $this->lMargin += $this->listindent;
 
24081                     ++$this->listindentlevel;
 
24082                     $this->addHTMLVertSpace($hbz, $hb, $cell, $firsttag);
 
24088                     if ($tag[
'value'] == 
'ol') {
 
24089                          $this->listordered[$this->listnum] = 
true;
 
24091                          $this->listordered[$this->listnum] = 
false;
 
24093                     if (isset($tag[
'attribute'][
'start'])) {
 
24094                          $this->listcount[$this->listnum] = intval($tag[
'attribute'][
'start']) - 1;
 
24096                          $this->listcount[$this->listnum] = 0;
 
24099                          $this->rMargin += $this->listindent;
 
24100                          $this->x -= $this->listindent;
 
24102                          $this->lMargin += $this->listindent;
 
24103                          $this->x += $this->listindent;
 
24105                     ++$this->listindentlevel;
 
24106                     if ($this->listnum == 1) {
 
24108                               $this->addHTMLVertSpace($hbz, $hb, $cell, $firsttag);
 
24111                          $this->addHTMLVertSpace(0, 0, $cell, $firsttag);
 
24117                          $this->addHTMLVertSpace($hbz, $hb, $cell, $firsttag);
 
24119                     if ($this->listordered[$this->listnum]) {
 
24121                          if (isset($parent[
'attribute'][
'type']) AND !$this->empty_string($parent[
'attribute'][
'type'])) {
 
24122                               $this->lispacer = $parent[
'attribute'][
'type'];
 
24123                          } 
elseif (isset($parent[
'listtype']) AND !$this->empty_string($parent[
'listtype'])) {
 
24124                               $this->lispacer = $parent[
'listtype'];
 
24125                          } 
elseif (isset($this->lisymbol) AND !$this->empty_string($this->lisymbol)) {
 
24126                               $this->lispacer = $this->lisymbol;
 
24128                               $this->lispacer = 
'#';
 
24130                          ++$this->listcount[$this->listnum];
 
24131                          if (isset($tag[
'attribute'][
'value'])) {
 
24132                               $this->listcount[$this->listnum] = intval($tag[
'attribute'][
'value']);
 
24136                          if (isset($parent[
'attribute'][
'type']) AND !$this->empty_string($parent[
'attribute'][
'type'])) {
 
24137                               $this->lispacer = $parent[
'attribute'][
'type'];
 
24138                          } 
elseif (isset($parent[
'listtype']) AND !$this->empty_string($parent[
'listtype'])) {
 
24139                               $this->lispacer = $parent[
'listtype'];
 
24140                          } 
elseif (isset($this->lisymbol) AND !$this->empty_string($this->lisymbol)) {
 
24141                               $this->lispacer = $this->lisymbol;
 
24143                               $this->lispacer = 
'!';
 
24148                case 'blockquote': {
 
24150                          $this->rMargin += $this->listindent;
 
24152                          $this->lMargin += $this->listindent;
 
24154                     ++$this->listindentlevel;
 
24155                     $this->addHTMLVertSpace($hbz, $hb, $cell, $firsttag);
 
24159                     $this->addHTMLVertSpace($hbz, $hb, $cell, $firsttag);
 
24163                     $this->addHTMLVertSpace($hbz, $hb, $cell, $firsttag);
 
24167                     $this->addHTMLVertSpace($hbz, $hb, $cell, $firsttag);
 
24171                     $this->addHTMLVertSpace($hbz, $hb, $cell, $firsttag);
 
24172                     $this->premode = 
true;
 
24176                     $this->SetXY($this->GetX(), $this->GetY() - ((0.7 * $this->FontSizePt) / $this->k));
 
24180                     $this->SetXY($this->GetX(), $this->GetY() + ((0.3 * $this->FontSizePt) / $this->k));
 
24189                     $this->addHTMLVertSpace($hbz, $hb, $cell, $firsttag);
 
24194                     if (isset($tag[
'attribute'][
'action'])) {
 
24195                          $this->form_action = $tag[
'attribute'][
'action'];
 
24197                          $this->form_action = 
K_PATH_URL.$_SERVER[
'SCRIPT_NAME'];
 
24199                     if (isset($tag[
'attribute'][
'enctype'])) {
 
24200                          $this->form_enctype = $tag[
'attribute'][
'enctype'];
 
24202                          $this->form_enctype = 
'application/x-www-form-urlencoded';
 
24204                     if (isset($tag[
'attribute'][
'method'])) {
 
24205                          $this->form_mode = $tag[
'attribute'][
'method'];
 
24207                          $this->form_mode = 
'post';
 
24212                     if (isset($tag[
'attribute'][
'name']) AND !$this->empty_string($tag[
'attribute'][
'name'])) {
 
24213                          $name = $tag[
'attribute'][
'name'];
 
24219                     if (isset($tag[
'attribute'][
'readonly']) AND !$this->empty_string($tag[
'attribute'][
'readonly'])) {
 
24220                          $prop[
'readonly'] = 
true;
 
24222                     if (isset($tag[
'attribute'][
'value']) AND !$this->empty_string($tag[
'attribute'][
'value'])) {
 
24223                          $value = $tag[
'attribute'][
'value'];
 
24225                     if (isset($tag[
'attribute'][
'maxlength']) AND !$this->empty_string($tag[
'attribute'][
'maxlength'])) {
 
24226                          $opt[
'maxlen'] = intval($tag[
'attribute'][
'maxlength']);
 
24228                     $h = $this->FontSize * $this->cell_height_ratio;
 
24229                     if (isset($tag[
'attribute'][
'size']) AND !$this->empty_string($tag[
'attribute'][
'size'])) {
 
24230                          $w = intval($tag[
'attribute'][
'size']) * $this->GetStringWidth(chr(32)) * 2;
 
24234                     if (isset($tag[
'attribute'][
'checked']) AND (($tag[
'attribute'][
'checked'] == 
'checked') OR ($tag[
'attribute'][
'checked'] == 
'true'))) {
 
24239                     if (isset($tag[
'align'])) {
 
24240                          switch ($tag[
'align']) {
 
24255                     switch ($tag[
'attribute'][
'type']) {
 
24257                               if (isset($value)) {
 
24258                                    $opt[
'v'] = $value;
 
24260                               $this->TextField($name, $w, $h, $prop, $opt, 
'', 
'', 
false);
 
24264                               if (isset($value)) {
 
24265                                    $opt[
'v'] = $value;
 
24267                               $prop[
'password'] = 
'true';
 
24268                               $this->TextField($name, $w, $h, $prop, $opt, 
'', 
'', 
false);
 
24272                               if (!isset($value)) {
 
24275                               $this->CheckBox($name, $w, $checked, $prop, $opt, $value, 
'', 
'', 
false);
 
24279                               if (!isset($value)) {
 
24282                               $this->RadioButton($name, $w, $prop, $opt, $value, $checked, 
'', 
'', 
false);
 
24286                               if (!isset($value)) {
 
24289                               $w = $this->GetStringWidth($value) * 1.5;
 
24291                               $prop = array(
'lineWidth'=>1, 
'borderStyle'=>
'beveled', 
'fillColor'=>array(196, 196, 196), 
'strokeColor'=>array(255, 255, 255));
 
24294                               $action[
'F'] = $this->form_action;
 
24295                               if ($this->form_enctype != 
'FDF') {
 
24296                                    $action[
'Flags'] = array(
'ExportFormat');
 
24298                               if ($this->form_mode == 
'get') {
 
24299                                    $action[
'Flags'] = array(
'GetMethod');
 
24301                               $this->Button($name, $w, $h, $value, 
$action, $prop, $opt, 
'', 
'', 
false);
 
24305                               if (!isset($value)) {
 
24308                               $w = $this->GetStringWidth($value) * 1.5;
 
24310                               $prop = array(
'lineWidth'=>1, 
'borderStyle'=>
'beveled', 
'fillColor'=>array(196, 196, 196), 
'strokeColor'=>array(255, 255, 255));
 
24311                               $this->Button($name, $w, $h, $value, array(
'S'=>
'ResetForm'), $prop, $opt, 
'', 
'', 
false);
 
24315                               $prop[
'fileSelect'] = 
'true';
 
24316                               $this->TextField($name, $w, $h, $prop, $opt, 
'', 
'', 
false);
 
24317                               if (!isset($value)) {
 
24320                               $w = $this->GetStringWidth($value) * 2;
 
24322                               $prop = array(
'lineWidth'=>1, 
'borderStyle'=>
'beveled', 
'fillColor'=>array(196, 196, 196), 
'strokeColor'=>array(255, 255, 255));
 
24323                               $jsaction = 
'var f=this.getField(\''.$name.
'\'); f.browseForFileToSubmit();
'; 
24324                               $this->Button('FB_
'.$name, $w, $h, $value, $jsaction, $prop, $opt, '', '', false); 
24328                               if (isset($value)) { 
24329                                    $opt['v
'] = $value; 
24331                               $opt['f
'] = array('invisible
', 'hidden
'); 
24332                               $this->TextField($name, 0, 0, $prop, $opt, '', '', false); 
24336                               // THIS TYPE MUST BE FIXED 
24337                               if (isset($tag['attribute
']['src
']) AND !$this->empty_string($tag['attribute
']['src
'])) { 
24338                                    $img = $tag['attribute
']['src
']; 
24343                               //$opt['mk
'] = array('i
'=>$img, 'tp
'=>1, 'if'=>array('sw
'=>'A
', 's
'=>'A
', 'fb
'=>false)); 
24344                               if (isset($tag['attribute
']['onclick
']) AND !empty($tag['attribute
']['onclick
'])) { 
24345                                    $jsaction = $tag['attribute
']['onclick
']; 
24349                               $this->Button($name, $w, $h, $value, $jsaction, $prop, $opt, '', '', false); 
24353                               if (!isset($value)) { 
24356                               $w = $this->GetStringWidth($value) * 1.5; 
24358                               $prop = array('lineWidth
'=>1, 'borderStyle
'=>'beveled
', 'fillColor
'=>array(196, 196, 196), 'strokeColor
'=>array(255, 255, 255)); 
24359                               if (isset($tag['attribute
']['onclick
']) AND !empty($tag['attribute
']['onclick
'])) { 
24360                                    $jsaction = $tag['attribute
']['onclick
']; 
24364                               $this->Button($name, $w, $h, $value, $jsaction, $prop, $opt, '', '', false); 
24373                     if (isset($tag['attribute
']['readonly
']) AND !$this->empty_string($tag['attribute
']['readonly
'])) { 
24374                          $prop['readonly
'] = true; 
24376                     if (isset($tag['attribute
']['name
']) AND !$this->empty_string($tag['attribute
']['name
'])) { 
24377                          $name = $tag['attribute
']['name
']; 
24381                     if (isset($tag['attribute
']['value
']) AND !$this->empty_string($tag['attribute
']['value
'])) { 
24382                          $opt['v
'] = $tag['attribute
']['value
']; 
24384                     if (isset($tag['attribute
']['cols
']) AND !$this->empty_string($tag['attribute
']['cols
'])) { 
24385                          $w = intval($tag['attribute
']['cols
']) * $this->GetStringWidth(chr(32)) * 2; 
24389                     if (isset($tag['attribute
']['rows
']) AND !$this->empty_string($tag['attribute
']['rows
'])) { 
24390                          $h = intval($tag['attribute
']['rows
']) * $this->FontSize * $this->cell_height_ratio; 
24394                     $prop['multiline
'] = 'true'; 
24395                     $this->TextField($name, $w, $h, $prop, $opt, '', '', false); 
24399                     $h = $this->FontSize * $this->cell_height_ratio; 
24400                     if (isset($tag['attribute
']['size
']) AND !$this->empty_string($tag['attribute
']['size
'])) { 
24401                          $h *= ($tag['attribute
']['size
'] + 1); 
24405                     if (isset($tag['attribute
']['name
']) AND !$this->empty_string($tag['attribute
']['name
'])) { 
24406                          $name = $tag['attribute
']['name
']; 
24411                     if (isset($tag['attribute
']['opt
']) AND !$this->empty_string($tag['attribute
']['opt
'])) { 
24412                          $options = explode('#!NwL!#
', $tag['attribute
']['opt
']); 
24414                          foreach ($options as $val) { 
24415                               if (strpos($val, '#!TaB!#
') !== false) { 
24416                                    $opts = explode('#!TaB!#
', $val); 
24418                                    $w = max($w, $this->GetStringWidth($opts[1])); 
24421                                    $w = max($w, $this->GetStringWidth($val)); 
24428                     if (isset($tag['attribute
']['multiple
']) AND ($tag['attribute
']['multiple
']='multiple
')) { 
24429                          $prop['multipleSelection
'] = 'true'; 
24430                          $this->ListBox($name, $w, $h, $values, $prop, $opt, '', '', false); 
24432                          $this->ComboBox($name, $w, $h, $values, $prop, $opt, '', '', false); 
24438                          // Special tag used to call TCPDF methods 
24439                          if (isset($tag['attribute
']['method
'])) { 
24440                               $tcpdf_method = $tag['attribute
']['method
']; 
24441                               if (method_exists($this, $tcpdf_method)) { 
24442                                    if (isset($tag['attribute
']['params
']) AND (!empty($tag['attribute
']['params
']))) { 
24443                                         $params = unserialize(urldecode($tag['attribute
']['params
'])); 
24444                                         call_user_func_array(array($this, $tcpdf_method), $params); 
24446                                         $this->$tcpdf_method(); 
24448                                    $this->newline = true; 
24458           // define tags that support borders and background colors 
24459           $bordertags = array('blockquote
','br
','dd
','dl
','div
','dt
','h1
','h2
','h3
','h4
','h5
','h6
','hr
','li
','ol
','p
','pre
','ul
','tcpdf
','table
'); 
24460           if (in_array($tag['value
'], $bordertags)) { 
24462                $dom[$key]['borderposition
'] = $this->getBorderStartPosition(); 
24464           if ($dom[$key]['self'] AND isset($dom[$key]['attribute
']['pagebreakafter
'])) { 
24465                $pba = $dom[$key]['attribute
']['pagebreakafter
']; 
24466                // check for pagebreak 
24467                if (($pba == 'true') OR ($pba == 'left
') OR ($pba == 'right
')) { 
24468                     // add a page (or trig AcceptPageBreak() for multicolumn mode) 
24469                     $this->checkPageBreak($this->PageBreakTrigger + 1); 
24471                if ((($pba == 'left
') AND (((!$this->rtl) AND (($this->page % 2) == 0)) OR (($this->rtl) AND (($this->page % 2) != 0)))) 
24472                     OR (($pba == 'right
') AND (((!$this->rtl) AND (($this->page % 2) != 0)) OR (($this->rtl) AND (($this->page % 2) == 0))))) { 
24473                     // add a page (or trig AcceptPageBreak() for multicolumn mode) 
24474                     $this->checkPageBreak($this->PageBreakTrigger + 1); 
24489      protected function closeHTMLTagHandler($dom, $key, $cell, $maxbottomliney=0) { 
24491           $parent = $dom[($dom[$key]['parent
'])]; 
24492           $lasttag = ((!isset($dom[($key + 1)])) OR ((!isset($dom[($key + 2)])) AND ($dom[($key + 1)]['value
'] == 'marker
'))); 
24493           $in_table_head = false; 
24494           // maximum x position (used to draw borders) 
24500           if ($tag['block
']) { 
24501                $hbz = 0; // distance from y to line bottom 
24502                $hb = 0; // vertical space between block tags 
24503                // calculate vertical space for block tags 
24504                if (isset($this->tagvspaces[$tag['value
']][1]['h
']) AND ($this->tagvspaces[$tag['value
']][1]['h
'] >= 0)) { 
24505                     $pre_h = $this->tagvspaces[$tag['value
']][1]['h
']; 
24506                } elseif (isset($parent['fontsize
'])) { 
24507                     $pre_h = (($parent['fontsize
'] / $this->k) * $this->cell_height_ratio); 
24509                     $pre_h = $this->FontSize * $this->cell_height_ratio; 
24511                if (isset($this->tagvspaces[$tag['value
']][1]['n
'])) { 
24512                     $n = $this->tagvspaces[$tag['value
']][1]['n
']; 
24513                } elseif (preg_match('/[h][0-9]/
', $tag['value
']) > 0) { 
24518                if ((!isset($this->tagvspaces[$tag['value
']])) AND ($tag['value
'] == 'div
')) { 
24521                     $hb = ($n * $pre_h); 
24523                if ($maxbottomliney > $this->PageBreakTrigger) { 
24524                     $hbz = ($this->FontSize * $this->cell_height_ratio); 
24525                } elseif ($this->y < $maxbottomliney) { 
24526                     $hbz = ($maxbottomliney - $this->y); 
24530           switch($tag['value
']) { 
24532                     $table_el = $dom[($dom[$key]['parent
'])]['parent
']; 
24533                     if (!isset($parent['endy
'])) { 
24534                          $dom[($dom[$key]['parent
'])]['endy
'] = $this->y; 
24535                          $parent['endy
'] = $this->y; 
24537                     if (!isset($parent['endpage
'])) { 
24538                          $dom[($dom[$key]['parent
'])]['endpage
'] = $this->page; 
24539                          $parent['endpage
'] = $this->page; 
24541                     if (!isset($parent['endcolumn
'])) { 
24542                          $dom[($dom[$key]['parent
'])]['endcolumn
'] = $this->current_column; 
24543                          $parent['endcolumn
'] = $this->current_column; 
24545                     // update row-spanned cells 
24546                     if (isset($dom[$table_el]['rowspans
'])) { 
24547                          foreach ($dom[$table_el]['rowspans
'] as $k => $trwsp) { 
24548                               $dom[$table_el]['rowspans
'][$k]['rowspan
'] -= 1; 
24549                               if ($dom[$table_el]['rowspans
'][$k]['rowspan
'] == 0) { 
24550                                    if (($dom[$table_el]['rowspans
'][$k]['endpage
'] == $parent['endpage
']) AND ($dom[$table_el]['rowspans
'][$k]['endcolumn
'] == $parent['endcolumn
'])) { 
24551                                         $dom[($dom[$key]['parent
'])]['endy
'] = max($dom[$table_el]['rowspans
'][$k]['endy
'], $parent['endy
']); 
24552                                    } elseif (($dom[$table_el]['rowspans
'][$k]['endpage
'] > $parent['endpage
']) OR ($dom[$table_el]['rowspans
'][$k]['endcolumn
'] > $parent['endcolumn
'])) { 
24553                                         $dom[($dom[$key]['parent
'])]['endy
'] = $dom[$table_el]['rowspans
'][$k]['endy
']; 
24554                                         $dom[($dom[$key]['parent
'])]['endpage
'] = $dom[$table_el]['rowspans
'][$k]['endpage
']; 
24555                                         $dom[($dom[$key]['parent
'])]['endcolumn
'] = $dom[$table_el]['rowspans
'][$k]['endcolumn
']; 
24559                          // report new endy and endpage to the rowspanned cells 
24560                          foreach ($dom[$table_el]['rowspans
'] as $k => $trwsp) { 
24561                               if ($dom[$table_el]['rowspans
'][$k]['rowspan
'] == 0) { 
24562                                    $dom[$table_el]['rowspans
'][$k]['endpage
'] = max($dom[$table_el]['rowspans
'][$k]['endpage
'], $dom[($dom[$key]['parent
'])]['endpage
']); 
24563                                    $dom[($dom[$key]['parent
'])]['endpage
'] = $dom[$table_el]['rowspans
'][$k]['endpage
']; 
24564                                    $dom[$table_el]['rowspans
'][$k]['endcolumn
'] = max($dom[$table_el]['rowspans
'][$k]['endcolumn
'], $dom[($dom[$key]['parent
'])]['endcolumn
']); 
24565                                    $dom[($dom[$key]['parent
'])]['endcolumn
'] = $dom[$table_el]['rowspans
'][$k]['endcolumn
']; 
24566                                    $dom[$table_el]['rowspans
'][$k]['endy
'] = max($dom[$table_el]['rowspans
'][$k]['endy
'], $dom[($dom[$key]['parent
'])]['endy
']); 
24567                                    $dom[($dom[$key]['parent
'])]['endy
'] = $dom[$table_el]['rowspans
'][$k]['endy
']; 
24570                          // update remaining rowspanned cells 
24571                          foreach ($dom[$table_el]['rowspans
'] as $k => $trwsp) { 
24572                               if ($dom[$table_el]['rowspans
'][$k]['rowspan
'] == 0) { 
24573                                    $dom[$table_el]['rowspans
'][$k]['endpage
'] = $dom[($dom[$key]['parent
'])]['endpage
']; 
24574                                    $dom[$table_el]['rowspans
'][$k]['endcolumn
'] = $dom[($dom[$key]['parent
'])]['endcolumn
']; 
24575                                    $dom[$table_el]['rowspans
'][$k]['endy
'] = $dom[($dom[$key]['parent
'])]['endy
']; 
24579                     $this->setPage($dom[($dom[$key]['parent
'])]['endpage
']); 
24580                     if ($this->num_columns > 1) { 
24581                          $this->selectColumn($dom[($dom[$key]['parent
'])]['endcolumn
']); 
24583                     $this->y = $dom[($dom[$key]['parent
'])]['endy
']; 
24584                     if (isset($dom[$table_el]['attribute
']['cellspacing
'])) { 
24585                          $this->y += $this->getHTMLUnitToUnits($dom[$table_el]['attribute
']['cellspacing
'], 1, 'px
'); 
24586                     } elseif (isset($dom[$table_el]['border-spacing
'])) { 
24587                          $this->y += $dom[$table_el]['border-spacing
']['V
']; 
24589                     $this->Ln(0, $cell); 
24590                     if ($this->current_column == $parent['startcolumn
']) { 
24591                          $this->x = $parent['startx
']; 
24593                     // account for booklet mode 
24594                     if ($this->page > $parent['startpage
']) { 
24595                          if (($this->rtl) AND ($this->pagedim[$this->page]['orm
'] != $this->pagedim[$parent['startpage
']]['orm
'])) { 
24596                               $this->x -= ($this->pagedim[$this->page]['orm
'] - $this->pagedim[$parent['startpage
']]['orm
']); 
24597                          } elseif ((!$this->rtl) AND ($this->pagedim[$this->page]['olm
'] != $this->pagedim[$parent['startpage
']]['olm
'])) { 
24598                               $this->x += ($this->pagedim[$this->page]['olm
'] - $this->pagedim[$parent['startpage
']]['olm
']); 
24604                     // closing tag used for the thead part 
24605                     $in_table_head = true; 
24606                     $this->inthead = false; 
24608                     $table_el = $parent; 
24609                     // set default border 
24610                     if (isset($table_el['attribute
']['border
']) AND ($table_el['attribute
']['border
'] > 0)) { 
24611                          // set default border 
24612                          $border = array('LTRB
' => array('width
' => $this->getCSSBorderWidth($table_el['attribute
']['border
']), 'cap
'=>'square
', 'join
'=>'miter
', 'dash
'=> 0, 'color
'=>array(0,0,0))); 
24616                     $default_border = $border; 
24617                     // fix bottom line alignment of last line before page break 
24618                     foreach ($dom[($dom[$key]['parent
'])]['trids
'] as $j => $trkey) { 
24619                          // update row-spanned cells 
24620                          if (isset($dom[($dom[$key]['parent
'])]['rowspans
'])) { 
24621                               foreach ($dom[($dom[$key]['parent
'])]['rowspans
'] as $k => $trwsp) { 
24622                                    if (isset($prevtrkey) AND ($trwsp['trid
'] == $prevtrkey) AND ($trwsp['mrowspan
'] > 0)) { 
24623                                         $dom[($dom[$key]['parent
'])]['rowspans
'][$k]['trid
'] = $trkey; 
24625                                    if ($dom[($dom[$key]['parent
'])]['rowspans
'][$k]['trid
'] == $trkey) { 
24626                                         $dom[($dom[$key]['parent
'])]['rowspans
'][$k]['mrowspan
'] -= 1; 
24630                          if (isset($prevtrkey) AND ($dom[$trkey]['startpage
'] > $dom[$prevtrkey]['endpage
'])) { 
24631                               $pgendy = $this->pagedim[$dom[$prevtrkey]['endpage
']]['hk
'] - $this->pagedim[$dom[$prevtrkey]['endpage
']]['bm
']; 
24632                               $dom[$prevtrkey]['endy
'] = $pgendy; 
24633                               // update row-spanned cells 
24634                               if (isset($dom[($dom[$key]['parent
'])]['rowspans
'])) { 
24635                                    foreach ($dom[($dom[$key]['parent
'])]['rowspans
'] as $k => $trwsp) { 
24636                                         if (($trwsp['trid
'] == $trkey) AND ($trwsp['mrowspan
'] > 1) AND ($trwsp['endpage
'] == $dom[$prevtrkey]['endpage
'])) { 
24637                                              $dom[($dom[$key]['parent
'])]['rowspans
'][$k]['endy
'] = $pgendy; 
24638                                              $dom[($dom[$key]['parent
'])]['rowspans
'][$k]['mrowspan
'] = -1; 
24643                          $prevtrkey = $trkey; 
24644                          $table_el = $dom[($dom[$key]['parent
'])]; 
24647                     if (count($table_el['trids
']) > 0) { 
24650                     foreach ($table_el['trids
'] as $j => $trkey) { 
24651                          $parent = $dom[$trkey]; 
24652                          if (!isset($xmax)) { 
24653                               $xmax = $parent['cellpos
'][(count($parent['cellpos
']) - 1)]['endx
']; 
24655                          // for each cell on the row 
24656                          foreach ($parent['cellpos
'] as $k => $cellpos) { 
24657                               if (isset($cellpos['rowspanid
']) AND ($cellpos['rowspanid
'] >= 0)) { 
24658                                    $cellpos['startx
'] = $table_el['rowspans
'][($cellpos['rowspanid
'])]['startx
']; 
24659                                    $cellpos['endx
'] = $table_el['rowspans
'][($cellpos['rowspanid
'])]['endx
']; 
24660                                    $endy = $table_el['rowspans
'][($cellpos['rowspanid
'])]['endy
']; 
24661                                    $startpage = $table_el['rowspans
'][($cellpos['rowspanid
'])]['startpage
']; 
24662                                    $endpage = $table_el['rowspans
'][($cellpos['rowspanid
'])]['endpage
']; 
24663                                    $startcolumn = $table_el['rowspans
'][($cellpos['rowspanid
'])]['startcolumn
']; 
24664                                    $endcolumn = $table_el['rowspans
'][($cellpos['rowspanid
'])]['endcolumn
']; 
24666                                    $endy = $parent['endy
']; 
24667                                    $startpage = $parent['startpage
']; 
24668                                    $endpage = $parent['endpage
']; 
24669                                    $startcolumn = $parent['startcolumn
']; 
24670                                    $endcolumn = $parent['endcolumn
']; 
24672                               if ($this->num_columns == 0) { 
24673                                    $this->num_columns = 1; 
24675                               if (isset($cellpos['border
'])) { 
24676                                    $border = $cellpos['border
']; 
24678                               if (isset($cellpos['bgcolor
']) AND ($cellpos['bgcolor
']) !== false) { 
24679                                    $this->SetFillColorArray($cellpos['bgcolor
']); 
24684                               $x = $cellpos['startx
']; 
24685                               $y = $parent['starty
']; 
24687                               $w = abs($cellpos['endx
'] - $cellpos['startx
']); 
24688                               // get border modes 
24689                               $border_start = $this->getBorderMode($border, $position='start
'); 
24690                               $border_end = $this->getBorderMode($border, $position='end
'); 
24691                               $border_middle = $this->getBorderMode($border, $position='middle
'); 
24692                               // design borders around HTML cells. 
24693                               for ($page = $startpage; $page <= $endpage; ++$page) { // for each page 
24695                                    $this->setPage($page); 
24696                                    if ($this->num_columns < 2) { 
24697                                         // single-column mode 
24699                                         $this->y = $this->tMargin; 
24701                                    // account for margin changes 
24702                                    if ($page > $startpage) { 
24703                                         if (($this->rtl) AND ($this->pagedim[$page]['orm
'] != $this->pagedim[$startpage]['orm
'])) { 
24704                                              $this->x -= ($this->pagedim[$page]['orm
'] - $this->pagedim[$startpage]['orm
']); 
24705                                         } elseif ((!$this->rtl) AND ($this->pagedim[$page]['olm
'] != $this->pagedim[$startpage]['olm
'])) { 
24706                                              $this->x += ($this->pagedim[$page]['olm
'] - $this->pagedim[$startpage]['olm
']); 
24709                                    if ($startpage == $endpage) { // single page 
24712                                         for ($column = $startcolumn; $column <= $endcolumn; ++$column) { // for each column 
24713                                              $this->selectColumn($column); 
24714                                              if ($startcolumn == $endcolumn) { // single column 
24715                                                   $cborder = $border; 
24716                                                   $h = $endy - $parent['starty
']; 
24719                                              } elseif ($column == $startcolumn) { // first column 
24720                                                   $cborder = $border_start; 
24721                                                   $this->y = $starty; 
24723                                                   $h = $this->h - $this->y - $this->bMargin; 
24725                                                        $deltacol = $this->x + $this->rMargin - $this->w; 
24727                                                        $deltacol = $this->x - $this->lMargin; 
24729                                              } elseif ($column == $endcolumn) { // end column 
24730                                                   $cborder = $border_end; 
24731                                                   if (isset($this->columns[$column]['th
']['\
''.$page.
'\''])) {
 
24732                                                        $this->y = $this->columns[$column][
'th'][
'\''.$page.
'\''];
 
24734                                                   $this->x += $deltacol;
 
24735                                                   $h = $endy - $this->y;
 
24737                                                   $cborder = $border_middle;
 
24738                                                   if (isset($this->columns[$column][
'th'][
'\''.$page.
'\''])) {
 
24739                                                        $this->y = $this->columns[$column][
'th'][
'\''.$page.
'\''];
 
24741                                                   $this->x += $deltacol;
 
24742                                                   $h = $this->h - $this->y - $this->bMargin;
 
24744                                              $ccode .= $this->getCellCode($w, $h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
24746                                    } 
elseif ($page == $startpage) { 
 
24749                                         for ($column = $startcolumn; $column < $this->num_columns; ++$column) { 
 
24750                                              $this->selectColumn($column);
 
24751                                              if ($column == $startcolumn) { 
 
24752                                                   $cborder = $border_start;
 
24753                                                   $this->y = $starty;
 
24755                                                   $h = $this->h - $this->y - $this->bMargin;
 
24757                                                        $deltacol = $this->x + $this->rMargin - $this->w;
 
24759                                                        $deltacol = $this->x - $this->lMargin;
 
24762                                                   $cborder = $border_middle;
 
24763                                                   if (isset($this->columns[$column][
'th'][
'\''.$page.
'\''])) {
 
24764                                                        $this->y = $this->columns[$column][
'th'][
'\''.$page.
'\''];
 
24766                                                   $this->x += $deltacol;
 
24767                                                   $h = $this->h - $this->y - $this->bMargin;
 
24769                                              $ccode .= $this->getCellCode($w, $h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
24771                                    } 
elseif ($page == $endpage) { 
 
24774                                         for ($column = 0; $column <= $endcolumn; ++$column) { 
 
24775                                              $this->selectColumn($column);
 
24776                                              if ($column == $endcolumn) { 
 
24777                                                   $cborder = $border_end;
 
24778                                                   if (isset($this->columns[$column][
'th'][
'\''.$page.
'\''])) {
 
24779                                                        $this->y = $this->columns[$column][
'th'][
'\''.$page.
'\''];
 
24781                                                   $this->x += $deltacol;
 
24782                                                   $h = $endy - $this->y;
 
24784                                                   $cborder = $border_middle;
 
24785                                                   if (isset($this->columns[$column][
'th'][
'\''.$page.
'\''])) {
 
24786                                                        $this->y = $this->columns[$column][
'th'][
'\''.$page.
'\''];
 
24788                                                   $this->x += $deltacol;
 
24789                                                   $h = $this->h - $this->y - $this->bMargin;
 
24791                                              $ccode .= $this->getCellCode($w, $h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
24796                                         for ($column = 0; $column < $this->num_columns; ++$column) { 
 
24797                                              $this->selectColumn($column);
 
24798                                              $cborder = $border_middle;
 
24799                                              if (isset($this->columns[$column][
'th'][
'\''.$page.
'\''])) {
 
24800                                                   $this->y = $this->columns[$column][
'th'][
'\''.$page.
'\''];
 
24802                                              $this->x += $deltacol;
 
24803                                              $h = $this->h - $this->y - $this->bMargin;
 
24804                                              $ccode .= $this->getCellCode($w, $h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
24807                                    if ($cborder OR $fill) {
 
24808                                         $offsetlen = strlen($ccode);
 
24810                                         if ($this->inxobj) {
 
24812                                              if (end($this->xobjects[$this->xobjid][
'transfmrk']) !== 
false) {
 
24813                                                   $pagemarkkey = key($this->xobjects[$this->xobjid][
'transfmrk']);
 
24814                                                   $pagemark = $this->xobjects[$this->xobjid][
'transfmrk'][$pagemarkkey];
 
24815                                                   $this->xobjects[$this->xobjid][
'transfmrk'][$pagemarkkey] += $offsetlen;
 
24817                                                   $pagemark = $this->xobjects[$this->xobjid][
'intmrk'];
 
24818                                                   $this->xobjects[$this->xobjid][
'intmrk'] += $offsetlen;
 
24820                                              $pagebuff = $this->xobjects[$this->xobjid][
'outdata'];
 
24821                                              $pstart = substr($pagebuff, 0, $pagemark);
 
24822                                              $pend = substr($pagebuff, $pagemark);
 
24823                                              $this->xobjects[$this->xobjid][
'outdata'] = $pstart.$ccode.$pend;
 
24826                                              if (end($this->transfmrk[$this->page]) !== 
false) {
 
24827                                                   $pagemarkkey = key($this->transfmrk[$this->page]);
 
24828                                                   $pagemark = $this->transfmrk[$this->page][$pagemarkkey];
 
24829                                              } 
elseif ($this->InFooter) {
 
24830                                                   $pagemark = $this->footerpos[$this->page];
 
24832                                                   $pagemark = $this->intmrk[$this->page];
 
24834                                              $pagebuff = $this->getPageBuffer($this->page);
 
24835                                              $pstart = substr($pagebuff, 0, $pagemark);
 
24836                                              $pend = substr($pagebuff, $pagemark);
 
24837                                              $this->setPageBuffer($this->page, $pstart.$ccode.$pend);
 
24842                               $border = $default_border;
 
24844                          if (isset($table_el[
'attribute'][
'cellspacing'])) {
 
24845                               $this->y += $this->getHTMLUnitToUnits($table_el[
'attribute'][
'cellspacing'], 1, 
'px');
 
24846                          } 
elseif (isset($table_el[
'border-spacing'])) {
 
24847                               $this->y += $table_el[
'border-spacing'][
'V'];
 
24849                          $this->Ln(0, $cell);
 
24850                          $this->x = $parent[
'startx'];
 
24851                          if ($endpage > $startpage) {
 
24852                               if (($this->rtl) AND ($this->pagedim[$endpage][
'orm'] != $this->pagedim[$startpage][
'orm'])) {
 
24853                                    $this->x += ($this->pagedim[$endpage][
'orm'] - $this->pagedim[$startpage][
'orm']);
 
24854                               } 
elseif ((!$this->rtl) AND ($this->pagedim[$endpage][
'olm'] != $this->pagedim[$startpage][
'olm'])) {
 
24855                                    $this->x += ($this->pagedim[$endpage][
'olm'] - $this->pagedim[$startpage][
'olm']);
 
24859                     if (!$in_table_head) { 
 
24860                          $this->cell_padding = $table_el[
'old_cell_padding'];
 
24862                          $this->resetLastH();
 
24863                          if (($this->page == ($this->numpages - 1)) AND ($this->pageopen[$this->numpages])) {
 
24864                               $plendiff = ($this->pagelen[$this->numpages] - $this->emptypagemrk[$this->numpages]);
 
24865                               if (($plendiff > 0) AND ($plendiff < 60)) {
 
24866                                    $pagediff = substr($this->getPageBuffer($this->numpages), $this->emptypagemrk[$this->numpages], $plendiff);
 
24867                                    if (substr($pagediff, 0, 5) == 
'BT /F') {
 
24872                               if ($plendiff == 0) {
 
24874                                    $this->deletePage($this->numpages);
 
24877                          if (isset($this->theadMargins[
'top'])) {
 
24879                               $this->tMargin = $this->theadMargins[
'top'];
 
24881                          if (!isset($table_el[
'attribute'][
'nested']) OR ($table_el[
'attribute'][
'nested'] != 
'true')) {
 
24884                               $this->theadMargins = array();
 
24885                               $this->pagedim[$this->page][
'tm'] = $this->tMargin;
 
24888                     $parent = $table_el;
 
24896                     $this->SetXY($this->GetX(), $this->GetY() + ((0.7 * $parent[
'fontsize']) / $this->k));
 
24900                     $this->SetXY($this->GetX(), $this->GetY() - ((0.3 * $parent[
'fontsize']) / $this->k));
 
24904                     $this->addHTMLVertSpace($hbz, $hb, $cell, 
false, $lasttag);
 
24907                case 'blockquote': {
 
24909                          $this->rMargin -= $this->listindent;
 
24911                          $this->lMargin -= $this->listindent;
 
24913                     --$this->listindentlevel;
 
24914                     $this->addHTMLVertSpace($hbz, $hb, $cell, 
false, $lasttag);
 
24918                     $this->addHTMLVertSpace($hbz, $hb, $cell, 
false, $lasttag);
 
24922                     $this->addHTMLVertSpace($hbz, $hb, $cell, 
false, $lasttag);
 
24923                     $this->premode = 
false;
 
24928                     if ($this->listnum <= 0) {
 
24929                          $this->listnum = 0;
 
24930                          $this->addHTMLVertSpace($hbz, $hb, $cell, 
false, $lasttag);
 
24932                          $this->addHTMLVertSpace(0, 0, $cell, 
false, $lasttag);
 
24934                     $this->resetLastH();
 
24938                     $this->lispacer = 
'';
 
24939                     $this->addHTMLVertSpace(0, 0, $cell, 
false, $lasttag);
 
24943                     $this->lispacer = 
'';
 
24945                          $this->rMargin -= $this->listindent;
 
24947                          $this->lMargin -= $this->listindent;
 
24949                     --$this->listindentlevel;
 
24950                     $this->addHTMLVertSpace(0, 0, $cell, 
false, $lasttag);
 
24956                     $this->lispacer = 
'';
 
24958                          $this->rMargin -= $this->listindent;
 
24960                          $this->lMargin -= $this->listindent;
 
24962                     --$this->listindentlevel;
 
24963                     if ($this->listnum <= 0) {
 
24964                          $this->listnum = 0;
 
24965                          $this->addHTMLVertSpace($hbz, $hb, $cell, 
false, $lasttag);
 
24967                          $this->addHTMLVertSpace(0, 0, $cell, 
false, $lasttag);
 
24969                     $this->resetLastH();
 
24973                     $this->lispacer = 
'';
 
24974                     $this->addHTMLVertSpace(0, 0, $cell, 
false, $lasttag);
 
24983                     $this->addHTMLVertSpace($hbz, $hb, $cell, 
false, $lasttag);
 
24988                     $this->form_action = 
'';
 
24989                     $this->form_enctype = 
'application/x-www-form-urlencoded';
 
24997           $this->drawHTMLTagBorder($parent, $xmax);
 
24998           if (isset($dom[($dom[$key][
'parent'])][
'attribute'][
'pagebreakafter'])) {
 
24999                $pba = $dom[($dom[$key][
'parent'])][
'attribute'][
'pagebreakafter'];
 
25001                if (($pba == 
'true') OR ($pba == 
'left') OR ($pba == 'right')) {
 
25003                     $this->checkPageBreak($this->PageBreakTrigger + 1);
 
25005                if ((($pba == 
'left') AND (((!$this->rtl) AND (($this->page % 2) == 0)) OR (($this->rtl) AND (($this->page % 2) != 0))))
 
25006                     OR (($pba == 
'right') AND (((!$this->rtl) AND (($this->page % 2) != 0)) OR (($this->rtl) AND (($this->page % 2) == 0))))) {
 
25008                     $this->checkPageBreak($this->PageBreakTrigger + 1);
 
25011           $this->tmprtl = 
false;
 
25026                $this->Ln(0, $cell);
 
25027                $this->htmlvspace = 0;
 
25031                $this->Ln($hbz, $cell);
 
25032                $this->htmlvspace = 0;
 
25035           if ($hb < $this->htmlvspace) {
 
25038                $hd = $hb - $this->htmlvspace;
 
25039                $this->htmlvspace = $hb;
 
25041           $this->Ln(($hbz + $hd), $cell);
 
25052                $xmax = $this->lMargin;
 
25054                $xmax = $this->w - $this->rMargin;
 
25056           return array(
'page' => $this->page, 
'column' => $this->current_column, 
'x' => $this->x, 
'y' => $this->y, 
'xmax' => $xmax);
 
25067           if (!isset($tag[
'borderposition'])) {
 
25071           $prev_x = $this->x;
 
25072           $prev_y = $this->y;
 
25073           $prev_lasth = $this->lasth;
 
25077           if (isset($tag[
'border']) AND !empty($tag[
'border'])) {
 
25079                $border = $tag[
'border'];
 
25080                if (!$this->empty_string($this->thead) AND (!$this->inthead)) {
 
25082                     $border = $this->getBorderMode($border, $position=
'middle');
 
25085           if (isset($tag[
'bgcolor']) AND ($tag[
'bgcolor'] !== 
false)) {
 
25087                $old_bgcolor = $this->bgcolor;
 
25088                $this->SetFillColorArray($tag[
'bgcolor']);
 
25091           if (!$border AND !$fill) {
 
25095           if (isset($tag[
'attribute'][
'cellspacing'])) {
 
25096                $clsp = $this->getHTMLUnitToUnits($tag[
'attribute'][
'cellspacing'], 1, 
'px');
 
25097                $cellspacing = array(
'H' => $clsp, 
'V' => $clsp);
 
25098           } 
elseif (isset($tag[
'border-spacing'])) {
 
25099                $cellspacing = $tag[
'border-spacing'];
 
25101                $cellspacing = array(
'H' => 0, 
'V' => 0);
 
25103           if (($tag[
'value'] != 
'table') AND (is_array($border)) AND (!empty($border))) {
 
25105                $border[
'mode'] = 
'ext';
 
25108                if ($xmax >= $tag[
'borderposition'][
'x']) {
 
25109                     $xmax = $tag[
'borderposition'][
'xmax'];
 
25111                $w = ($tag[
'borderposition'][
'x'] - $xmax);
 
25113                if ($xmax <= $tag[
'borderposition'][
'x']) {
 
25114                     $xmax = $tag[
'borderposition'][
'xmax'];
 
25116                $w = ($xmax - $tag[
'borderposition'][
'x']);
 
25121           $w += $cellspacing[
'H'];
 
25122           $startpage = $tag[
'borderposition'][
'page'];
 
25123           $startcolumn = $tag[
'borderposition'][
'column'];
 
25124           $x = $tag[
'borderposition'][
'x'];
 
25125           $y = $tag[
'borderposition'][
'y'];
 
25126           $endpage = $this->page;
 
25127           $starty = $tag[
'borderposition'][
'y'] - $cellspacing[
'V'];
 
25128           $currentY = $this->y;
 
25131           $endcolumn = $this->current_column;
 
25132           if ($this->num_columns == 0) {
 
25133                $this->num_columns = 1;
 
25136           $border_start = $this->getBorderMode($border, $position=
'start');
 
25137           $border_end = $this->getBorderMode($border, $position=
'end');
 
25138           $border_middle = $this->getBorderMode($border, $position=
'middle');
 
25140           $temp_page_regions = $this->page_regions;
 
25141           $this->page_regions = array();
 
25143           for ($page = $startpage; $page <= $endpage; ++$page) { 
 
25145                $this->setPage($page);
 
25146                if ($this->num_columns < 2) {
 
25149                     $this->y = $this->tMargin;
 
25152                if ($page > $startpage) {
 
25153                     if (($this->rtl) AND ($this->pagedim[$page][
'orm'] != $this->pagedim[$startpage][
'orm'])) {
 
25154                          $this->x -= ($this->pagedim[$page][
'orm'] - $this->pagedim[$startpage][
'orm']);
 
25155                     } 
elseif ((!$this->rtl) AND ($this->pagedim[$page][
'olm'] != $this->pagedim[$startpage][
'olm'])) {
 
25156                          $this->x += ($this->pagedim[$page][
'olm'] - $this->pagedim[$startpage][
'olm']);
 
25159                if ($startpage == $endpage) {
 
25161                     for ($column = $startcolumn; $column <= $endcolumn; ++$column) { 
 
25162                          $this->selectColumn($column);
 
25163                          if ($startcolumn == $endcolumn) { 
 
25164                               $cborder = $border;
 
25165                               $h = ($currentY - $y) + $cellspacing[
'V'];
 
25166                               $this->y = $starty;
 
25167                          } 
elseif ($column == $startcolumn) { 
 
25168                               $cborder = $border_start;
 
25169                               $this->y = $starty;
 
25170                               $h = $this->h - $this->y - $this->bMargin;
 
25171                          } 
elseif ($column == $endcolumn) { 
 
25172                               $cborder = $border_end;
 
25173                               $h = $currentY - $this->y;
 
25175                               $cborder = $border_middle;
 
25176                               $h = $this->h - $this->y - $this->bMargin;
 
25178                          $ccode .= $this->getCellCode($w, $h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
25180                } 
elseif ($page == $startpage) { 
 
25181                     for ($column = $startcolumn; $column < $this->num_columns; ++$column) { 
 
25182                          $this->selectColumn($column);
 
25183                          if ($column == $startcolumn) { 
 
25184                               $cborder = $border_start;
 
25185                               $this->y = $starty;
 
25186                               $h = $this->h - $this->y - $this->bMargin;
 
25188                               $cborder = $border_middle;
 
25189                               $h = $this->h - $this->y - $this->bMargin;
 
25191                          $ccode .= $this->getCellCode($w, $h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
25193                } 
elseif ($page == $endpage) { 
 
25194                     for ($column = 0; $column <= $endcolumn; ++$column) { 
 
25195                          $this->selectColumn($column);
 
25196                          if ($column == $endcolumn) {
 
25198                               $cborder = $border_end;
 
25199                               $h = $currentY - $this->y;
 
25202                               $cborder = $border_middle;
 
25203                               $h = $this->h - $this->y - $this->bMargin;
 
25205                          $ccode .= $this->getCellCode($w, $h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
25208                     for ($column = 0; $column < $this->num_columns; ++$column) { 
 
25209                          $this->selectColumn($column);
 
25210                          $cborder = $border_middle;
 
25211                          $h = $this->h - $this->y - $this->bMargin;
 
25212                          $ccode .= $this->getCellCode($w, $h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
25215                if ($cborder OR $fill) {
 
25216                     $offsetlen = strlen($ccode);
 
25218                     if ($this->inxobj) {
 
25220                          if (end($this->xobjects[$this->xobjid][
'transfmrk']) !== 
false) {
 
25221                               $pagemarkkey = key($this->xobjects[$this->xobjid][
'transfmrk']);
 
25222                               $pagemark = $this->xobjects[$this->xobjid][
'transfmrk'][$pagemarkkey];
 
25223                               $this->xobjects[$this->xobjid][
'transfmrk'][$pagemarkkey] += $offsetlen;
 
25225                               $pagemark = $this->xobjects[$this->xobjid][
'intmrk'];
 
25226                               $this->xobjects[$this->xobjid][
'intmrk'] += $offsetlen;
 
25228                          $pagebuff = $this->xobjects[$this->xobjid][
'outdata'];
 
25229                          $pstart = substr($pagebuff, 0, $pagemark);
 
25230                          $pend = substr($pagebuff, $pagemark);
 
25231                          $this->xobjects[$this->xobjid][
'outdata'] = $pstart.$ccode.$pend;
 
25233                          if (end($this->transfmrk[$this->page]) !== 
false) {
 
25234                               $pagemarkkey = key($this->transfmrk[$this->page]);
 
25235                               $pagemark = $this->transfmrk[$this->page][$pagemarkkey];
 
25236                          } 
elseif ($this->InFooter) {
 
25237                               $pagemark = $this->footerpos[$this->page];
 
25239                               $pagemark = $this->intmrk[$this->page];
 
25241                          $pagebuff = $this->getPageBuffer($this->page);
 
25242                          $pstart = substr($pagebuff, 0, $pagemark);
 
25243                          $pend = substr($pagebuff, $pagemark);
 
25244                          $this->setPageBuffer($this->page, $pstart.$ccode.$pend);
 
25245                          $this->bordermrk[$this->page] += $offsetlen;
 
25246                          $this->cntmrk[$this->page] += $offsetlen;
 
25251           $this->page_regions = $temp_page_regions;
 
25252           if (isset($old_bgcolor)) {
 
25254                $this->SetFillColorArray($old_bgcolor);
 
25257           $this->x = $prev_x;
 
25258           $this->y = $prev_y;
 
25259           $this->lasth = $prev_lasth;
 
25270           if (substr($symbol, 0, 4) == 
'img|') {
 
25271                $this->lisymbol = $symbol;
 
25274           $symbol = strtolower($symbol);
 
25283                case 'decimal-leading-zero':
 
25285                case 'lower-roman':
 
25287                case 'upper-roman':
 
25289                case 'lower-alpha':
 
25290                case 'lower-latin':
 
25292                case 'upper-alpha':
 
25293                case 'upper-latin':
 
25294                case 'lower-greek': {
 
25295                     $this->lisymbol = $symbol;
 
25299                     $this->lisymbol = 
'';
 
25313           $this->booklet = $booklet;
 
25315                $this->lMargin = $inner;
 
25318                $this->rMargin = $outer;
 
25331                $mtemp = $this->original_lMargin;
 
25332                $this->original_lMargin = $this->original_rMargin;
 
25333                $this->original_rMargin = $mtemp;
 
25334                $deltam = $this->original_lMargin - $this->original_rMargin;
 
25335                $this->lMargin += $deltam;
 
25336                $this->rMargin -= $deltam;
 
25353           $this->tagvspaces = $tagvs;
 
25363           return $this->customlistindent = floatval($width);
 
25373           $this->opencell = $isopen;
 
25384           $this->htmlLinkColorArray = $color;
 
25385           $this->htmlLinkFontStyle = $fontstyle;
 
25399           $supportedunits = array(
'%', 
'em', 
'ex', 
'px', 
'in', 
'cm', 
'mm', 
'pc', 
'pt');
 
25407           if (in_array($defaultunit, $supportedunits)) {
 
25408                $unit = $defaultunit;
 
25410           if (is_numeric($htmlval)) {
 
25411                $value = floatval($htmlval);
 
25412           } 
elseif (preg_match(
'/([0-9\.\-\+]+)/', $htmlval, $mnum)) {
 
25413                $value = floatval($mnum[1]);
 
25414                if (preg_match(
'/([a-z%]+)/', $htmlval, $munit)) {
 
25415                     if (in_array($munit[1], $supportedunits)) {
 
25423                     $retval = (($value * $refsize) / 100);
 
25428                     $retval = ($value * $refsize);
 
25433                     $retval = $value * ($refsize / 2);
 
25438                     $retval = ($value * $this->dpi) / $k;
 
25443                     $retval = ($value / 2.54 * $this->dpi) / $k;
 
25448                     $retval = ($value / 25.4 * $this->dpi) / $k;
 
25453                     $retval = ($value * 12) / $k;
 
25458                     $retval = $value / $k;
 
25463                     $retval = $this->pixelsToUnits($value);
 
25479           while ($number >= 1000) {
 
25483           while ($number >= 900) {
 
25487           while ($number >= 500) {
 
25491           while ($number >= 400) {
 
25495           while ($number >= 100) {
 
25499           while ($number >= 90) {
 
25503           while ($number >= 50) {
 
25507           while ($number >= 40) {
 
25511           while ($number >= 10) {
 
25515           while ($number >= 9) {
 
25519           while ($number >= 5) {
 
25523           while ($number >= 4) {
 
25527           while ($number >= 1) {
 
25543           if ($this->state != 2) {
 
25548           $bgcolor = $this->bgcolor;
 
25549           $color = $this->fgcolor;
 
25550           $strokecolor = $this->strokecolor;
 
25554           $lspace = $this->GetStringWidth(
'  ');
 
25555           if ($listtype == 
'^') {
 
25557                $this->lispacer = 
'';
 
25559           } 
elseif ($listtype == 
'!') {
 
25561                $deftypes = array(
'disc', 
'circle', 
'square');
 
25562                $listtype = $deftypes[($listdepth - 1) % 3];
 
25563           } 
elseif ($listtype == 
'#') {
 
25565                $listtype = 
'decimal';
 
25566           } 
elseif (substr($listtype, 0, 4) == 
'img|') {
 
25568                $img = explode(
'|', $listtype);
 
25571           switch ($listtype) {
 
25578                     $lspace += (2 * $r);
 
25580                          $this->x += $lspace;
 
25582                          $this->x -= $lspace;
 
25584                     $this->Circle(($this->x + $r), ($this->y + ($this->lasth / 2)), $r, 0, 360, 
'F', array(), $color, 8);
 
25589                     $lspace += (2 * $r);
 
25591                          $this->x += $lspace;
 
25593                          $this->x -= $lspace;
 
25595                     $prev_line_style = $this->linestyleWidth.
' '.$this->linestyleCap.
' '.$this->linestyleJoin.
' '.$this->linestyleDash.
' '.$this->DrawColor;
 
25596                     $new_line_style = array(
'width' => ($r / 3), 
'cap' => 
'butt', 
'join' => 
'miter', 
'dash' => 0, 
'phase' => 0, 
'color'=>$color);
 
25597                     $this->Circle(($this->x + $r), ($this->y + ($this->lasth / 2)), ($r * (1 - (1/6))), 0, 360, 
'D', $new_line_style, array(), 8);
 
25598                     $this->_out($prev_line_style); 
 
25605                          $this->x += $lspace;
 
25607                          $this->x -= $lspace;
 
25609                     $this->Rect($this->x, ($this->y + (($this->lasth - 
$l) / 2)), 
$l, 
$l, 
'F', array(), $color);
 
25614                     $lspace += $img[2];
 
25616                          $this->x += $lspace;
 
25618                          $this->x -= $lspace;
 
25620                     $imgtype = strtolower($img[1]);
 
25621                     $prev_y = $this->y;
 
25622                     switch ($imgtype) {
 
25624                               $this->ImageSVG($img[4], $this->x, ($this->y + (($this->lasth - $img[3]) / 2)), $img[2], $img[3], 
'', 
'T', 
'', 0, 
false);
 
25629                               $this->ImageEps($img[4], $this->x, ($this->y + (($this->lasth - $img[3]) / 2)), $img[2], $img[3], 
'', 
true, 
'T', 
'', 0, 
false);
 
25633                               $this->Image($img[4], $this->x, ($this->y + (($this->lasth - $img[3]) / 2)), $img[2], $img[3], $img[1], 
'', 
'T', 
false, 300, 
'', 
false, 
false, 0, 
false, 
false, 
false);
 
25637                     $this->y = $prev_y;
 
25645                     $textitem = $this->listcount[$this->listnum];
 
25648                case 'decimal-leading-zero': {
 
25649                     $textitem = sprintf(
'%02d', $this->listcount[$this->listnum]);
 
25653                case 'lower-roman': {
 
25654                     $textitem = strtolower($this->intToRoman($this->listcount[$this->listnum]));
 
25658                case 'upper-roman': {
 
25659                     $textitem = $this->intToRoman($this->listcount[$this->listnum]);
 
25663                case 'lower-alpha':
 
25664                case 'lower-latin': {
 
25665                     $textitem = chr(97 + $this->listcount[$this->listnum] - 1);
 
25669                case 'upper-alpha':
 
25670                case 'upper-latin': {
 
25671                     $textitem = chr(65 + $this->listcount[$this->listnum] - 1);
 
25674                case 'lower-greek': {
 
25675                     $textitem = $this->unichr(945 + $this->listcount[$this->listnum] - 1);
 
25706                     $textitem = $this->listcount[$this->listnum];
 
25709           if (!$this->empty_string($textitem)) {
 
25711                $prev_y = $this->y;
 
25712                $h = ($this->FontSize * $this->cell_height_ratio) + $this->cell_padding[
'T'] + $this->cell_padding[
'B'];
 
25713                if ($this->checkPageBreak($h) OR ($this->y < $prev_y)) {
 
25718                     $textitem = 
'.'.$textitem;
 
25720                     $textitem = $textitem.
'.';
 
25722                $lspace += $this->GetStringWidth($textitem);
 
25724                     $this->x += $lspace;
 
25726                     $this->x -= $lspace;
 
25728                $this->Write($this->lasth, $textitem, 
'', 
false, 
'', 
false, 0, 
false);
 
25731           $this->lispacer = 
'^';
 
25733           $this->SetFillColorArray($bgcolor);
 
25734           $this->SetDrawColorArray($strokecolor);
 
25735           $this->SettextColorArray($color);
 
25746                'FontFamily' => $this->FontFamily,
 
25747                'FontStyle' => $this->FontStyle,
 
25748                'FontSizePt' => $this->FontSizePt,
 
25749                'rMargin' => $this->rMargin,
 
25750                'lMargin' => $this->lMargin,
 
25751                'cell_padding' => $this->cell_padding,
 
25752                'cell_margin' => $this->cell_margin,
 
25753                'LineWidth' => $this->LineWidth,
 
25754                'linestyleWidth' => $this->linestyleWidth,
 
25755                'linestyleCap' => $this->linestyleCap,
 
25756                'linestyleJoin' => $this->linestyleJoin,
 
25757                'linestyleDash' => $this->linestyleDash,
 
25758                'textrendermode' => $this->textrendermode,
 
25759                'textstrokewidth' => $this->textstrokewidth,
 
25760                'DrawColor' => $this->DrawColor,
 
25761                'FillColor' => $this->FillColor,
 
25762                'TextColor' => $this->TextColor,
 
25763                'ColorFlag' => $this->ColorFlag,
 
25764                'bgcolor' => $this->bgcolor,
 
25765                'fgcolor' => $this->fgcolor,
 
25766                'htmlvspace' => $this->htmlvspace,
 
25767                'listindent' => $this->listindent,
 
25768                'listindentlevel' => $this->listindentlevel,
 
25769                'listnum' => $this->listnum,
 
25770                'listordered' => $this->listordered,
 
25771                'listcount' => $this->listcount,
 
25772                'lispacer' => $this->lispacer,
 
25773                'cell_height_ratio' => $this->cell_height_ratio,
 
25774                'font_stretching' => $this->font_stretching,
 
25775                'font_spacing' => $this->font_spacing,
 
25776                'alpha' => $this->alpha,
 
25778                'lasth' => $this->lasth,
 
25779                'tMargin' => $this->tMargin,
 
25780                'bMargin' => $this->bMargin,
 
25781                'AutoPageBreak' => $this->AutoPageBreak,
 
25782                'PageBreakTrigger' => $this->PageBreakTrigger,
 
25787                'wPt' => $this->wPt,
 
25788                'hPt' => $this->hPt,
 
25789                'fwPt' => $this->fwPt,
 
25790                'fhPt' => $this->fhPt,
 
25791                'page' => $this->page,
 
25792                'current_column' => $this->current_column,
 
25793                'num_columns' => $this->num_columns
 
25806           if ($this->state != 2) {
 
25809           $this->FontFamily = $gvars[
'FontFamily'];
 
25810           $this->FontStyle = $gvars[
'FontStyle'];
 
25811           $this->FontSizePt = $gvars[
'FontSizePt'];
 
25812           $this->rMargin = $gvars[
'rMargin'];
 
25813           $this->lMargin = $gvars[
'lMargin'];
 
25814           $this->cell_padding = $gvars[
'cell_padding'];
 
25815           $this->cell_margin = $gvars[
'cell_margin'];
 
25816           $this->LineWidth = $gvars[
'LineWidth'];
 
25817           $this->linestyleWidth = $gvars[
'linestyleWidth'];
 
25818           $this->linestyleCap = $gvars[
'linestyleCap'];
 
25819           $this->linestyleJoin = $gvars[
'linestyleJoin'];
 
25820           $this->linestyleDash = $gvars[
'linestyleDash'];
 
25821           $this->textrendermode = $gvars[
'textrendermode'];
 
25822           $this->textstrokewidth = $gvars[
'textstrokewidth'];
 
25823           $this->DrawColor = $gvars[
'DrawColor'];
 
25824           $this->FillColor = $gvars[
'FillColor'];
 
25825           $this->TextColor = $gvars[
'TextColor'];
 
25826           $this->ColorFlag = $gvars[
'ColorFlag'];
 
25827           $this->bgcolor = $gvars[
'bgcolor'];
 
25828           $this->fgcolor = $gvars[
'fgcolor'];
 
25829           $this->htmlvspace = $gvars[
'htmlvspace'];
 
25830           $this->listindent = $gvars[
'listindent'];
 
25831           $this->listindentlevel = $gvars[
'listindentlevel'];
 
25832           $this->listnum = $gvars[
'listnum'];
 
25833           $this->listordered = $gvars[
'listordered'];
 
25834           $this->listcount = $gvars[
'listcount'];
 
25835           $this->lispacer = $gvars[
'lispacer'];
 
25836           $this->cell_height_ratio = $gvars[
'cell_height_ratio'];
 
25837           $this->font_stretching = $gvars[
'font_stretching'];
 
25838           $this->font_spacing = $gvars[
'font_spacing'];
 
25839           $this->alpha = $gvars[
'alpha'];
 
25842                $this->lasth = $gvars[
'lasth'];
 
25843                $this->tMargin = $gvars[
'tMargin'];
 
25844                $this->bMargin = $gvars[
'bMargin'];
 
25845                $this->AutoPageBreak = $gvars[
'AutoPageBreak'];
 
25846                $this->PageBreakTrigger = $gvars[
'PageBreakTrigger'];
 
25847                $this->x = $gvars[
'x'];
 
25848                $this->y = $gvars[
'y'];
 
25849                $this->w = $gvars[
'w'];
 
25850                $this->h = $gvars[
'h'];
 
25851                $this->wPt = $gvars[
'wPt'];
 
25852                $this->hPt = $gvars[
'hPt'];
 
25853                $this->fwPt = $gvars[
'fwPt'];
 
25854                $this->fhPt = $gvars[
'fhPt'];
 
25855                $this->page = $gvars[
'page'];
 
25856                $this->current_column = $gvars[
'current_column'];
 
25857                $this->num_columns = $gvars[
'num_columns'];
 
25859           $this->_out(
''.$this->linestyleWidth.
' '.$this->linestyleCap.
' '.$this->linestyleJoin.
' '.$this->linestyleDash.
' '.$this->DrawColor.
' '.$this->FillColor.
'');
 
25860           if (!$this->empty_string($this->FontFamily)) {
 
25861                $this->SetFont($this->FontFamily, $this->FontStyle, $this->FontSizePt);
 
25892                $this->Error(
'Unable to write cache file: '.
$filename);
 
25898           if (!isset($this->cache_file_length[
'_'.
$filename])) {
 
25899                $this->cache_file_length[
'_'.$filename] = strlen(
$data);
 
25901                $this->cache_file_length[
'_'.$filename] += strlen(
$data);
 
25923           $this->bufferlen += strlen(
$data);
 
25924           if ($this->diskcache) {
 
25925                if (!isset($this->buffer) OR $this->empty_string($this->buffer)) {
 
25926                     $this->buffer = $this->getObjFilename(
'buffer');
 
25928                $this->writeDiskCache($this->buffer, 
$data, 
true);
 
25930                $this->buffer .= 
$data;
 
25941           $this->bufferlen = strlen(
$data);
 
25942           if ($this->diskcache) {
 
25943                if (!isset($this->buffer) OR $this->empty_string($this->buffer)) {
 
25944                     $this->buffer = $this->getObjFilename(
'buffer');
 
25946                $this->writeDiskCache($this->buffer, 
$data, 
false);
 
25948                $this->buffer = 
$data;
 
25959           if ($this->diskcache) {
 
25960                return $this->readDiskCache($this->buffer);
 
25962                return $this->buffer;
 
25975           if ($this->diskcache) {
 
25976                if (!isset($this->pages[$page])) {
 
25977                     $this->pages[$page] = $this->getObjFilename(
'page'.$page);
 
25979                $this->writeDiskCache($this->pages[$page], 
$data, $append);
 
25982                     $this->pages[$page] .= 
$data;
 
25984                     $this->pages[$page] = 
$data;
 
25987           if ($append AND isset($this->pagelen[$page])) {
 
25988                $this->pagelen[$page] += strlen(
$data);
 
25990                $this->pagelen[$page] = strlen(
$data);
 
26002           if ($this->diskcache) {
 
26003                return $this->readDiskCache($this->pages[$page]);
 
26004           } 
elseif (isset($this->pages[$page])) {
 
26005                return $this->pages[$page];
 
26019           if ((
$data[
'i'] = array_search($image, $this->imagekeys)) === FALSE) {
 
26020                $this->imagekeys[$this->numimages] = $image;
 
26021                $data[
'i'] = $this->numimages;
 
26022                ++$this->numimages;
 
26024           if ($this->diskcache) {
 
26025                if (!isset($this->images[$image])) {
 
26026                     $this->images[$image] = $this->getObjFilename(
'image'.$image);
 
26028                $this->writeDiskCache($this->images[$image], serialize(
$data));
 
26030                $this->images[$image] = 
$data;
 
26044           if (!isset($this->images[$image])) {
 
26045                $this->setImageBuffer($image, array());
 
26047           if ($this->diskcache) {
 
26048                $tmpimg = $this->getImageBuffer($image);
 
26049                $tmpimg[$key] = 
$data;
 
26050                $this->writeDiskCache($this->images[$image], serialize($tmpimg));
 
26052                $this->images[$image][$key] = 
$data;
 
26064           if ($this->diskcache AND isset($this->images[$image])) {
 
26065                return unserialize($this->readDiskCache($this->images[$image]));
 
26066           } 
elseif (isset($this->images[$image])) {
 
26067                return $this->images[$image];
 
26080           if ($this->diskcache) {
 
26081                if (!isset($this->fonts[$font])) {
 
26082                     $this->fonts[$font] = $this->getObjFilename(
'font');
 
26084                $this->writeDiskCache($this->fonts[$font], serialize(
$data));
 
26086                $this->fonts[$font] = 
$data;
 
26088           if (!in_array($font, $this->fontkeys)) {
 
26089                $this->fontkeys[] = $font;
 
26092                $this->font_obj_ids[$font] = $this->n;
 
26093                $this->setFontSubBuffer($font, 
'n', $this->n);
 
26106           if (!isset($this->fonts[$font])) {
 
26107                $this->setFontBuffer($font, array());
 
26109           if ($this->diskcache) {
 
26110                $tmpfont = $this->getFontBuffer($font);
 
26111                $tmpfont[$key] = 
$data;
 
26112                $this->writeDiskCache($this->fonts[$font], serialize($tmpfont));
 
26114                $this->fonts[$font][$key] = 
$data;
 
26126           if ($this->diskcache AND isset($this->fonts[$font])) {
 
26127                return unserialize($this->readDiskCache($this->fonts[$font]));
 
26128           } 
elseif (isset($this->fonts[$font])) {
 
26129                return $this->fonts[$font];
 
26143           if (($frompage > $this->numpages) OR ($frompage <= $topage)) {
 
26146           if ($frompage == $this->page) {
 
26151           $tmppage = $this->getPageBuffer($frompage);
 
26152           $tmppagedim = $this->pagedim[$frompage];
 
26153           $tmppagelen = $this->pagelen[$frompage];
 
26154           $tmpintmrk = $this->intmrk[$frompage];
 
26155           $tmpbordermrk = $this->bordermrk[$frompage];
 
26156           $tmpcntmrk = $this->cntmrk[$frompage];
 
26157           $tmppageobjects = $this->pageobjects[$frompage];
 
26158           if (isset($this->footerpos[$frompage])) {
 
26159                $tmpfooterpos = $this->footerpos[$frompage];
 
26161           if (isset($this->footerlen[$frompage])) {
 
26162                $tmpfooterlen = $this->footerlen[$frompage];
 
26164           if (isset($this->transfmrk[$frompage])) {
 
26165                $tmptransfmrk = $this->transfmrk[$frompage];
 
26167           if (isset($this->PageAnnots[$frompage])) {
 
26168                $tmpannots = $this->PageAnnots[$frompage];
 
26170           if (isset($this->newpagegroup) AND !empty($this->newpagegroup)) {
 
26171                for (
$i = $frompage; 
$i > $topage; --
$i) {
 
26172                     if (isset($this->newpagegroup[
$i]) AND (($i + $this->pagegroups[$this->newpagegroup[$i]]) > $frompage)) {
 
26173                          --$this->pagegroups[$this->newpagegroup[
$i]];
 
26177                for (
$i = $topage; 
$i > 0; --
$i) {
 
26178                     if (isset($this->newpagegroup[
$i]) AND (($i + $this->pagegroups[$this->newpagegroup[$i]]) > $topage)) {
 
26179                          ++$this->pagegroups[$this->newpagegroup[
$i]];
 
26184           for (
$i = $frompage; 
$i > $topage; --
$i) {
 
26187                $this->setPageBuffer(
$i, $this->getPageBuffer($j));
 
26188                $this->pagedim[
$i] = $this->pagedim[$j];
 
26189                $this->pagelen[
$i] = $this->pagelen[$j];
 
26190                $this->intmrk[
$i] = $this->intmrk[$j];
 
26191                $this->bordermrk[
$i] = $this->bordermrk[$j];
 
26192                $this->cntmrk[
$i] = $this->cntmrk[$j];
 
26193                $this->pageobjects[
$i] = $this->pageobjects[$j];
 
26194                if (isset($this->footerpos[$j])) {
 
26195                     $this->footerpos[
$i] = $this->footerpos[$j];
 
26196                } 
elseif (isset($this->footerpos[
$i])) {
 
26197                     unset($this->footerpos[$i]);
 
26199                if (isset($this->footerlen[$j])) {
 
26200                     $this->footerlen[
$i] = $this->footerlen[$j];
 
26201                } 
elseif (isset($this->footerlen[$i])) {
 
26202                     unset($this->footerlen[$i]);
 
26204                if (isset($this->transfmrk[$j])) {
 
26205                     $this->transfmrk[
$i] = $this->transfmrk[$j];
 
26206                } 
elseif (isset($this->transfmrk[$i])) {
 
26207                     unset($this->transfmrk[$i]);
 
26209                if (isset($this->PageAnnots[$j])) {
 
26210                     $this->PageAnnots[
$i] = $this->PageAnnots[$j];
 
26211                } 
elseif (isset($this->PageAnnots[$i])) {
 
26212                     unset($this->PageAnnots[$i]);
 
26214                if (isset($this->newpagegroup[$j])) {
 
26215                     $this->newpagegroup[
$i] = $this->newpagegroup[$j];
 
26216                     unset($this->newpagegroup[$j]);
 
26218                if ($this->currpagegroup == $j) {
 
26219                     $this->currpagegroup = 
$i;
 
26222           $this->setPageBuffer($topage, $tmppage);
 
26223           $this->pagedim[$topage] = $tmppagedim;
 
26224           $this->pagelen[$topage] = $tmppagelen;
 
26225           $this->intmrk[$topage] = $tmpintmrk;
 
26226           $this->bordermrk[$topage] = $tmpbordermrk;
 
26227           $this->cntmrk[$topage] = $tmpcntmrk;
 
26228           $this->pageobjects[$topage] = $tmppageobjects;
 
26229           if (isset($tmpfooterpos)) {
 
26230                $this->footerpos[$topage] = $tmpfooterpos;
 
26231           } 
elseif (isset($this->footerpos[$topage])) {
 
26232                unset($this->footerpos[$topage]);
 
26234           if (isset($tmpfooterlen)) {
 
26235                $this->footerlen[$topage] = $tmpfooterlen;
 
26236           } 
elseif (isset($this->footerlen[$topage])) {
 
26237                unset($this->footerlen[$topage]);
 
26239           if (isset($tmptransfmrk)) {
 
26240                $this->transfmrk[$topage] = $tmptransfmrk;
 
26241           } 
elseif (isset($this->transfmrk[$topage])) {
 
26242                unset($this->transfmrk[$topage]);
 
26244           if (isset($tmpannots)) {
 
26245                $this->PageAnnots[$topage] = $tmpannots;
 
26246           } 
elseif (isset($this->PageAnnots[$topage])) {
 
26247                unset($this->PageAnnots[$topage]);
 
26250           $tmpoutlines = $this->outlines;
 
26251           foreach ($tmpoutlines as $key => $outline) {
 
26252                if (($outline[
'p'] >= $topage) AND ($outline[
'p'] < $frompage)) {
 
26253                     $this->outlines[$key][
'p'] = ($outline[
'p'] + 1);
 
26254                } 
elseif ($outline[
'p'] == $frompage) {
 
26255                     $this->outlines[$key][
'p'] = $topage;
 
26259           $tmpdests = $this->dests;
 
26260           foreach ($tmpdests as $key => $dest) {
 
26261                if (($dest[
'p'] >= $topage) AND ($dest[
'p'] < $frompage)) {
 
26262                     $this->dests[$key][
'p'] = ($dest[
'p'] + 1);
 
26263                } 
elseif ($dest[
'p'] == $frompage) {
 
26264                     $this->dests[$key][
'p'] = $topage;
 
26268           $tmplinks = $this->links;
 
26269           foreach ($tmplinks as $key => $link) {
 
26270                if (($link[0] >= $topage) AND ($link[0] < $frompage)) {
 
26271                     $this->links[$key][0] = ($link[0] + 1);
 
26272                } 
elseif ($link[0] == $frompage) {
 
26273                     $this->links[$key][0] = $topage;
 
26277           $tmpjavascript = $this->javascript;
 
26278           global $jfrompage, $jtopage;
 
26279           $jfrompage = $frompage;
 
26280           $jtopage = $topage;
 
26281           $this->javascript = preg_replace_callback(
'/this\.addField\(\'([^\']*)\',\'([^\']*)\',([0-9]+)/',
 
26282                create_function(
'$matches', 
'global $jfrompage, $jtopage; 
26283                $pagenum = intval($matches[3]) + 1; 
26284                if (($pagenum >= $jtopage) AND ($pagenum < $jfrompage)) { 
26285                     $newpage = ($pagenum + 1); 
26286                } elseif ($pagenum == $jfrompage) { 
26287                     $newpage = $jtopage; 
26289                     $newpage = $pagenum; 
26292                return "this.addField(\'".$matches[1]."\',\'".$matches[2]."\',".$newpage."";'), $tmpjavascript);
 
26294           $this->lastPage(
true);
 
26306           if (($page < 1) OR ($page > $this->numpages)) {
 
26310           unset($this->pages[$page]);
 
26311           unset($this->pagedim[$page]);
 
26312           unset($this->pagelen[$page]);
 
26313           unset($this->intmrk[$page]);
 
26314           unset($this->bordermrk[$page]);
 
26315           unset($this->cntmrk[$page]);
 
26316           foreach ($this->pageobjects[$page] as $oid) {
 
26317                if (isset($this->offsets[$oid])){
 
26318                     unset($this->offsets[$oid]);
 
26321           unset($this->pageobjects[$page]);
 
26322           if (isset($this->footerpos[$page])) {
 
26323                unset($this->footerpos[$page]);
 
26325           if (isset($this->footerlen[$page])) {
 
26326                unset($this->footerlen[$page]);
 
26328           if (isset($this->transfmrk[$page])) {
 
26329                unset($this->transfmrk[$page]);
 
26331           if (isset($this->PageAnnots[$page])) {
 
26332                unset($this->PageAnnots[$page]);
 
26334           if (isset($this->newpagegroup) AND !empty($this->newpagegroup)) {
 
26335                for (
$i = $page; 
$i > 0; --
$i) {
 
26336                     if (isset($this->newpagegroup[
$i]) AND (($i + $this->pagegroups[$this->newpagegroup[$i]]) > $page)) {
 
26337                          --$this->pagegroups[$this->newpagegroup[
$i]];
 
26342           if (isset($this->pageopen[$page])) {
 
26343                unset($this->pageopen[$page]);
 
26345           if ($page < $this->numpages) {
 
26347                for (
$i = $page; 
$i < $this->numpages; ++
$i) {
 
26350                     $this->setPageBuffer(
$i, $this->getPageBuffer($j));
 
26351                     $this->pagedim[
$i] = $this->pagedim[$j];
 
26352                     $this->pagelen[
$i] = $this->pagelen[$j];
 
26353                     $this->intmrk[
$i] = $this->intmrk[$j];
 
26354                     $this->bordermrk[
$i] = $this->bordermrk[$j];
 
26355                     $this->cntmrk[
$i] = $this->cntmrk[$j];
 
26356                     $this->pageobjects[
$i] = $this->pageobjects[$j];
 
26357                     if (isset($this->footerpos[$j])) {
 
26358                          $this->footerpos[
$i] = $this->footerpos[$j];
 
26359                     } 
elseif (isset($this->footerpos[
$i])) {
 
26360                          unset($this->footerpos[$i]);
 
26362                     if (isset($this->footerlen[$j])) {
 
26363                          $this->footerlen[
$i] = $this->footerlen[$j];
 
26364                     } 
elseif (isset($this->footerlen[$i])) {
 
26365                          unset($this->footerlen[$i]);
 
26367                     if (isset($this->transfmrk[$j])) {
 
26368                          $this->transfmrk[
$i] = $this->transfmrk[$j];
 
26369                     } 
elseif (isset($this->transfmrk[$i])) {
 
26370                          unset($this->transfmrk[$i]);
 
26372                     if (isset($this->PageAnnots[$j])) {
 
26373                          $this->PageAnnots[
$i] = $this->PageAnnots[$j];
 
26374                     } 
elseif (isset($this->PageAnnots[$i])) {
 
26375                          unset($this->PageAnnots[$i]);
 
26377                     if (isset($this->newpagegroup[$j])) {
 
26378                          $this->newpagegroup[
$i] = $this->newpagegroup[$j];
 
26379                          unset($this->newpagegroup[$j]);
 
26381                     if ($this->currpagegroup == $j) {
 
26382                          $this->currpagegroup = 
$i;
 
26384                     if (isset($this->pageopen[$j])) {
 
26385                          $this->pageopen[
$i] = $this->pageopen[$j];
 
26386                     } 
elseif (isset($this->pageopen[$i])) {
 
26387                          unset($this->pageopen[$i]);
 
26391                unset($this->pages[$this->numpages]);
 
26392                unset($this->pagedim[$this->numpages]);
 
26393                unset($this->pagelen[$this->numpages]);
 
26394                unset($this->intmrk[$this->numpages]);
 
26395                unset($this->bordermrk[$this->numpages]);
 
26396                unset($this->cntmrk[$this->numpages]);
 
26397                foreach ($this->pageobjects[$this->numpages] as $oid) {
 
26398                     if (isset($this->offsets[$oid])){
 
26399                          unset($this->offsets[$oid]);
 
26402                unset($this->pageobjects[$this->numpages]);
 
26403                if (isset($this->footerpos[$this->numpages])) {
 
26404                     unset($this->footerpos[$this->numpages]);
 
26406                if (isset($this->footerlen[$this->numpages])) {
 
26407                     unset($this->footerlen[$this->numpages]);
 
26409                if (isset($this->transfmrk[$this->numpages])) {
 
26410                     unset($this->transfmrk[$this->numpages]);
 
26412                if (isset($this->PageAnnots[$this->numpages])) {
 
26413                     unset($this->PageAnnots[$this->numpages]);
 
26415                if (isset($this->newpagegroup[$this->numpages])) {
 
26416                     unset($this->newpagegroup[$this->numpages]);
 
26418                if ($this->currpagegroup == $this->numpages) {
 
26419                     $this->currpagegroup = ($this->numpages - 1);
 
26421                if (isset($this->pagegroups[$this->numpages])) {
 
26422                     unset($this->pagegroups[$this->numpages]);
 
26424                if (isset($this->pageopen[$this->numpages])) {
 
26425                     unset($this->pageopen[$this->numpages]);
 
26429           $this->page = $this->numpages;
 
26431           $tmpoutlines = $this->outlines;
 
26432           foreach ($tmpoutlines as $key => $outline) {
 
26433                if ($outline[
'p'] > $page) {
 
26434                     $this->outlines[$key][
'p'] = $outline[
'p'] - 1;
 
26435                } 
elseif ($outline[
'p'] == $page) {
 
26436                     unset($this->outlines[$key]);
 
26440           $tmpdests = $this->dests;
 
26441           foreach ($tmpdests as $key => $dest) {
 
26442                if ($dest[
'p'] > $page) {
 
26443                     $this->dests[$key][
'p'] = $dest[
'p'] - 1;
 
26444                } 
elseif ($dest[
'p'] == $page) {
 
26445                     unset($this->dests[$key]);
 
26449           $tmplinks = $this->links;
 
26450           foreach ($tmplinks as $key => $link) {
 
26451                if ($link[0] > $page) {
 
26452                     $this->links[$key][0] = $link[0] - 1;
 
26453                } 
elseif ($link[0] == $page) {
 
26454                     unset($this->links[$key]);
 
26458           $tmpjavascript = $this->javascript;
 
26461           $this->javascript = preg_replace_callback(
'/this\.addField\(\'([^\']*)\',\'([^\']*)\',([0-9]+)/',
 
26462                create_function(
'$matches', 
'global $jpage; 
26463                $pagenum = intval($matches[3]) + 1; 
26464                if ($pagenum >= $jpage) { 
26465                     $newpage = ($pagenum - 1); 
26466                } elseif ($pagenum == $jpage) { 
26469                     $newpage = $pagenum; 
26472                return "this.addField(\'".$matches[1]."\',\'".$matches[2]."\',".$newpage."";'), $tmpjavascript);
 
26474           $this->lastPage(
true);
 
26488                $page = $this->page;
 
26490           if (($page < 1) OR ($page > $this->numpages)) {
 
26497           $this->page = $this->numpages;
 
26498           $this->setPageBuffer($this->page, $this->getPageBuffer($page));
 
26499           $this->pagedim[$this->page] = $this->pagedim[$page];
 
26500           $this->pagelen[$this->page] = $this->pagelen[$page];
 
26501           $this->intmrk[$this->page] = $this->intmrk[$page];
 
26502           $this->bordermrk[$this->page] = $this->bordermrk[$page];
 
26503           $this->cntmrk[$this->page] = $this->cntmrk[$page];
 
26504           $this->pageobjects[$this->page] = $this->pageobjects[$page];
 
26505           $this->pageopen[$this->page] = 
false;
 
26506           if (isset($this->footerpos[$page])) {
 
26507                $this->footerpos[$this->page] = $this->footerpos[$page];
 
26509           if (isset($this->footerlen[$page])) {
 
26510                $this->footerlen[$this->page] = $this->footerlen[$page];
 
26512           if (isset($this->transfmrk[$page])) {
 
26513                $this->transfmrk[$this->page] = $this->transfmrk[$page];
 
26515           if (isset($this->PageAnnots[$page])) {
 
26516                $this->PageAnnots[$this->page] = $this->PageAnnots[$page];
 
26518           if (isset($this->newpagegroup[$page])) {
 
26520                $this->newpagegroup[$this->page] = 
sizeof($this->newpagegroup) + 1;
 
26521                $this->currpagegroup = $this->newpagegroup[$this->page];
 
26522                $this->pagegroups[$this->currpagegroup] = 1;
 
26523           } 
elseif (isset($this->currpagegroup) AND ($this->currpagegroup > 0)) {
 
26524                ++$this->pagegroups[$this->currpagegroup];
 
26527           $tmpoutlines = $this->outlines;
 
26528           foreach ($tmpoutlines as $key => $outline) {
 
26529                if ($outline[
'p'] == $page) {
 
26530                     $this->outlines[] = array(
't' => $outline[
't'], 
'l' => $outline[
'l'], 
'x' => $outline[
'x'], 
'y' => $outline[
'y'], 
'p' => $this->page, 
's' => $outline[
's'], 
'c' => $outline[
'c']);
 
26534           $tmplinks = $this->links;
 
26535           foreach ($tmplinks as $key => $link) {
 
26536                if ($link[0] == $page) {
 
26537                     $this->links[] = array($this->page, $link[1]);
 
26541           $this->lastPage(
true);
 
26562      public function addTOC($page=
'', $numbersfont=
'', $filler=
'.', $toc_name=
'TOC', $style=
'', $color=array(0,0,0)) {
 
26563           $fontsize = $this->FontSizePt;
 
26564           $fontfamily = $this->FontFamily;
 
26565           $fontstyle = $this->FontStyle;
 
26566           $w = $this->w - $this->lMargin - $this->rMargin;
 
26567           $spacer = $this->GetStringWidth(chr(32)) * 4;
 
26568           $lmargin = $this->lMargin;
 
26569           $rmargin = $this->rMargin;
 
26570           $x_start = $this->GetX();
 
26571           $page_first = $this->page;
 
26572           $current_page = $this->page;
 
26573           $page_fill_start = 
false;
 
26574           $page_fill_end = 
false;
 
26575           $current_column = $this->current_column;
 
26576           if ($this->empty_string($numbersfont)) {
 
26577                $numbersfont = $this->default_monospaced_font;
 
26579           if ($this->empty_string($filler)) {
 
26582           if ($this->empty_string($page)) {
 
26590           $this->SetFont($numbersfont, $fontstyle, $fontsize);
 
26591           $numwidth = $this->GetStringWidth(
'00000');
 
26593           foreach ($this->outlines as $key => $outline) {
 
26595                if (($this->page > $page_first) AND ($outline[
'p'] >= $this->numpages)) {
 
26596                     $outline[
'p'] += ($this->page - $page_first);
 
26605                if ($outline[
'l'] == 0) {
 
26606                     $this->SetFont($fontfamily, $outline[
's'].
'B', $fontsize);
 
26608                     $this->SetFont($fontfamily, $outline[
's'], $fontsize - $outline[
'l']);
 
26610                $this->SetTextColorArray($outline[
'c']);
 
26612                $this->checkPageBreak((2 * $this->FontSize * $this->cell_height_ratio));
 
26614                if (($this->page == $current_page) AND ($this->current_column == $current_column)) {
 
26615                     $this->lMargin = $lmargin;
 
26616                     $this->rMargin = $rmargin;
 
26618                     if ($this->current_column != $current_column) {
 
26620                               $x_start = $this->w - $this->columns[$this->current_column][
'x'];
 
26622                               $x_start = $this->columns[$this->current_column][
'x'];
 
26625                     $lmargin = $this->lMargin;
 
26626                     $rmargin = $this->rMargin;
 
26627                     $current_page = $this->page;
 
26628                     $current_column = $this->current_column;
 
26630                $this->SetX($x_start);
 
26631                $indent = ($spacer * $outline[
'l']);
 
26633                     $this->x -= $indent;
 
26634                     $this->rMargin = $this->w - $this->x;
 
26636                     $this->x += $indent;
 
26637                     $this->lMargin = $this->x;
 
26639                $link = $this->AddLink();
 
26640                $this->SetLink($link, $outline[
'y'], $outline[
'p']);
 
26643                     $txt = 
' '.$outline[
't'];
 
26645                     $txt = $outline[
't'].
' ';
 
26647                $this->Write(0, $txt, $link, 
false, $aligntext, 
false, 0, 
false, 
false, 0, $numwidth, 
'');
 
26649                     $tw = $this->x - $this->lMargin;
 
26651                     $tw = $this->w - $this->rMargin - $this->x;
 
26653                $this->SetFont($numbersfont, $fontstyle, $fontsize);
 
26654                if ($this->empty_string($page)) {
 
26655                     $pagenum = $outline[
'p'];
 
26658                     $pagenum = 
'{#'.($outline[
'p']).
'}';
 
26659                     if ($this->isUnicodeFont()) {
 
26660                          $pagenum = 
'{'.$pagenum.
'}';
 
26662                     $maxpage = max($maxpage, $outline[
'p']);
 
26664                $fw = ($tw - $this->GetStringWidth($pagenum.$filler));
 
26665                $numfills = floor($fw / $this->GetStringWidth($filler));
 
26666                if ($numfills > 0) {
 
26667                     $rowfill = str_repeat($filler, $numfills);
 
26672                     $pagenum = $pagenum.$gap.$rowfill;
 
26674                     $pagenum = $rowfill.$gap.$pagenum;
 
26677                $this->Cell($tw, 0, $pagenum, 0, 1, $alignnum, 0, $link, 0);
 
26679           $page_last = $this->getPage();
 
26680           $numpages = ($page_last - $page_first + 1);
 
26682           if ($this->booklet) {
 
26684                $page_fill_start = ((($page_first % 2) == 0) XOR (($page % 2) == 0));
 
26685                $page_fill_end = (!((($numpages % 2) == 0) XOR ($page_fill_start)));
 
26686                if ($page_fill_start) {
 
26692                if ($page_fill_end) {
 
26699           $maxpage = max($maxpage, $page_last);
 
26700           if (!$this->empty_string($page)) {
 
26701                for ($p = $page_first; $p <= $page_last; ++$p) {
 
26703                     $temppage = $this->getPageBuffer($p);
 
26704                     for ($n = 1; $n <= $maxpage; ++$n) {
 
26708                          $pnalias = $this->getInternalPageNumberAliases($a);
 
26710                          if (($n >= $page) AND ($n <= $this->numpages)) {
 
26711                               $np = $n + $numpages;
 
26715                          $na = $this->formatTOCPageNumber(($this->starting_page_number + $np - 1));
 
26716                          $nu = $this->UTF8ToUTF16BE($na, 
false);
 
26718                          foreach ($pnalias[
'u'] as $u) {
 
26719                               $sfill = str_repeat($filler, max(0, (strlen($u) - strlen($nu.
' '))));
 
26721                                    $nr = $nu.$this->UTF8ToUTF16BE(
' '.$sfill);
 
26723                                    $nr = $this->UTF8ToUTF16BE($sfill.
' ').$nu;
 
26725                               $temppage = str_replace($u, $nr, $temppage);
 
26727                          foreach ($pnalias[
'a'] as $a) {
 
26728                               $sfill = str_repeat($filler, max(0, (strlen($a) - strlen($na.
' '))));
 
26730                                    $nr = $na.
' '.$sfill;
 
26732                                    $nr = $sfill.
' '.$na;
 
26734                               $temppage = str_replace($a, $nr, $temppage);
 
26738                     $this->setPageBuffer($p, $temppage);
 
26741                $this->Bookmark($toc_name, 0, 0, $page_first, $style, $color);
 
26742                if ($page_fill_start) {
 
26743                     $this->movePage($page_last, $page_first);
 
26745                for (
$i = 0; 
$i < $numpages; ++
$i) {
 
26746                     $this->movePage($page_last, $page);
 
26767      public function addHTMLTOC($page=
'', $toc_name=
'TOC', $templates=array(), $correct_align=
true, $style=
'', $color=array(0,0,0)) {
 
26769           $prev_htmlLinkColorArray = $this->htmlLinkColorArray;
 
26770           $prev_htmlLinkFontStyle = $this->htmlLinkFontStyle;
 
26772           $this->htmlLinkColorArray = array();
 
26773           $this->htmlLinkFontStyle = 
'';
 
26774           $page_first = $this->getPage();
 
26775           $page_fill_start = 
false;
 
26776           $page_fill_end = 
false;
 
26778           $current_font = $this->FontFamily;
 
26779           foreach ($templates as $level => $html) {
 
26780                $dom = $this->getHtmlDomArray($html);
 
26781                foreach ($dom as $key => $value) {
 
26782                     if ($value[
'value'] == 
'#TOC_PAGE_NUMBER#') {
 
26783                          $this->SetFont($dom[($key - 1)][
'fontname']);
 
26784                          $templates[
'F'.$level] = $this->isUnicodeFont();
 
26788           $this->SetFont($current_font);
 
26790           foreach ($this->outlines as $key => $outline) {
 
26792                $row = $templates[$outline[
'l']];
 
26793                if ($this->empty_string($page)) {
 
26794                     $pagenum = $outline[
'p'];
 
26797                     $pagenum = 
'{#'.($outline[
'p']).
'}';
 
26798                     if ($templates[
'F'.$outline[
'l']]) {
 
26799                          $pagenum = 
'{'.$pagenum.
'}';
 
26801                     $maxpage = max($maxpage, $outline[
'p']);
 
26804                $row = str_replace(
'#TOC_DESCRIPTION#', $outline[
't'], $row);
 
26805                $row = str_replace(
'#TOC_PAGE_NUMBER#', $pagenum, $row);
 
26807                $row = 
'<a href="#'.$outline[
'p'].
','.$outline[
'y'].
'">'.$row.
'</a>';
 
26809                $this->writeHTML($row, 
false, 
false, 
true, 
false, 
'');
 
26812           $this->htmlLinkColorArray = $prev_htmlLinkColorArray;
 
26813           $this->htmlLinkFontStyle = $prev_htmlLinkFontStyle;
 
26815           $page_last = $this->getPage();
 
26816           $numpages = ($page_last - $page_first + 1);
 
26818           if ($this->booklet) {
 
26820                $page_fill_start = ((($page_first % 2) == 0) XOR (($page % 2) == 0));
 
26821                $page_fill_end = (!((($numpages % 2) == 0) XOR ($page_fill_start)));
 
26822                if ($page_fill_start) {
 
26828                if ($page_fill_end) {
 
26835           $maxpage = max($maxpage, $page_last);
 
26836           if (!$this->empty_string($page)) {
 
26837                for ($p = $page_first; $p <= $page_last; ++$p) {
 
26839                     $temppage = $this->getPageBuffer($p);
 
26840                     for ($n = 1; $n <= $maxpage; ++$n) {
 
26844                          $pnalias = $this->getInternalPageNumberAliases($a);
 
26847                               $np = $n + $numpages;
 
26851                          $na = $this->formatTOCPageNumber(($this->starting_page_number + $np - 1));
 
26852                          $nu = $this->UTF8ToUTF16BE($na, 
false);
 
26854                          foreach ($pnalias[
'u'] as $u) {
 
26855                               if ($correct_align) {
 
26856                                    $sfill = str_repeat($filler, (strlen($u) - strlen($nu.
' ')));
 
26858                                         $nr = $nu.$this->UTF8ToUTF16BE(
' '.$sfill);
 
26860                                         $nr = $this->UTF8ToUTF16BE($sfill.
' ').$nu;
 
26865                               $temppage = str_replace($u, $nr, $temppage);
 
26867                          foreach ($pnalias[
'a'] as $a) {
 
26868                               if ($correct_align) {
 
26869                                    $sfill = str_repeat($filler, (strlen($a) - strlen($na.
' ')));
 
26871                                         $nr = $na.
' '.$sfill;
 
26873                                         $nr = $sfill.
' '.$na;
 
26878                               $temppage = str_replace($a, $nr, $temppage);
 
26882                     $this->setPageBuffer($p, $temppage);
 
26885                $this->Bookmark($toc_name, 0, 0, $page_first, $style, $color);
 
26886                if ($page_fill_start) {
 
26887                     $this->movePage($page_last, $page_first);
 
26889                for (
$i = 0; 
$i < $numpages; ++
$i) {
 
26890                     $this->movePage($page_last, $page);
 
26901           if (isset($this->objcopy)) {
 
26903                $this->commitTransaction();
 
26906           $this->start_transaction_page = $this->page;
 
26907           $this->start_transaction_y = $this->y;
 
26909           $this->objcopy = $this->objclone($this);
 
26918           if (isset($this->objcopy)) {
 
26919                $this->objcopy->_destroy(
true, 
true);
 
26920                unset($this->objcopy);
 
26932           if (isset($this->objcopy)) {
 
26933                if (isset($this->objcopy->diskcache) AND $this->objcopy->diskcache) {
 
26935                     foreach ($this->objcopy->cache_file_length as $file => $length) {
 
26936                          $file = substr($file, 1);
 
26937                          $handle = fopen($file, 
'r+');
 
26938                          ftruncate($handle, $length);
 
26941                $this->_destroy(
true, 
true);
 
26943                     $objvars = get_object_vars($this->objcopy);
 
26944                     foreach ($objvars as $key => $value) {
 
26945                          $this->$key = $value;
 
26948                return $this->objcopy;
 
26961           return @clone($object);
 
26972           return (is_null($str) OR (is_string($str) AND (strlen($str) == 0)));
 
26985           $length = strlen($haystack);
 
26986           $offset = ($offset > 0)?($length - $offset):abs($offset);
 
26987           $pos = strpos(strrev($haystack), strrev($needle), $offset);
 
26988           return ($pos === 
false)?
false:($length - $pos - strlen($needle));
 
27002           $this->columns = array();
 
27003           if ($numcols < 2) {
 
27005                $this->columns = array();
 
27008                $maxwidth = ($this->w - $this->original_lMargin - $this->original_rMargin) / $numcols;
 
27009                if (($width == 0) OR ($width > $maxwidth)) {
 
27010                     $width = $maxwidth;
 
27012                if ($this->empty_string($y)) {
 
27016                $space = (($this->w - $this->original_lMargin - $this->original_rMargin - ($numcols * $width)) / ($numcols - 1));
 
27018                for (
$i = 0; 
$i < $numcols; ++
$i) {
 
27019                     $this->columns[
$i] = array(
'w' => $width, 
's' => $space, 
'y' => $y);
 
27022           $this->num_columns = $numcols;
 
27023           $this->current_column = 0;
 
27024           $this->column_start_page = $this->page;
 
27025           $this->selectColumn(0);
 
27034           $this->lMargin = $this->original_lMargin;
 
27035           $this->rMargin = $this->original_rMargin;
 
27036           $this->setEqualColumns();
 
27047           $this->columns = $columns;
 
27048           $this->num_columns = count($columns);
 
27049           $this->current_column = 0;
 
27050           $this->column_start_page = $this->page;
 
27051           $this->selectColumn(0);
 
27061           if (is_string($col)) {
 
27062                $col = $this->current_column;
 
27063           } 
elseif ($col >= $this->num_columns) {
 
27066           $xshift = array(
'x' => 0, 
's' => array(
'H' => 0, 
'V' => 0), 
'p' => array(
'L' => 0, 
'T' => 0, 
'R' => 0, 
'B' => 0));
 
27067           $enable_thead = 
false;
 
27068           if ($this->num_columns > 1) {
 
27069                if ($col != $this->current_column) {
 
27071                     if ($this->column_start_page == $this->page) {
 
27072                          $this->y = $this->columns[$col][
'y'];
 
27074                          $this->y = $this->tMargin;
 
27077                     if (($this->page > $this->maxselcol[
'page']) OR (($this->page == $this->maxselcol[
'page']) AND ($col > $this->maxselcol[
'column']))) {
 
27078                          $enable_thead = 
true;
 
27079                          $this->maxselcol[
'page'] = $this->page;
 
27080                          $this->maxselcol[
'column'] = $col;
 
27083                $xshift = $this->colxshift;
 
27085                $listindent = ($this->listindentlevel * $this->listindent);
 
27088                for (
$i = 0; 
$i < $col; ++
$i) {
 
27089                     $colpos += ($this->columns[
$i][
'w'] + $this->columns[
$i][
's']);
 
27092                     $x = $this->w - $this->original_rMargin - $colpos;
 
27093                     $this->rMargin = ($this->w - $x + $listindent);
 
27094                     $this->lMargin = ($x - $this->columns[$col][
'w']);
 
27095                     $this->x = $x - $listindent;
 
27097                     $x = $this->original_lMargin + $colpos;
 
27098                     $this->lMargin = ($x + $listindent);
 
27099                     $this->rMargin = ($this->w - $x - $this->columns[$col][
'w']);
 
27100                     $this->x = $x + $listindent;
 
27102                $this->columns[$col][
'x'] = $x;
 
27104           $this->current_column = $col;
 
27106           $this->newline = 
true;
 
27108           if ((!$this->empty_string($this->thead)) AND (!$this->inthead)) {
 
27109                if ($enable_thead) {
 
27111                     $this->writeHTML($this->thead, 
false, 
false, 
false, 
false, 
'');
 
27112                     $this->y += $xshift[
's'][
'V'];
 
27114                     if (!isset($this->columns[$col][
'th'])) {
 
27115                          $this->columns[$col][
'th'] = array();
 
27117                     $this->columns[$col][
'th'][
'\''.$this->page.
'\''] = $this->y;
 
27119                } 
elseif (isset($this->columns[$col][
'th'][
'\''.$this->page.
'\''])) {
 
27120                     $this->y = $this->columns[$col][
'th'][
'\''.$this->page.
'\''];
 
27125                $this->rMargin += $xshift[
'x'];
 
27126                $this->x -= ($xshift[
'x'] + $xshift[
'p'][
'R']);
 
27128                $this->lMargin += $xshift[
'x'];
 
27129                $this->x += $xshift[
'x'] + $xshift[
'p'][
'L'];
 
27140           return $this->current_column;
 
27150           return $this->num_columns;
 
27161           return urlencode(serialize($pararray));
 
27178           if ($fill === 
true) {
 
27180                     if ($clip === 
true) {
 
27182                          $textrendermode = 6;
 
27185                          $textrendermode = 2;
 
27187                     $textstrokewidth = $stroke;
 
27189                     if ($clip === 
true) {
 
27191                          $textrendermode = 4;
 
27194                          $textrendermode = 0;
 
27199                     if ($clip === 
true) {
 
27201                          $textrendermode = 5;
 
27204                          $textrendermode = 1;
 
27206                     $textstrokewidth = $stroke;
 
27208                     if ($clip === 
true) {
 
27210                          $textrendermode = 7;
 
27213                          $textrendermode = 3;
 
27217           $this->textrendermode = $textrendermode;
 
27218           $this->textstrokewidth = $stroke;
 
27227      public function setTextShadow($params=array(
'enabled'=>
false, 
'depth_w'=>0, 
'depth_h'=>0, 
'color'=>
false, 
'opacity'=>1, 
'blend_mode'=>
'Normal')) {
 
27228           if (isset($params[
'enabled'])) {
 
27229                $this->txtshadow[
'enabled'] = $params[
'enabled']?
true:
false;
 
27231                $this->txtshadow[
'enabled'] = 
false;
 
27233           if (isset($params[
'depth_w'])) {
 
27234                $this->txtshadow[
'depth_w'] = floatval($params[
'depth_w']);
 
27236                $this->txtshadow[
'depth_w'] = 0;
 
27238           if (isset($params[
'depth_h'])) {
 
27239                $this->txtshadow[
'depth_h'] = floatval($params[
'depth_h']);
 
27241                $this->txtshadow[
'depth_h'] = 0;
 
27243           if (isset($params[
'color']) AND ($params[
'color'] !== 
false) AND is_array($params[
'color'])) {
 
27244                $this->txtshadow[
'color'] = $params[
'color'];
 
27246                $this->txtshadow[
'color'] = $this->strokecolor;
 
27248           if (isset($params[
'opacity'])) {
 
27249                $this->txtshadow[
'opacity'] = min(1, max(0, floatval($params[
'opacity'])));
 
27251                $this->txtshadow[
'opacity'] = 1;
 
27253           if (isset($params[
'blend_mode']) AND in_array($params[
'blend_mode'], array(
'Normal', 
'Multiply', 
'Screen', 
'Overlay', 
'Darken', 
'Lighten', 
'ColorDodge', 
'ColorBurn', 
'HardLight', 
'SoftLight', 
'Difference', 
'Exclusion', 
'Hue', 
'Saturation', 
'Color', 
'Luminosity'))) {
 
27254                $this->txtshadow[
'blend_mode'] = $params[
'blend_mode'];
 
27256                $this->txtshadow[
'blend_mode'] = 
'Normal';
 
27258           if ((($this->txtshadow[
'depth_w'] == 0) AND ($this->txtshadow[
'depth_h'] == 0)) OR ($this->txtshadow[
'opacity'] == 0)) {
 
27259                $this->txtshadow[
'enabled'] = 
false;
 
27270           return $this->txtshadow;
 
27287      protected function hyphenateWord($word, $patterns, $dictionary=array(), $leftmin=1, $rightmin=2, $charmin=1, $charmax=8) {
 
27288           $hyphenword = array(); 
 
27289           $numchars = count($word);
 
27290           if ($numchars <= $charmin) {
 
27293           $word_string = $this->UTF8ArrSubString($word);
 
27295           $pattern = 
'/^([a-zA-Z0-9_\.\-]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/';
 
27296           if (preg_match($pattern, $word_string) > 0) {
 
27300           $pattern = 
'/(([a-zA-Z0-9\-]+\.)?)((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/';
 
27301           if (preg_match($pattern, $word_string) > 0) {
 
27305           if (isset($dictionary[$word_string])) {
 
27306                return $this->UTF8StringToArray($dictionary[$word_string]);
 
27309           $tmpword = array_merge(array(95), $word, array(95));
 
27310           $tmpnumchars = $numchars + 2;
 
27311           $maxpos = $tmpnumchars - $charmin;
 
27312           for ($pos = 0; $pos < $maxpos; ++$pos) {
 
27313                $imax = min(($tmpnumchars - $pos), $charmax);
 
27314                for (
$i = $charmin; 
$i <= $imax; ++
$i) {
 
27315                     $subword = strtolower($this->UTF8ArrSubString($tmpword, $pos, $pos + 
$i));
 
27316                     if (isset($patterns[$subword])) {
 
27317                          $pattern = $this->UTF8StringToArray($patterns[$subword]);
 
27318                          $pattern_length = count($pattern);
 
27320                          for ($j = 0; $j < $pattern_length; ++$j) {
 
27322                               if (($pattern[$j] >= 48) AND ($pattern[$j] <= 57)) {
 
27326                                         $zero = $pos + $j - $digits;
 
27328                                    if (!isset($hyphenword[$zero]) OR ($hyphenword[$zero] != $pattern[$j])) {
 
27329                                         $hyphenword[$zero] = $this->unichr($pattern[$j]);
 
27338           $maxpos = $numchars - $rightmin;
 
27339           for (
$i = $leftmin; 
$i <= $maxpos; ++
$i) {
 
27340                if (isset($hyphenword[
$i]) AND (($hyphenword[$i] % 2) != 0)) {
 
27342                     array_splice($word, $i + $inserted, 0, 173);
 
27360           $data = file_get_contents($file);
 
27361           $patterns = array();
 
27363           $data = preg_replace(
'/\%[^\n]*/', 
'', 
$data);
 
27365           preg_match(
'/\\\\patterns\{([^\}]*)\}/i', 
$data, $matches);
 
27366           $data = trim(substr($matches[0], 10, -1));
 
27368           $patterns_array = preg_split(
'/[\s]+/', 
$data);
 
27370           $patterns = array();
 
27371           foreach($patterns_array as $val) {
 
27372                if (!$this->empty_string($val)) {
 
27374                     $val = str_replace(
'\'', 
'\\\'', $val);
 
27375                     $key = preg_replace(
'/[0-9]+/', 
'', $val);
 
27376                     $patterns[$key] = $val;
 
27396      public function hyphenateText($text, $patterns, $dictionary=array(), $leftmin=1, $rightmin=2, $charmin=1, $charmax=8) {
 
27397           $text = $this->unhtmlentities($text);
 
27401           if (!is_array($patterns)) {
 
27402                $patterns = $this->getHyphenPatternsFromTEX($patterns);
 
27405           $unichars = $this->UTF8StringToArray($text);
 
27407           foreach ($unichars as $char) {
 
27408                if ((!$intag) AND $this->unicode->uni_type[$char] == 
'L') {
 
27413                     if (!$this->empty_string($word)) {
 
27415                          $txtarr = array_merge($txtarr, $this->hyphenateWord($word, $patterns, $dictionary, $leftmin, $rightmin, $charmin, $charmax));
 
27419                     if (chr($char) == 
'<') {
 
27422                     } 
elseif ($intag AND (chr($char) == 
'>')) {
 
27428           if (!$this->empty_string($word)) {
 
27430                $txtarr = array_merge($txtarr, $this->hyphenateWord($word, $patterns, $dictionary, $leftmin, $rightmin, $charmin, $charmax));
 
27433           return $this->UTF8ArrSubString($txtarr);
 
27443           $this->rasterize_vector_images = 
$mode;
 
27527                     if (!empty($default)) {
 
27528                          $op = $this->getPathPaintOperator($default, 
'');
 
27545           if ($this->pdfa_mode) {
 
27546                $this->font_subsetting = 
false;
 
27548                $this->font_subsetting = $enable ? 
true : 
false;
 
27560           return $this->font_subsetting;
 
27573           return preg_replace(
'/^'.$this->re_space[
'p'].
'+/'.$this->re_space[
'm'], $replace, $str);
 
27586           return preg_replace(
'/'.$this->re_space[
'p'].
'+$/'.$this->re_space[
'm'], $replace, $str);
 
27599           $str = $this->stringLeftTrim($str, $replace);
 
27600           $str = $this->stringRightTrim($str, $replace);
 
27612           return (($this->CurrentFont[
'type'] == 
'TrueTypeUnicode') OR ($this->CurrentFont[
'type'] == 
'cidfont0'));
 
27625           $fontfamily = preg_replace(
'/[^a-z0-9_\,]/', 
'', strtolower($fontfamily));
 
27627           $fontslist = preg_split(
'/[,]/', $fontfamily);
 
27629           foreach ($fontslist as $font) {
 
27631                $font = preg_replace(
'/italic$/', 
'I', $font);
 
27632                $font = preg_replace(
'/oblique$/', 
'I', $font);
 
27633                $font = preg_replace(
'/bold([I]?)$/', 
'B\\1', $font);
 
27635                $pattern = array();
 
27636                $replacement = array();
 
27637                $pattern[] = 
'/^serif|^cursive|^fantasy|^timesnewroman/';
 
27638                $replacement[] = 
'times';
 
27639                $pattern[] = 
'/^sansserif/';
 
27640                $replacement[] = 
'helvetica';
 
27641                $pattern[] = 
'/^monospace/';
 
27642                $replacement[] = 
'courier';
 
27643                $font = preg_replace($pattern, $replacement, $font);
 
27644                if (in_array(strtolower($font), $this->fontlist) OR in_array($font, $this->fontkeys)) {
 
27649           return $this->CurrentFont[
'fontkey'];
 
27667           if ($this->inxobj) {
 
27671           $this->inxobj = 
true;
 
27674           $this->xobjid = 
'XT'.$this->n;
 
27676           $this->xobjects[$this->xobjid] = array(
'n' => $this->n);
 
27678           $this->xobjects[$this->xobjid][
'gvars'] = $this->getGraphicVars();
 
27680           $this->xobjects[$this->xobjid][
'intmrk'] = 0;
 
27681           $this->xobjects[$this->xobjid][
'transfmrk'] = array();
 
27682           $this->xobjects[$this->xobjid][
'outdata'] = 
'';
 
27683           $this->xobjects[$this->xobjid][
'xobjects'] = array();
 
27684           $this->xobjects[$this->xobjid][
'images'] = array();
 
27685           $this->xobjects[$this->xobjid][
'fonts'] = array();
 
27686           $this->xobjects[$this->xobjid][
'annotations'] = array();
 
27687           $this->xobjects[$this->xobjid][
'extgstates'] = array();
 
27688           $this->xobjects[$this->xobjid][
'gradients'] = array();
 
27689           $this->xobjects[$this->xobjid][
'spot_colors'] = array();
 
27691           $this->num_columns = 1;
 
27692           $this->current_column = 0;
 
27693           $this->SetAutoPageBreak(
false);
 
27694           if (($w === 
'') OR ($w <= 0)) {
 
27695                $w = $this->w - $this->lMargin - $this->rMargin;
 
27697           if (($h === 
'') OR ($h <= 0)) {
 
27698                $h = $this->h - $this->tMargin - $this->bMargin;
 
27700           $this->xobjects[$this->xobjid][
'x'] = 0;
 
27701           $this->xobjects[$this->xobjid][
'y'] = 0;
 
27702           $this->xobjects[$this->xobjid][
'w'] = $w;
 
27703           $this->xobjects[$this->xobjid][
'h'] = $h;
 
27706           $this->wPt = $this->w * $this->k;
 
27707           $this->hPt = $this->h * $this->k;
 
27708           $this->fwPt = $this->wPt;
 
27709           $this->fhPt = $this->hPt;
 
27712           $this->lMargin = 0;
 
27713           $this->rMargin = 0;
 
27714           $this->tMargin = 0;
 
27715           $this->bMargin = 0;
 
27717           $this->xobjects[$this->xobjid][
'group'] = $group;
 
27718           return $this->xobjid;
 
27732           if (!$this->inxobj) {
 
27736           $this->inxobj = 
false;
 
27738           $this->setGraphicVars($this->xobjects[$this->xobjid][
'gvars'], 
true);
 
27739           return $this->xobjid;
 
27760      public function printTemplate(
$id, $x=
'', $y=
'', $w=0, $h=0, $align=
'', $palign=
'', $fitonpage=
false) {
 
27761           if ($this->state != 2) {
 
27764           if (!isset($this->xobjects[
$id])) {
 
27765                $this->Error(
'The XObject Template \''.$id.
'\' doesn\
't exist!');
 
27767           if ($this->inxobj) {
 
27768                if ($id == $this->xobjid) {
 
27770                     $this->endTemplate();
 
27773                     $this->xobjects[$this->xobjid][
'xobjects'][
$id] = $this->xobjects[
$id];
 
27784           list($x, $y) = $this->checkPageRegions($h, $x, $y);
 
27785           $ow = $this->xobjects[
$id][
'w'];
 
27786           $oh = $this->xobjects[
$id][
'h'];
 
27788           if (($w <= 0) AND ($h <= 0)) {
 
27792                $w = $h * $ow / $oh;
 
27794                $h = $w * $oh / $ow;
 
27797           list($w, $h, $x, $y) = $this->fitBlock($w, $h, $x, $y, $fitonpage);
 
27802                if ($palign == 
'L') {
 
27803                     $xt = $this->lMargin;
 
27804                } 
elseif ($palign == 
'C') {
 
27805                     $xt = ($this->w + $this->lMargin - $this->rMargin - $w) / 2;
 
27806                } 
elseif ($palign == 
'R') {
 
27807                     $xt = $this->w - $this->rMargin - $w;
 
27813                if ($palign == 
'L') {
 
27814                     $xt = $this->lMargin;
 
27815                } 
elseif ($palign == 
'C') {
 
27816                     $xt = ($this->w + $this->lMargin - $this->rMargin - $w) / 2;
 
27817                } 
elseif ($palign == 
'R') {
 
27818                     $xt = $this->w - $this->rMargin - $w;
 
27825           $this->StartTransform();
 
27827           $sx = ($w / $this->xobjects[
$id][
'w']);
 
27828           $sy = ($h / $this->xobjects[
$id][
'h']);
 
27834           $tm[4] = $xt * $this->k;
 
27835           $tm[5] = ($this->h - $h - $y) * $this->k;
 
27836           $this->Transform($tm);
 
27838           $this->_out(
'/'.$id.
' Do');
 
27839           $this->StopTransform();
 
27841           if (!empty($this->xobjects[$id][
'annotations'])) {
 
27842                foreach ($this->xobjects[$id][
'annotations'] as $annot) {
 
27844                     $coordlt = $this->getTransformationMatrixProduct($tm, array(1, 0, 0, 1, ($annot[
'x'] * $this->k), (-$annot[
'y'] * $this->k)));
 
27845                     $ax = ($coordlt[4] / $this->k);
 
27846                     $ay = ($this->h - $h - ($coordlt[5] / $this->k));
 
27847                     $coordrb = $this->getTransformationMatrixProduct($tm, array(1, 0, 0, 1, (($annot[
'x'] + $annot[
'w']) * $this->k), ((-$annot[
'y'] - $annot[
'h']) * $this->k)));
 
27848                     $aw = ($coordrb[4] / $this->k) - $ax;
 
27849                     $ah = ($this->h - $h - ($coordrb[5] / $this->k)) - $ay;
 
27850                     $this->Annotation($ax, $ay, $aw, $ah, $annot[
'text'], $annot[
'opt'], $annot[
'spaces']);
 
27861                     $this->y = $y + round($h/2);
 
27871                     $this->SetY($rb_y);
 
27888           $this->font_stretching = $perc;
 
27899           return $this->font_stretching;
 
27910           $this->font_spacing = $spacing;
 
27921           return $this->font_spacing;
 
27933           return $this->page_regions;
 
27949           $this->page_regions = array();
 
27951           foreach ($regions as 
$data) {
 
27952                $this->addPageRegion($data);
 
27968           if (!isset($region[
'page']) OR empty($region[
'page'])) {
 
27969                $region[
'page'] = $this->page;
 
27971           if (isset($region[
'xt']) AND isset($region[
'xb']) AND ($region[
'xt'] > 0) AND ($region[
'xb'] > 0)
 
27972                AND isset($region[
'yt'])  AND isset($region[
'yb']) AND ($region[
'yt'] >= 0) AND ($region[
'yt'] < $region[
'yb'])
 
27973                AND isset($region[
'side']) AND (($region[
'side'] == 
'L') OR ($region[
'side'] == 
'R'))) {
 
27974                $this->page_regions[] = $region;
 
27987           if (isset($this->page_regions[$key])) {
 
27988                unset($this->page_regions[$key]);
 
28012           if (!$this->check_page_regions OR empty($this->page_regions)) {
 
28014                return array($x, $y);
 
28017                $h = ($this->FontSize * $this->cell_height_ratio) + $this->cell_padding[
'T'] + $this->cell_padding[
'B'];
 
28020           if ($this->checkPageBreak($h, $y)) {
 
28025           if ($this->num_columns > 1) {
 
28027                     $this->lMargin = ($this->columns[$this->current_column][
'x'] - $this->columns[$this->current_column][
'w']);
 
28029                     $this->rMargin = ($this->w - $this->columns[$this->current_column][
'x'] - $this->columns[$this->current_column][
'w']);
 
28033                     $this->lMargin = max($this->clMargin, $this->original_lMargin);
 
28035                     $this->rMargin = max($this->crMargin, $this->original_rMargin);
 
28039           foreach ($this->page_regions as $regid => $regdata) {
 
28040                if ($regdata[
'page'] == $this->page) {
 
28042                     if (($y > ($regdata[
'yt'] - $h)) AND ($y <= $regdata[
'yb'])) {
 
28044                          $minv = ($regdata[
'xb'] - $regdata[
'xt']) / ($regdata[
'yb'] - $regdata[
'yt']); 
 
28045                          $yt = max($y, $regdata[
'yt']);
 
28046                          $yb = min(($yt + $h), $regdata[
'yb']);
 
28047                          $xt = (($yt - $regdata[
'yt']) * $minv) + $regdata[
'xt'];
 
28048                          $xb = (($yb - $regdata[
'yt']) * $minv) + $regdata[
'xt'];
 
28049                          if ($regdata[
'side'] == 
'L') { 
 
28050                               $new_margin = max($xt, $xb);
 
28051                               if ($this->lMargin < $new_margin) {
 
28054                                         $this->lMargin = max(0, $new_margin);
 
28056                                    if ($x < $new_margin) {
 
28059                                         if ($new_margin > ($this->w - $this->rMargin)) {
 
28061                                              $y = $regdata[
'yb'] - $h;
 
28065                          } 
elseif ($regdata[
'side'] == 
'R') { 
 
28066                               $new_margin = min($xt, $xb);
 
28067                               if (($this->w - $this->rMargin) > $new_margin) {
 
28070                                         $this->rMargin = max(0, ($this->w - $new_margin));
 
28072                                    if ($x > $new_margin) {
 
28075                                         if ($new_margin > $this->lMargin) {
 
28077                                              $y = $regdata[
'yb'] - $h;
 
28085           return array($x, $y);
 
28107      public function ImageSVG($file, $x=
'', $y=
'', $w=0, $h=0, $link=
'', $align=
'', $palign=
'', $border=0, $fitonpage=
false) {
 
28108           if ($this->state != 2) {
 
28111           if ($this->rasterize_vector_images AND ($w > 0) AND ($h > 0)) {
 
28113                return $this->Image($file, $x, $y, $w, $h, 
'SVG', $link, $align, 
true, 300, $palign, 
false, 
false, $border, 
false, 
false, 
false);
 
28115           if ($file{0} === 
'@') { 
 
28116                $this->svgdir = 
'';
 
28117                $svgdata = substr($file, 1);
 
28119                $this->svgdir = dirname($file);
 
28120                $svgdata = file_get_contents($file);
 
28122           if ($svgdata === 
false) {
 
28123                $this->Error(
'SVG file not found: '.$file);
 
28132           list($x, $y) = $this->checkPageRegions($h, $x, $y);
 
28138           $aspect_ratio_align = 
'xMidYMid';
 
28139           $aspect_ratio_ms = 
'meet';
 
28142           preg_match(
'/<svg([^>]*)>/si', $svgdata, $regs);
 
28143           if (isset($regs[1]) AND !empty($regs[1])) {
 
28145                if (preg_match(
'/[\s]+x[\s]*=[\s]*"([^"]*)"/si', $regs[1], $tmp)) {
 
28146                     $ox = $this->getHTMLUnitToUnits($tmp[1], 0, $this->svgunit, 
false);
 
28149                if (preg_match(
'/[\s]+y[\s]*=[\s]*"([^"]*)"/si', $regs[1], $tmp)) {
 
28150                     $oy = $this->getHTMLUnitToUnits($tmp[1], 0, $this->svgunit, 
false);
 
28153                if (preg_match(
'/[\s]+width[\s]*=[\s]*"([^"]*)"/si', $regs[1], $tmp)) {
 
28154                     $ow = $this->getHTMLUnitToUnits($tmp[1], 1, $this->svgunit, 
false);
 
28157                if (preg_match(
'/[\s]+height[\s]*=[\s]*"([^"]*)"/si', $regs[1], $tmp)) {
 
28158                     $oh = $this->getHTMLUnitToUnits($tmp[1], 1, $this->svgunit, 
false);
 
28161                $view_box = array();
 
28162                if (preg_match(
'/[\s]+viewBox[\s]*=[\s]*"[\s]*([0-9\.\-]+)[\s]+([0-9\.\-]+)[\s]+([0-9\.]+)[\s]+([0-9\.]+)[\s]*"/si', $regs[1], $tmp)) {
 
28163                     if (count($tmp) == 5) {
 
28165                          foreach ($tmp as $key => $val) {
 
28166                               $view_box[$key] = $this->getHTMLUnitToUnits($val, 0, $this->svgunit, 
false);
 
28168                          $ox = $view_box[0];
 
28169                          $oy = $view_box[1];
 
28173                     if (preg_match(
'/[\s]+preserveAspectRatio[\s]*=[\s]*"([^"]*)"/si', $regs[1], $tmp)) {
 
28174                          $aspect_ratio = preg_split(
'/[\s]+/si', $tmp[1]);
 
28175                          switch (count($aspect_ratio)) {
 
28177                                    $aspect_ratio_align = $aspect_ratio[1];
 
28178                                    $aspect_ratio_ms = $aspect_ratio[2];
 
28182                                    $aspect_ratio_align = $aspect_ratio[0];
 
28183                                    $aspect_ratio_ms = $aspect_ratio[1];
 
28187                                    $aspect_ratio_align = $aspect_ratio[0];
 
28188                                    $aspect_ratio_ms = 
'meet';
 
28196           if (($w <= 0) AND ($h <= 0)) {
 
28201                $w = $h * $ow / $oh;
 
28203                $h = $w * $oh / $ow;
 
28206           list($w, $h, $x, $y) = $this->fitBlock($w, $h, $x, $y, $fitonpage);
 
28207           if ($this->rasterize_vector_images) {
 
28209                return $this->Image($file, $x, $y, $w, $h, 
'SVG', $link, $align, 
true, 300, $palign, 
false, 
false, $border, 
false, 
false, 
false);
 
28212           $this->img_rb_y = $y + $h;
 
28215                if ($palign == 
'L') {
 
28216                     $ximg = $this->lMargin;
 
28217                } 
elseif ($palign == 
'C') {
 
28218                     $ximg = ($this->w + $this->lMargin - $this->rMargin - $w) / 2;
 
28219                } 
elseif ($palign == 
'R') {
 
28220                     $ximg = $this->w - $this->rMargin - $w;
 
28224                $this->img_rb_x = $ximg;
 
28226                if ($palign == 
'L') {
 
28227                     $ximg = $this->lMargin;
 
28228                } 
elseif ($palign == 
'C') {
 
28229                     $ximg = ($this->w + $this->lMargin - $this->rMargin - $w) / 2;
 
28230                } 
elseif ($palign == 
'R') {
 
28231                     $ximg = $this->w - $this->rMargin - $w;
 
28235                $this->img_rb_x = $ximg + $w;
 
28238           $gvars = $this->getGraphicVars();
 
28240           $svgoffset_x = ($ximg - $ox) * $this->k;
 
28241           $svgoffset_y = -($y - $oy) * $this->k;
 
28242           if (isset($view_box[2]) AND ($view_box[2] > 0) AND ($view_box[3] > 0)) {
 
28243                $ow = $view_box[2];
 
28244                $oh = $view_box[3];
 
28253           $svgscale_x = $w / $ow;
 
28254           $svgscale_y = $h / $oh;
 
28256           if ($aspect_ratio_align != 
'none') {
 
28258                $svgscale_old_x = $svgscale_x;
 
28259                $svgscale_old_y = $svgscale_y;
 
28261                if ($aspect_ratio_ms == 
'slice') {
 
28263                     if ($svgscale_x > $svgscale_y) {
 
28264                          $svgscale_y = $svgscale_x;
 
28265                     } 
elseif ($svgscale_x < $svgscale_y) {
 
28266                          $svgscale_x = $svgscale_y;
 
28270                     if ($svgscale_x < $svgscale_y) {
 
28271                          $svgscale_y = $svgscale_x;
 
28272                     } 
elseif ($svgscale_x > $svgscale_y) {
 
28273                          $svgscale_x = $svgscale_y;
 
28277                switch (substr($aspect_ratio_align, 1, 3)) {
 
28283                          $svgoffset_x += (($w * $this->k) - ($ow * $this->k * $svgscale_x));
 
28288                          $svgoffset_x += ((($w * $this->k) - ($ow * $this->k * $svgscale_x)) / 2);
 
28293                switch (substr($aspect_ratio_align, 5)) {
 
28299                          $svgoffset_y -= (($h * $this->k) - ($oh * $this->k * $svgscale_y));
 
28304                          $svgoffset_y -= ((($h * $this->k) - ($oh * $this->k * $svgscale_y)) / 2);
 
28310           $page_break_mode = $this->AutoPageBreak;
 
28311           $page_break_margin = $this->getBreakMargin();
 
28312           $cell_padding = $this->cell_padding;
 
28313           $this->SetCellPadding(0);
 
28314           $this->SetAutoPageBreak(
false);
 
28316           $this->_out(
'q'.$this->epsmarker);
 
28318           $this->Rect($x, $y, $w, $h, 
'CNZ', array(), array());
 
28320           $e = $ox * $this->k * (1 - $svgscale_x);
 
28321           $f = ($this->h - $oy) * $this->k * (1 - $svgscale_y);
 
28322           $this->_out(sprintf(
'%F %F %F %F %F %F cm', $svgscale_x, 0, 0, $svgscale_y, ($e + $svgoffset_x), ($f + $svgoffset_y)));
 
28324           $this->parser = xml_parser_create(
'UTF-8');
 
28326           xml_set_object($this->parser, $this);
 
28328           xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
 
28330           xml_set_element_handler($this->parser, 
'startSVGElementHandler', 
'endSVGElementHandler');
 
28332           xml_set_character_data_handler($this->parser, 
'segSVGContentHandler');
 
28334           if (!xml_parse($this->parser, $svgdata)) {
 
28335                $error_message = sprintf(
'SVG Error: %s at line %d', xml_error_string(xml_get_error_code($this->parser)), xml_get_current_line_number($this->parser));
 
28339           xml_parser_free($this->parser);
 
28341           $this->_out($this->epsmarker.
'Q');
 
28343           $this->setGraphicVars($gvars);
 
28344           $this->lasth = $gvars[
'lasth'];
 
28345           if (!empty($border)) {
 
28353                $this->Cell($w, $h, 
'', $border, 0, 
'', 0, 
'', 0, 
true);
 
28358                $this->Link($ximg, $y, $w, $h, $link, 0);
 
28364                     $this->x = $this->img_rb_x;
 
28368                     $this->y = $y + round($h/2);
 
28369                     $this->x = $this->img_rb_x;
 
28373                     $this->y = $this->img_rb_y;
 
28374                     $this->x = $this->img_rb_x;
 
28378                     $this->SetY($this->img_rb_y);
 
28383                     $this->x = $gvars[
'x'];
 
28384                     $this->y = $gvars[
'y'];
 
28385                     $this->page = $gvars[
'page'];
 
28386                     $this->current_column = $gvars[
'current_column'];
 
28387                     $this->tMargin = $gvars[
'tMargin'];
 
28388                     $this->bMargin = $gvars[
'bMargin'];
 
28389                     $this->w = $gvars[
'w'];
 
28390                     $this->h = $gvars[
'h'];
 
28391                     $this->wPt = $gvars[
'wPt'];
 
28392                     $this->hPt = $gvars[
'hPt'];
 
28393                     $this->fwPt = $gvars[
'fwPt'];
 
28394                     $this->fhPt = $gvars[
'fhPt'];
 
28398           $this->endlinex = $this->img_rb_x;
 
28400           $this->SetAutoPageBreak($page_break_mode, $page_break_margin);
 
28401           $this->cell_padding = $cell_padding;
 
28414           $tm = array(1, 0, 0, 1, 0, 0);
 
28415           $transform = array();
 
28416           if (preg_match_all(
'/(matrix|translate|scale|rotate|skewX|skewY)[\s]*\(([^\)]+)\)/si', $attribute, $transform, PREG_SET_ORDER) > 0) {
 
28417                foreach ($transform as $key => 
$data) {
 
28418                     if (!empty(
$data[2])) {
 
28426                          switch (
$data[1]) {
 
28428                                    if (preg_match(
'/([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)/si', 
$data[2], $regs)) {
 
28438                               case 'translate': {
 
28439                                    if (preg_match(
'/([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)/si', 
$data[2], $regs)) {
 
28442                                    } 
elseif (preg_match(
'/([a-z0-9\-\.]+)/si', 
$data[2], $regs)) {
 
28448                                    if (preg_match(
'/([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)/si', 
$data[2], $regs)) {
 
28451                                    } 
elseif (preg_match(
'/([a-z0-9\-\.]+)/si', 
$data[2], $regs)) {
 
28458                                    if (preg_match(
'/([0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)[\,\s]+([a-z0-9\-\.]+)/si', 
$data[2], $regs)) {
 
28459                                         $ang = deg2rad($regs[1]);
 
28466                                         $e = ($x * (1 - $a)) - ($y * $c);
 
28467                                         $f = ($y * (1 - $d)) - ($x * $b);
 
28468                                    } 
elseif (preg_match(
'/([0-9\-\.]+)/si', 
$data[2], $regs)) {
 
28469                                         $ang = deg2rad($regs[1]);
 
28480                                    if (preg_match(
'/([0-9\-\.]+)/si', 
$data[2], $regs)) {
 
28481                                         $c = tan(deg2rad($regs[1]));
 
28486                                    if (preg_match(
'/([0-9\-\.]+)/si', 
$data[2], $regs)) {
 
28487                                         $b = tan(deg2rad($regs[1]));
 
28492                          $tm = $this->getTransformationMatrixProduct($tm, array($a, $b, $c, $d, $e, $f));
 
28510           $tm[0] = ($ta[0] * $tb[0]) + ($ta[2] * $tb[1]);
 
28511           $tm[1] = ($ta[1] * $tb[0]) + ($ta[3] * $tb[1]);
 
28512           $tm[2] = ($ta[0] * $tb[2]) + ($ta[2] * $tb[3]);
 
28513           $tm[3] = ($ta[1] * $tb[2]) + ($ta[3] * $tb[3]);
 
28514           $tm[4] = ($ta[0] * $tb[4]) + ($ta[2] * $tb[5]) + $ta[4];
 
28515           $tm[5] = ($ta[1] * $tb[4]) + ($ta[3] * $tb[5]) + $ta[5];
 
28531           $e = $this->getHTMLUnitToUnits($tm[4], 1, $this->svgunit, 
false) * $this->k;
 
28532           $f = -$this->getHTMLUnitToUnits($tm[5], 1, $this->svgunit, 
false) * $this->k;
 
28534           $y = $this->h * $this->k;
 
28535           $e = ($x * (1 - $a)) - ($y * $c) + $e;
 
28536           $f = ($y * (1 - $d)) - ($x * $b) + $f;
 
28537           return array($a, $b, $c, $d, $e, $f);
 
28547           $this->Transform($this->convertSVGtMatrix($tm));
 
28565      protected function setSVGStyles($svgstyle, $prevsvgstyle, $x=0, $y=0, $w=1, $h=1, $clip_function=
'', $clip_params=array()) {
 
28566           if ($this->state != 2) {
 
28570           $minlen = (0.01 / $this->k); 
 
28571           if (!isset($svgstyle[
'opacity'])) {
 
28576           if (preg_match(
'/url\([\s]*\#([^\)]*)\)/si', $svgstyle[
'clip-path'], $regs)) {
 
28577                $clip_path = $this->svgclippaths[$regs[1]];
 
28578                foreach ($clip_path as $cp) {
 
28579                     $this->startSVGElementHandler(
'clip-path', $cp[
'name'], $cp[
'attribs'], $cp[
'tm']);
 
28583           if ($svgstyle[
'opacity'] != 1) {
 
28584                $this->setAlpha($svgstyle[
'opacity'], 
'Normal', $svgstyle[
'opacity'], 
false);
 
28587           $fill_color = $this->convertHTMLColorToDec($svgstyle[
'color']);
 
28588           $this->SetFillColorArray($fill_color);
 
28590           $text_color = $this->convertHTMLColorToDec($svgstyle[
'text-color']);
 
28591           $this->SetTextColorArray($text_color);
 
28593           if (preg_match(
'/rect\(([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)\)/si', $svgstyle[
'clip'], $regs)) {
 
28594                $top = (isset($regs[1])?$this->getHTMLUnitToUnits($regs[1], 0, $this->svgunit, 
false):0);
 
28595                $right = (isset($regs[2])?$this->getHTMLUnitToUnits($regs[2], 0, $this->svgunit, 
false):0);
 
28596                $bottom = (isset($regs[3])?$this->getHTMLUnitToUnits($regs[3], 0, $this->svgunit, 
false):0);
 
28597                $left = (isset($regs[4])?$this->getHTMLUnitToUnits($regs[4], 0, $this->svgunit, 
false):0);
 
28600                $cw = $w - $left - $right;
 
28601                $ch = $h - $top - $bottom;
 
28602                if ($svgstyle[
'clip-rule'] == 
'evenodd') {
 
28603                     $clip_rule = 
'CNZ';
 
28605                     $clip_rule = 
'CEO';
 
28607                $this->Rect($cx, $cy, $cw, $ch, $clip_rule, array(), array());
 
28611           if (preg_match(
'/url\([\s]*\#([^\)]*)\)/si', $svgstyle[
'fill'], $regs)) {
 
28613                $gradient = $this->svggradients[$regs[1]];
 
28614                if (isset($gradient[
'xref'])) {
 
28616                     $newgradient = $this->svggradients[$gradient[
'xref']];
 
28617                     $newgradient[
'coords'] = $gradient[
'coords'];
 
28618                     $newgradient[
'mode'] = $gradient[
'mode'];
 
28619                     $newgradient[
'gradientUnits'] = $gradient[
'gradientUnits'];
 
28620                     if (isset($gradient[
'gradientTransform'])) {
 
28621                          $newgradient[
'gradientTransform'] = $gradient[
'gradientTransform'];
 
28623                     $gradient = $newgradient;
 
28628                if (!empty($clip_function) AND method_exists($this, $clip_function)) {
 
28629                     $bbox = call_user_func_array(array($this, $clip_function), $clip_params);
 
28630                     if (is_array($bbox) AND (count($bbox) == 4)) {
 
28631                          list($x, $y, $w, $h) = $bbox;
 
28634                if ($gradient[
'mode'] == 
'measure') {
 
28635                     if (isset($gradient[
'gradientTransform']) AND !empty($gradient[
'gradientTransform'])) {
 
28636                          $gtm = $gradient[
'gradientTransform'];
 
28638                          $xa = ($gtm[0] * $gradient[
'coords'][0]) + ($gtm[2] * $gradient[
'coords'][1]) + $gtm[4];
 
28639                          $ya = ($gtm[1] * $gradient[
'coords'][0]) + ($gtm[3] * $gradient[
'coords'][1]) + $gtm[5];
 
28640                          $xb = ($gtm[0] * $gradient[
'coords'][2]) + ($gtm[2] * $gradient[
'coords'][3]) + $gtm[4];
 
28641                          $yb = ($gtm[1] * $gradient[
'coords'][2]) + ($gtm[3] * $gradient[
'coords'][3]) + $gtm[5];
 
28642                          if (isset($gradient[
'coords'][4])) {
 
28643                               $gradient[
'coords'][4] = sqrt(pow(($gtm[0] * $gradient[
'coords'][4]), 2) + pow(($gtm[1] * $gradient[
'coords'][4]), 2));
 
28645                          $gradient[
'coords'][0] = $xa;
 
28646                          $gradient[
'coords'][1] = $ya;
 
28647                          $gradient[
'coords'][2] = $xb;
 
28648                          $gradient[
'coords'][3] = $yb;
 
28651                     $gradient[
'coords'][0] = $this->getHTMLUnitToUnits($gradient[
'coords'][0], 0, $this->svgunit, 
false);
 
28652                     $gradient[
'coords'][1] = $this->getHTMLUnitToUnits($gradient[
'coords'][1], 0, $this->svgunit, 
false);
 
28653                     $gradient[
'coords'][2] = $this->getHTMLUnitToUnits($gradient[
'coords'][2], 0, $this->svgunit, 
false);
 
28654                     $gradient[
'coords'][3] = $this->getHTMLUnitToUnits($gradient[
'coords'][3], 0, $this->svgunit, 
false);
 
28655                     if (isset($gradient[
'coords'][4])) {
 
28656                          $gradient[
'coords'][4] = $this->getHTMLUnitToUnits($gradient[
'coords'][4], 0, $this->svgunit, 
false);
 
28658                     if ($w <= $minlen) {
 
28661                     if ($h <= $minlen) {
 
28665                     if ($gradient[
'gradientUnits'] == 
'objectBoundingBox') {
 
28667                          $gradient[
'coords'][0] += $x;
 
28668                          $gradient[
'coords'][1] += $y;
 
28669                          $gradient[
'coords'][2] += $x;
 
28670                          $gradient[
'coords'][3] += $y;
 
28673                     $gradient[
'coords'][0] = (($gradient[
'coords'][0] - $x) / $w);
 
28674                     $gradient[
'coords'][1] = (($gradient[
'coords'][1] - $y) / $h);
 
28675                     $gradient[
'coords'][2] = (($gradient[
'coords'][2] - $x) / $w);
 
28676                     $gradient[
'coords'][3] = (($gradient[
'coords'][3] - $y) / $h);
 
28677                     if (isset($gradient[
'coords'][4])) {
 
28678                          $gradient[
'coords'][4] /= $w;
 
28680                } 
elseif ($gradient[
'mode'] == 
'percentage') {
 
28681                     foreach($gradient[
'coords'] as $key => $val) {
 
28682                          $gradient[
'coords'][$key] = (intval($val) / 100);
 
28684                               $gradient[
'coords'][$key] = 0;
 
28686                               $gradient[
'coords'][$key] = 1;
 
28690                if (($gradient[
'type'] == 2) AND ($gradient[
'coords'][0] == $gradient[
'coords'][2]) AND ($gradient[
'coords'][1] == $gradient[
'coords'][3])) {
 
28692                     $gradient[
'coords'][0] = 1;
 
28693                     $gradient[
'coords'][1] = 0;
 
28694                     $gradient[
'coords'][2] = 0.999;
 
28695                     $gradient[
'coords'][3] = 0;
 
28698                $tmp = $gradient[
'coords'][1];
 
28699                $gradient[
'coords'][1] = $gradient[
'coords'][3];
 
28700                $gradient[
'coords'][3] = $tmp;
 
28702                if ($gradient[
'type'] == 3) {
 
28704                     $cy = $this->h - $y - ($gradient[
'coords'][1] * ($w + $h));
 
28705                     $this->_out(sprintf(
'%F 0 0 %F %F %F cm', ($w * $this->k), ($w * $this->k), ($x * $this->k), ($cy * $this->k)));
 
28707                     $this->_out(sprintf(
'%F 0 0 %F %F %F cm', ($w * $this->k), ($h * $this->k), ($x * $this->k), (($this->h - ($y + $h)) * $this->k)));
 
28709                if (count($gradient[
'stops']) > 1) {
 
28710                     $this->Gradient($gradient[
'type'], $gradient[
'coords'], $gradient[
'stops'], array(), 
false);
 
28712           } 
elseif ($svgstyle[
'fill'] != 
'none') {
 
28713                $fill_color = $this->convertHTMLColorToDec($svgstyle[
'fill']);
 
28714                if ($svgstyle[
'fill-opacity'] != 1) {
 
28715                     $this->setAlpha($this->alpha[
'CA'], 
'Normal', $svgstyle[
'fill-opacity'], 
false);
 
28717                $this->SetFillColorArray($fill_color);
 
28718                if ($svgstyle[
'fill-rule'] == 
'evenodd') {
 
28725           if ($svgstyle[
'stroke'] != 
'none') {
 
28726                if ($svgstyle[
'stroke-opacity'] != 1) {
 
28727                     $this->setAlpha($svgstyle[
'stroke-opacity'], 
'Normal', $this->alpha[
'ca'], 
false);
 
28729                $stroke_style = array(
 
28730                     'color' => $this->convertHTMLColorToDec($svgstyle[
'stroke']),
 
28731                     'width' => $this->getHTMLUnitToUnits($svgstyle[
'stroke-width'], 0, $this->svgunit, 
false),
 
28732                     'cap' => $svgstyle[
'stroke-linecap'],
 
28733                     'join' => $svgstyle[
'stroke-linejoin']
 
28735                if (isset($svgstyle[
'stroke-dasharray']) AND !empty($svgstyle[
'stroke-dasharray']) AND ($svgstyle[
'stroke-dasharray'] != 
'none')) {
 
28736                     $stroke_style[
'dash'] = $svgstyle[
'stroke-dasharray'];
 
28738                $this->SetLineStyle($stroke_style);
 
28743           if (!empty($svgstyle[
'font'])) {
 
28744                if (preg_match(
'/font-family[\s]*:[\s]*([^\;\"]*)/si', $svgstyle[
'font'], $regs)) {
 
28745                     $font_family = $this->getFontFamilyName($regs[1]);
 
28747                     $font_family = $svgstyle[
'font-family'];
 
28749                if (preg_match(
'/font-size[\s]*:[\s]*([^\s\;\"]*)/si', $svgstyle[
'font'], $regs)) {
 
28754                if (preg_match(
'/font-style[\s]*:[\s]*([^\s\;\"]*)/si', $svgstyle[
'font'], $regs)) {
 
28755                     $font_style = trim($regs[1]);
 
28757                     $font_style = $svgstyle[
'font-style'];
 
28759                if (preg_match(
'/font-weight[\s]*:[\s]*([^\s\;\"]*)/si', $svgstyle[
'font'], $regs)) {
 
28760                     $font_weight = trim($regs[1]);
 
28762                     $font_weight = $svgstyle[
'font-weight'];
 
28764                if (preg_match(
'/font-stretch[\s]*:[\s]*([^\s\;\"]*)/si', $svgstyle[
'font'], $regs)) {
 
28765                     $font_stretch = trim($regs[1]);
 
28767                     $font_stretch = $svgstyle[
'font-stretch'];
 
28769                if (preg_match(
'/letter-spacing[\s]*:[\s]*([^\s\;\"]*)/si', $svgstyle[
'font'], $regs)) {
 
28770                     $font_spacing = trim($regs[1]);
 
28772                     $font_spacing = $svgstyle[
'letter-spacing'];
 
28775                $font_family = $this->getFontFamilyName($svgstyle[
'font-family']);
 
28777                $font_style = $svgstyle[
'font-style'];
 
28778                $font_weight = $svgstyle[
'font-weight'];
 
28779                $font_stretch = $svgstyle[
'font-stretch'];
 
28780                $font_spacing = $svgstyle[
'letter-spacing'];
 
28782           $font_size = $this->getHTMLUnitToUnits(
$font_size, $prevsvgstyle[
'font-size'], $this->svgunit, 
false) * $this->k;
 
28783           $font_stretch = $this->getCSSFontStretching($font_stretch, $svgstyle[
'font-stretch']);
 
28784           $font_spacing = $this->getCSSFontSpacing($font_spacing, $svgstyle[
'letter-spacing']);
 
28785           switch ($font_style) {
 
28800           switch ($font_weight) {
 
28803                     $font_style .= 
'B';
 
28807           switch ($svgstyle[
'text-decoration']) {
 
28808                case 'underline': {
 
28809                     $font_style .= 
'U';
 
28813                     $font_style .= 
'O';
 
28816                case 'line-through': {
 
28817                     $font_style .= 
'D';
 
28825           $this->SetFont($font_family, $font_style, 
$font_size);
 
28826           $this->setFontStretching($font_stretch);
 
28827           $this->setFontSpacing($font_spacing);
 
28850           if ($this->state != 2) {
 
28854           $op = $this->getPathPaintOperator($style, 
'');
 
28859           $d = preg_replace(
'/([0-9ACHLMQSTVZ])([\-\+])/si', 
'\\1 \\2', $d);
 
28860           preg_match_all(
'/([ACHLMQSTVZ])[\s]*([^ACHLMQSTVZ\"]*)/si', $d, $paths, PREG_SET_ORDER);
 
28867           $xmin = 2147483647;
 
28869           $ymin = 2147483647;
 
28872           $minlen = (0.01 / $this->k); 
 
28875           foreach ($paths as $key => $val) {
 
28877                $cmd = trim($val[1]);
 
28878                if (strtolower($cmd) == $cmd) {
 
28889                if (isset($val[2])) {
 
28891                     $rawparams = preg_split(
'/([\,\s]+)/si', trim($val[2]));
 
28893                     foreach ($rawparams as $ck => $cp) {
 
28894                          $params[$ck] = $this->getHTMLUnitToUnits($cp, 0, $this->svgunit, 
false);
 
28895                          if (abs($params[$ck]) < $minlen) {
 
28904                switch (strtoupper($cmd)) {
 
28906                          foreach ($params as $ck => $cp) {
 
28907                               if (($ck % 2) == 0) {
 
28908                                    $x = $cp + $xoffset;
 
28910                                    $y = $cp + $yoffset;
 
28911                                    if ($firstcmd OR (abs($x0 - $x) >= $minlen) OR (abs($y0 - $y) >= $minlen)) {
 
28913                                              $this->_outPoint($x, $y);
 
28916                                              $this->_outLine($x, $y);
 
28921                                    $xmin = min($xmin, $x);
 
28922                                    $ymin = min($ymin, $y);
 
28923                                    $xmax = max($xmax, $x);
 
28924                                    $ymax = max($ymax, $y);
 
28934                          foreach ($params as $ck => $cp) {
 
28935                               if (($ck % 2) == 0) {
 
28936                                    $x = $cp + $xoffset;
 
28938                                    $y = $cp + $yoffset;
 
28939                                    if ((abs($x0 - $x) >= $minlen) OR (abs($y0 - $y) >= $minlen)) {
 
28940                                         $this->_outLine($x, $y);
 
28944                                    $xmin = min($xmin, $x);
 
28945                                    $ymin = min($ymin, $y);
 
28946                                    $xmax = max($xmax, $x);
 
28947                                    $ymax = max($ymax, $y);
 
28957                          foreach ($params as $ck => $cp) {
 
28958                               $x = $cp + $xoffset;
 
28959                               if ((abs($x0 - $x) >= $minlen) OR (abs($y0 - $y) >= $minlen)) {
 
28960                                    $this->_outLine($x, $y);
 
28964                               $xmin = min($xmin, $x);
 
28965                               $xmax = max($xmax, $x);
 
28973                          foreach ($params as $ck => $cp) {
 
28974                               $y = $cp + $yoffset;
 
28975                               if ((abs($x0 - $x) >= $minlen) OR (abs($y0 - $y) >= $minlen)) {
 
28976                                    $this->_outLine($x, $y);
 
28980                               $ymin = min($ymin, $y);
 
28981                               $ymax = max($ymax, $y);
 
28989                          foreach ($params as $ck => $cp) {
 
28990                               $params[$ck] = $cp;
 
28991                               if ((($ck + 1) % 6) == 0) {
 
28992                                    $x1 = $params[($ck - 5)] + $xoffset;
 
28993                                    $y1 = $params[($ck - 4)] + $yoffset;
 
28994                                    $x2 = $params[($ck - 3)] + $xoffset;
 
28995                                    $y2 = $params[($ck - 2)] + $yoffset;
 
28996                                    $x = $params[($ck - 1)] + $xoffset;
 
28997                                    $y = $params[($ck)] + $yoffset;
 
28998                                    $this->_outCurve($x1, $y1, $x2, $y2, $x, $y);
 
28999                                    $xmin = min($xmin, $x, $x1, $x2);
 
29000                                    $ymin = min($ymin, $y, $y1, $y2);
 
29001                                    $xmax = max($xmax, $x, $x1, $x2);
 
29002                                    $ymax = max($ymax, $y, $y1, $y2);
 
29012                          foreach ($params as $ck => $cp) {
 
29013                               $params[$ck] = $cp;
 
29014                               if ((($ck + 1) % 4) == 0) {
 
29015                                    if (($key > 0) AND ((strtoupper($paths[($key - 1)][1]) == 
'C') OR (strtoupper($paths[($key - 1)][1]) == 
'S'))) {
 
29016                                         $x1 = (2 * $x) - $x2;
 
29017                                         $y1 = (2 * $y) - $y2;
 
29022                                    $x2 = $params[($ck - 3)] + $xoffset;
 
29023                                    $y2 = $params[($ck - 2)] + $yoffset;
 
29024                                    $x = $params[($ck - 1)] + $xoffset;
 
29025                                    $y = $params[($ck)] + $yoffset;
 
29026                                    $this->_outCurve($x1, $y1, $x2, $y2, $x, $y);
 
29027                                    $xmin = min($xmin, $x, $x1, $x2);
 
29028                                    $ymin = min($ymin, $y, $y1, $y2);
 
29029                                    $xmax = max($xmax, $x, $x1, $x2);
 
29030                                    $ymax = max($ymax, $y, $y1, $y2);
 
29040                          foreach ($params as $ck => $cp) {
 
29041                               $params[$ck] = $cp;
 
29042                               if ((($ck + 1) % 4) == 0) {
 
29044                                    $x1 = $params[($ck - 3)] + $xoffset;
 
29045                                    $y1 = $params[($ck - 2)] + $yoffset;
 
29046                                    $xa = ($x + (2 * $x1)) / 3;
 
29047                                    $ya = ($y + (2 * $y1)) / 3;
 
29048                                    $x = $params[($ck - 1)] + $xoffset;
 
29049                                    $y = $params[($ck)] + $yoffset;
 
29050                                    $xb = ($x + (2 * $x1)) / 3;
 
29051                                    $yb = ($y + (2 * $y1)) / 3;
 
29052                                    $this->_outCurve($xa, $ya, $xb, $yb, $x, $y);
 
29053                                    $xmin = min($xmin, $x, $xa, $xb);
 
29054                                    $ymin = min($ymin, $y, $ya, $yb);
 
29055                                    $xmax = max($xmax, $x, $xa, $xb);
 
29056                                    $ymax = max($ymax, $y, $ya, $yb);
 
29066                          foreach ($params as $ck => $cp) {
 
29067                               $params[$ck] = $cp;
 
29068                               if (($ck % 2) != 0) {
 
29069                                    if (($key > 0) AND ((strtoupper($paths[($key - 1)][1]) == 
'Q') OR (strtoupper($paths[($key - 1)][1]) == 
'T'))) {
 
29070                                         $x1 = (2 * $x) - $x1;
 
29071                                         $y1 = (2 * $y) - $y1;
 
29077                                    $xa = ($x + (2 * $x1)) / 3;
 
29078                                    $ya = ($y + (2 * $y1)) / 3;
 
29079                                    $x = $params[($ck - 1)] + $xoffset;
 
29080                                    $y = $params[($ck)] + $yoffset;
 
29081                                    $xb = ($x + (2 * $x1)) / 3;
 
29082                                    $yb = ($y + (2 * $y1)) / 3;
 
29083                                    $this->_outCurve($xa, $ya, $xb, $yb, $x, $y);
 
29084                                    $xmin = min($xmin, $x, $xa, $xb);
 
29085                                    $ymin = min($ymin, $y, $ya, $yb);
 
29086                                    $xmax = max($xmax, $x, $xa, $xb);
 
29087                                    $ymax = max($ymax, $y, $ya, $yb);
 
29097                          foreach ($params as $ck => $cp) {
 
29098                               $params[$ck] = $cp;
 
29099                               if ((($ck + 1) % 7) == 0) {
 
29102                                    $rx = abs($params[($ck - 6)]);
 
29103                                    $ry = abs($params[($ck - 5)]);
 
29104                                    $ang = -$rawparams[($ck - 4)];
 
29105                                    $angle = deg2rad($ang);
 
29106                                    $fa = $rawparams[($ck - 3)]; 
 
29107                                    $fs = $rawparams[($ck - 2)]; 
 
29108                                    $x = $params[($ck - 1)] + $xoffset;
 
29109                                    $y = $params[$ck] + $yoffset;
 
29110                                    if ((abs($x0 - $x) < $minlen) AND (abs($y0 - $y) < $minlen)) {
 
29112                                         $xmin = min($xmin, $x);
 
29113                                         $ymin = min($ymin, $y);
 
29114                                         $xmax = max($xmax, $x);
 
29115                                         $ymax = max($ymax, $y);
 
29117                                         $cos_ang = cos($angle);
 
29118                                         $sin_ang = sin($angle);
 
29119                                         $a = (($x0 - $x) / 2);
 
29120                                         $b = (($y0 - $y) / 2);
 
29121                                         $xa = ($a * $cos_ang) - ($b * $sin_ang);
 
29122                                         $ya = ($a * $sin_ang) + ($b * $cos_ang);
 
29127                                         $delta = ($xa2 / $rx2) + ($ya2 / $ry2);
 
29129                                              $rx *= sqrt($delta);
 
29130                                              $ry *= sqrt($delta);
 
29134                                         $numerator = (($rx2 * $ry2) - ($rx2 * $ya2) - ($ry2 * $xa2));
 
29135                                         if ($numerator < 0) {
 
29138                                              $root = sqrt($numerator / (($rx2 * $ya2) + ($ry2 * $xa2)));
 
29143                                         $cax = $root * (($rx * $ya) / $ry);
 
29144                                         $cay = -$root * (($ry * $xa) / $rx);
 
29146                                         $cx = ($cax * $cos_ang) - ($cay * $sin_ang) + (($x0 + $x) / 2);
 
29147                                         $cy = ($cax * $sin_ang) + ($cay * $cos_ang) + (($y0 + $y) / 2);
 
29149                                         $angs = $this->getVectorsAngle(1, 0, (($xa - $cax) / $rx), (($cay - $ya) / $ry));
 
29150                                         $dang = $this->getVectorsAngle((($xa - $cax) / $rx), (($ya - $cay) / $ry), ((-$xa - $cax) / $rx), ((-$ya - $cay) / $ry));
 
29151                                         if (($fs == 0) AND ($dang > 0)) {
 
29152                                              $dang -= (2 * M_PI);
 
29153                                         } 
elseif (($fs == 1) AND ($dang < 0)) {
 
29154                                              $dang += (2 * M_PI);
 
29156                                         $angf = $angs - $dang;
 
29157                                         if ((($fs == 0) AND ($angs > $angf)) OR (($fs == 1) AND ($angs < $angf))) {
 
29163                                         $angs = round(rad2deg($angs), 6);
 
29164                                         $angf = round(rad2deg($angf), 6);
 
29166                                         if (($angs < 0) AND ($angf < 0)) {
 
29171                                         if (($key == 0) AND (isset($paths[($key + 1)][1])) AND (trim($paths[($key + 1)][1]) == 
'z')) {
 
29174                                         list($axmin, $aymin, $axmax, $aymax) = $this->_outellipticalarc($cx, $cy, $rx, $ry, $ang, $angs, $angf, $pie, 2, 
false, ($fs == 0), 
true);
 
29175                                         $xmin = min($xmin, $x, $axmin);
 
29176                                         $ymin = min($ymin, $y, $aymin);
 
29177                                         $xmax = max($xmax, $x, $axmax);
 
29178                                         $ymax = max($ymax, $y, $aymax);
 
29198           return array($xmin, $ymin, ($xmax - $xmin), ($ymax - $ymin));
 
29212           $dprod = ($x1 * $x2) + ($y1 * $y2);
 
29213           $dist1 = sqrt(($x1 * $x1) + ($y1 * $y1));
 
29214           $dist2 = sqrt(($x2 * $x2) + ($y2 * $y2));
 
29215           $angle = acos($dprod / ($dist1 * $dist2));
 
29216           if (is_nan($angle)) {
 
29219           if ((($x1 * $y2) - ($x2 * $y1)) < 0) {
 
29237           if ($this->svgclipmode) {
 
29238                $this->svgclippaths[$this->svgclipid][] = array(
'name' => $name, 
'attribs' => $attribs, 
'tm' => $this->svgcliptm[$this->svgclipid]);
 
29241           if ($this->svgdefsmode AND !in_array($name, array(
'clipPath', 
'linearGradient', 
'radialGradient', 
'stop'))) {
 
29242                if (!isset($attribs[
'id'])) {
 
29243                     $attribs[
'id'] = 
'DF_'.(count($this->svgdefs) + 1);
 
29245                $this->svgdefs[$attribs[
'id']] = array(
'name' => $name, 
'attribs' => $attribs);
 
29249           if ($parser == 
'clip-path') {
 
29254           $prev_svgstyle = $this->svgstyles[(count($this->svgstyles) - 1)]; 
 
29255           $svgstyle = $this->svgstyles[0]; 
 
29256           if ($clipping AND !isset($attribs[
'fill']) AND (!isset($attribs[
'style']) OR (!preg_match(
'/[;\"\s]{1}fill[\s]*:[\s]*([^;\"]*)/si', $attribs[
'style'], $attrval)))) {
 
29258                $attribs[
'fill'] = 
'none';
 
29260           if (isset($attribs[
'style']) AND !$this->empty_string($attribs[
'style'])) {
 
29262                $attribs[
'style'] = 
';'.$attribs[
'style'];
 
29264           foreach ($prev_svgstyle as $key => $val) {
 
29265                if (in_array($key, $this->svginheritprop)) {
 
29267                     $svgstyle[$key] = $val;
 
29269                if (isset($attribs[$key]) AND !$this->empty_string($attribs[$key])) {
 
29271                     if ($attribs[$key] == 
'inherit') {
 
29272                          $svgstyle[$key] = $val;
 
29274                          $svgstyle[$key] = $attribs[$key];
 
29276                } 
elseif (isset($attribs[
'style']) AND !$this->empty_string($attribs[
'style'])) {
 
29278                     $attrval = array();
 
29279                     if (preg_match(
'/[;\"\s]{1}'.$key.
'[\s]*:[\s]*([^;\"]*)/si', $attribs[
'style'], $attrval) AND isset($attrval[1])) {
 
29280                          if ($attrval[1] == 
'inherit') {
 
29281                               $svgstyle[$key] = $val;
 
29283                               $svgstyle[$key] = $attrval[1];
 
29289           if (!empty($ctm)) {
 
29293                $tm = array(1,0,0,1,0,0);
 
29295           if (isset($attribs[
'transform']) AND !empty($attribs[
'transform'])) {
 
29296                $tm = $this->getTransformationMatrixProduct($tm, $this->getSVGTransformMatrix($attribs[
'transform']));
 
29298           $svgstyle[
'transfmatrix'] = $tm;
 
29299           $invisible = 
false;
 
29300           if (($svgstyle[
'visibility'] == 
'hidden') OR ($svgstyle[
'visibility'] == 
'collapse') OR ($svgstyle[
'display'] == 
'none')) {
 
29307                     $this->svgdefsmode = 
true;
 
29315                     $this->svgclipmode = 
true;
 
29316                     if (!isset($attribs[
'id'])) {
 
29317                          $attribs[
'id'] = 
'CP_'.(count($this->svgcliptm) + 1);
 
29319                     $this->svgclipid = $attribs[
'id'];
 
29320                     $this->svgclippaths[$this->svgclipid] = array();
 
29321                     $this->svgcliptm[$this->svgclipid] = $tm;
 
29330                     array_push($this->svgstyles, $svgstyle);
 
29331                     $this->StartTransform();
 
29332                     $this->SVGTransform($tm);
 
29333                     $this->setSVGStyles($svgstyle, $prev_svgstyle);
 
29336                case 'linearGradient': {
 
29337                     if ($this->pdfa_mode) {
 
29340                     if (!isset($attribs[
'id'])) {
 
29341                          $attribs[
'id'] = 
'GR_'.(count($this->svggradients) + 1);
 
29343                     $this->svggradientid = $attribs[
'id'];
 
29344                     $this->svggradients[$this->svggradientid] = array();
 
29345                     $this->svggradients[$this->svggradientid][
'type'] = 2;
 
29346                     $this->svggradients[$this->svggradientid][
'stops'] = array();
 
29347                     if (isset($attribs[
'gradientUnits'])) {
 
29348                          $this->svggradients[$this->svggradientid][
'gradientUnits'] = $attribs[
'gradientUnits'];
 
29350                          $this->svggradients[$this->svggradientid][
'gradientUnits'] = 
'objectBoundingBox';
 
29353                     if (((!isset($attribs[
'x1'])) AND (!isset($attribs[
'y1'])) AND (!isset($attribs[
'x2'])) AND (!isset($attribs[
'y2'])))
 
29354                          OR ((isset($attribs[
'x1']) AND (substr($attribs[
'x1'], -1) == 
'%'))
 
29355                               OR (isset($attribs[
'y1']) AND (substr($attribs[
'y1'], -1) == 
'%'))
 
29356                               OR (isset($attribs[
'x2']) AND (substr($attribs[
'x2'], -1) == 
'%'))
 
29357                               OR (isset($attribs[
'y2']) AND (substr($attribs[
'y2'], -1) == 
'%')))) {
 
29358                          $this->svggradients[$this->svggradientid][
'mode'] = 
'percentage';
 
29360                          $this->svggradients[$this->svggradientid][
'mode'] = 
'measure';
 
29362                     $x1 = (isset($attribs[
'x1'])?$attribs[
'x1']:
'0');
 
29363                     $y1 = (isset($attribs[
'y1'])?$attribs[
'y1']:
'0');
 
29364                     $x2 = (isset($attribs[
'x2'])?$attribs[
'x2']:
'100');
 
29365                     $y2 = (isset($attribs[
'y2'])?$attribs[
'y2']:
'0');
 
29366                     if (isset($attribs[
'gradientTransform'])) {
 
29367                          $this->svggradients[$this->svggradientid][
'gradientTransform'] = $this->getSVGTransformMatrix($attribs[
'gradientTransform']);
 
29369                     $this->svggradients[$this->svggradientid][
'coords'] = array($x1, $y1, $x2, $y2);
 
29370                     if (isset($attribs[
'xlink:href']) AND !empty($attribs[
'xlink:href'])) {
 
29372                          $this->svggradients[$this->svggradientid][
'xref'] = substr($attribs[
'xlink:href'], 1);
 
29376                case 'radialGradient': {
 
29377                     if ($this->pdfa_mode) {
 
29380                     if (!isset($attribs[
'id'])) {
 
29381                          $attribs[
'id'] = 
'GR_'.(count($this->svggradients) + 1);
 
29383                     $this->svggradientid = $attribs[
'id'];
 
29384                     $this->svggradients[$this->svggradientid] = array();
 
29385                     $this->svggradients[$this->svggradientid][
'type'] = 3;
 
29386                     $this->svggradients[$this->svggradientid][
'stops'] = array();
 
29387                     if (isset($attribs[
'gradientUnits'])) {
 
29388                          $this->svggradients[$this->svggradientid][
'gradientUnits'] = $attribs[
'gradientUnits'];
 
29390                          $this->svggradients[$this->svggradientid][
'gradientUnits'] = 
'objectBoundingBox';
 
29393                     if (((!isset($attribs[
'cx'])) AND (!isset($attribs[
'cy'])))
 
29394                          OR ((isset($attribs[
'cx']) AND (substr($attribs[
'cx'], -1) == 
'%'))
 
29395                               OR (isset($attribs[
'cy']) AND (substr($attribs[
'cy'], -1) == 
'%')) )) {
 
29396                          $this->svggradients[$this->svggradientid][
'mode'] = 
'percentage';
 
29398                          $this->svggradients[$this->svggradientid][
'mode'] = 
'measure';
 
29400                     $cx = (isset($attribs[
'cx']) ? $attribs[
'cx'] : 0.5);
 
29401                     $cy = (isset($attribs[
'cy']) ? $attribs[
'cy'] : 0.5);
 
29402                     $fx = (isset($attribs[
'fx']) ? $attribs[
'fx'] : $cx);
 
29403                     $fy = (isset($attribs[
'fy']) ? $attribs[
'fy'] : $cy);
 
29404                     $r = (isset($attribs[
'r']) ? $attribs[
'r'] : 0.5);
 
29405                     if (isset($attribs[
'gradientTransform'])) {
 
29406                          $this->svggradients[$this->svggradientid][
'gradientTransform'] = $this->getSVGTransformMatrix($attribs[
'gradientTransform']);
 
29408                     $this->svggradients[$this->svggradientid][
'coords'] = array($cx, $cy, $fx, $fy, $r);
 
29409                     if (isset($attribs[
'xlink:href']) AND !empty($attribs[
'xlink:href'])) {
 
29411                          $this->svggradients[$this->svggradientid][
'xref'] = substr($attribs[
'xlink:href'], 1);
 
29417                     if (substr($attribs[
'offset'], -1) == 
'%') {
 
29418                          $offset = floatval(substr($attribs[
'offset'], -1)) / 100;
 
29420                          $offset = floatval($attribs[
'offset']);
 
29425                     $stop_color = isset($svgstyle[
'stop-color'])?$this->convertHTMLColorToDec($svgstyle[
'stop-color']):
'black';
 
29426                     $opacity = isset($svgstyle[
'stop-opacity'])?$svgstyle[
'stop-opacity']:1;
 
29427                     $this->svggradients[$this->svggradientid][
'stops'][] = array(
'offset' => $offset, 
'color' => $stop_color, 
'opacity' => $opacity);
 
29435                     if (isset($attribs[
'd'])) {
 
29436                          $d = trim($attribs[
'd']);
 
29439                                    $this->SVGTransform($tm);
 
29440                                    $this->SVGPath($d, 
'CNZ');
 
29442                                    $this->StartTransform();
 
29443                                    $this->SVGTransform($tm);
 
29444                                    $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, 0, 0, 1, 1, 
'SVGPath', array($d, 
'CNZ'));
 
29445                                    if (!empty($obstyle)) {
 
29446                                         $this->SVGPath($d, $obstyle);
 
29448                                    $this->StopTransform();
 
29459                     $x = (isset($attribs[
'x'])?$this->getHTMLUnitToUnits($attribs[
'x'], 0, $this->svgunit, 
false):0);
 
29460                     $y = (isset($attribs[
'y'])?$this->getHTMLUnitToUnits($attribs[
'y'], 0, $this->svgunit, 
false):0);
 
29461                     $w = (isset($attribs[
'width'])?$this->getHTMLUnitToUnits($attribs[
'width'], 0, $this->svgunit, 
false):0);
 
29462                     $h = (isset($attribs[
'height'])?$this->getHTMLUnitToUnits($attribs[
'height'], 0, $this->svgunit, 
false):0);
 
29463                     $rx = (isset($attribs[
'rx'])?$this->getHTMLUnitToUnits($attribs[
'rx'], 0, $this->svgunit, 
false):0);
 
29464                     $ry = (isset($attribs[
'ry'])?$this->getHTMLUnitToUnits($attribs[
'ry'], 0, $this->svgunit, 
false):$rx);
 
29466                          $this->SVGTransform($tm);
 
29467                          $this->RoundedRectXY($x, $y, $w, $h, $rx, $ry, 
'1111', 
'CNZ', array(), array());
 
29469                          $this->StartTransform();
 
29470                          $this->SVGTransform($tm);
 
29471                          $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, $x, $y, $w, $h, 
'RoundedRectXY', array($x, $y, $w, $h, $rx, $ry, 
'1111', 
'CNZ'));
 
29472                          if (!empty($obstyle)) {
 
29473                               $this->RoundedRectXY($x, $y, $w, $h, $rx, $ry, 
'1111', $obstyle, array(), array());
 
29475                          $this->StopTransform();
 
29483                     $r = (isset($attribs[
'r']) ? $this->getHTMLUnitToUnits($attribs[
'r'], 0, $this->svgunit, 
false) : 0);
 
29484                     $cx = (isset($attribs[
'cx']) ? $this->getHTMLUnitToUnits($attribs[
'cx'], 0, $this->svgunit, 
false) : (isset($attribs[
'x']) ? $this->getHTMLUnitToUnits($attribs[
'x'], 0, $this->svgunit, 
false) : 0));
 
29485                     $cy = (isset($attribs[
'cy']) ? $this->getHTMLUnitToUnits($attribs[
'cy'], 0, $this->svgunit, 
false) : (isset($attribs[
'y']) ? $this->getHTMLUnitToUnits($attribs[
'y'], 0, $this->svgunit, 
false) : 0));
 
29491                          $this->SVGTransform($tm);
 
29492                          $this->Circle($cx, $cy, $r, 0, 360, 
'CNZ', array(), array(), 8);
 
29494                          $this->StartTransform();
 
29495                          $this->SVGTransform($tm);
 
29496                          $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, $x, $y, $w, $h, 
'Circle', array($cx, $cy, $r, 0, 360, 
'CNZ'));
 
29497                          if (!empty($obstyle)) {
 
29498                               $this->Circle($cx, $cy, $r, 0, 360, $obstyle, array(), array(), 8);
 
29500                          $this->StopTransform();
 
29508                     $rx = (isset($attribs[
'rx']) ? $this->getHTMLUnitToUnits($attribs[
'rx'], 0, $this->svgunit, 
false) : 0);
 
29509                     $ry = (isset($attribs[
'ry']) ? $this->getHTMLUnitToUnits($attribs[
'ry'], 0, $this->svgunit, 
false) : 0);
 
29510                     $cx = (isset($attribs[
'cx']) ? $this->getHTMLUnitToUnits($attribs[
'cx'], 0, $this->svgunit, 
false) : (isset($attribs[
'x']) ? $this->getHTMLUnitToUnits($attribs[
'x'], 0, $this->svgunit, 
false) : 0));
 
29511                     $cy = (isset($attribs[
'cy']) ? $this->getHTMLUnitToUnits($attribs[
'cy'], 0, $this->svgunit, 
false) : (isset($attribs[
'y']) ? $this->getHTMLUnitToUnits($attribs[
'y'], 0, $this->svgunit, 
false) : 0));
 
29517                          $this->SVGTransform($tm);
 
29518                          $this->Ellipse($cx, $cy, $rx, $ry, 0, 0, 360, 
'CNZ', array(), array(), 8);
 
29520                          $this->StartTransform();
 
29521                          $this->SVGTransform($tm);
 
29522                          $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, $x, $y, $w, $h, 
'Ellipse', array($cx, $cy, $rx, $ry, 0, 0, 360, 
'CNZ'));
 
29523                          if (!empty($obstyle)) {
 
29524                               $this->Ellipse($cx, $cy, $rx, $ry, 0, 0, 360, $obstyle, array(), array(), 8);
 
29526                          $this->StopTransform();
 
29534                     $x1 = (isset($attribs[
'x1'])?$this->getHTMLUnitToUnits($attribs[
'x1'], 0, $this->svgunit, 
false):0);
 
29535                     $y1 = (isset($attribs[
'y1'])?$this->getHTMLUnitToUnits($attribs[
'y1'], 0, $this->svgunit, 
false):0);
 
29536                     $x2 = (isset($attribs[
'x2'])?$this->getHTMLUnitToUnits($attribs[
'x2'], 0, $this->svgunit, 
false):0);
 
29537                     $y2 = (isset($attribs[
'y2'])?$this->getHTMLUnitToUnits($attribs[
'y2'], 0, $this->svgunit, 
false):0);
 
29540                     $w = abs($x2 - $x1);
 
29541                     $h = abs($y2 - $y1);
 
29543                          $this->StartTransform();
 
29544                          $this->SVGTransform($tm);
 
29545                          $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, $x, $y, $w, $h, 
'Line', array($x1, $y1, $x2, $y2));
 
29546                          $this->Line($x1, $y1, $x2, $y2);
 
29547                          $this->StopTransform();
 
29556                     $points = (isset($attribs[
'points'])?$attribs[
'points']:
'0 0');
 
29557                     $points = trim($points);
 
29559                     $points = preg_split(
'/[\,\s]+/si', $points);
 
29560                     if (count($points) < 4) {
 
29564                     $xmin = 2147483647;
 
29566                     $ymin = 2147483647;
 
29568                     foreach ($points as $key => $val) {
 
29569                          $p[$key] = $this->getHTMLUnitToUnits($val, 0, $this->svgunit, 
false);
 
29570                          if (($key % 2) == 0) {
 
29572                               $xmin = min($xmin, $p[$key]);
 
29573                               $xmax = max($xmax, $p[$key]);
 
29576                               $ymin = min($ymin, $p[$key]);
 
29577                               $ymax = max($ymax, $p[$key]);
 
29582                     $w = ($xmax - $xmin);
 
29583                     $h = ($ymax - $ymin);
 
29584                     if ($name == 
'polyline') {
 
29585                          $this->StartTransform();
 
29586                          $this->SVGTransform($tm);
 
29587                          $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, $x, $y, $w, $h, 
'PolyLine', array($p, 
'CNZ'));
 
29588                          if (!empty($obstyle)) {
 
29589                               $this->PolyLine($p, $obstyle, array(), array());
 
29591                          $this->StopTransform();
 
29594                               $this->SVGTransform($tm);
 
29595                               $this->Polygon($p, 
'CNZ', array(), array(), 
true);
 
29597                               $this->StartTransform();
 
29598                               $this->SVGTransform($tm);
 
29599                               $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, $x, $y, $w, $h, 
'Polygon', array($p, 
'CNZ'));
 
29600                               if (!empty($obstyle)) {
 
29601                                    $this->Polygon($p, $obstyle, array(), array(), 
true);
 
29603                               $this->StopTransform();
 
29613                     if (!isset($attribs[
'xlink:href']) OR empty($attribs[
'xlink:href'])) {
 
29616                     $x = (isset($attribs[
'x'])?$this->getHTMLUnitToUnits($attribs[
'x'], 0, $this->svgunit, 
false):0);
 
29617                     $y = (isset($attribs[
'y'])?$this->getHTMLUnitToUnits($attribs[
'y'], 0, $this->svgunit, 
false):0);
 
29618                     $w = (isset($attribs[
'width'])?$this->getHTMLUnitToUnits($attribs[
'width'], 0, $this->svgunit, 
false):0);
 
29619                     $h = (isset($attribs[
'height'])?$this->getHTMLUnitToUnits($attribs[
'height'], 0, $this->svgunit, 
false):0);
 
29620                     $img = $attribs[
'xlink:href'];
 
29622                          $this->StartTransform();
 
29623                          $this->SVGTransform($tm);
 
29624                          $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, $x, $y, $w, $h);
 
29625                          if (preg_match(
'/^data:image\/[^;]+;base64,/', $img, $m) > 0) {
 
29627                               $img = 
'@'.base64_decode(substr($img, strlen($m[0])));
 
29630                               if (!$this->empty_string($this->svgdir) AND (($img{0} == 
'.') OR (basename($img) == $img))) {
 
29632                                    $img = $this->svgdir.
'/'.$img;
 
29634                               if (($img[0] == 
'/') AND !empty($_SERVER[
'DOCUMENT_ROOT']) AND ($_SERVER[
'DOCUMENT_ROOT'] != 
'/')) {
 
29635                                    $findroot = strpos($img, $_SERVER[
'DOCUMENT_ROOT']);
 
29636                                    if (($findroot === 
false) OR ($findroot > 1)) {
 
29637                                         if (substr($_SERVER[
'DOCUMENT_ROOT'], -1) == 
'/') {
 
29638                                              $img = substr($_SERVER[
'DOCUMENT_ROOT'], 0, -1).$img;
 
29640                                              $img = $_SERVER[
'DOCUMENT_ROOT'].$img;
 
29644                               $img = urldecode($img);
 
29645                               $testscrtype = @parse_url($img);
 
29646                               if (!isset($testscrtype[
'query']) OR empty($testscrtype[
'query'])) {
 
29652                          $imgtype = $this->getImageFileType($img);
 
29653                          if (($imgtype == 
'eps') OR ($imgtype == 
'ai')) {
 
29654                               $this->ImageEps($img, $x, $y, $w, $h);
 
29655                          } 
elseif ($imgtype == 
'svg') {
 
29656                               $this->ImageSVG($img, $x, $y, $w, $h);
 
29658                               $this->Image($img, $x, $y, $w, $h);
 
29660                          $this->StopTransform();
 
29668                     $this->svgtextmode[
'invisible'] = $invisible;
 
29672                     array_push($this->svgstyles, $svgstyle);
 
29673                     if (isset($attribs[
'x'])) {
 
29674                          $x = $this->getHTMLUnitToUnits($attribs[
'x'], 0, $this->svgunit, 
false);
 
29675                     } 
elseif ($name == 
'tspan') {
 
29680                     if (isset($attribs[
'y'])) {
 
29681                          $y = $this->getHTMLUnitToUnits($attribs[
'y'], 0, $this->svgunit, 
false);
 
29682                     } 
elseif ($name == 
'tspan') {
 
29687                     $svgstyle[
'text-color'] = $svgstyle[
'fill'];
 
29688                     $this->svgtext = 
'';
 
29689                     if (isset($svgstyle[
'text-anchor'])) {
 
29690                          $this->svgtextmode[
'text-anchor'] = $svgstyle[
'text-anchor'];
 
29692                          $this->svgtextmode[
'text-anchor'] = 
'start';
 
29694                     if (isset($svgstyle[
'direction'])) {
 
29695                          if ($svgstyle[
'direction'] == 
'rtl') {
 
29696                               $this->svgtextmode[
'rtl'] = 
true;
 
29698                               $this->svgtextmode[
'rtl'] = 
false;
 
29701                          $this->svgtextmode[
'rtl'] = 
false;
 
29703                     if (isset($svgstyle[
'stroke']) AND ($svgstyle[
'stroke'] != 
'none') AND isset($svgstyle[
'stroke-width']) AND ($svgstyle[
'stroke-width'] > 0)) {
 
29704                          $this->svgtextmode[
'stroke'] = $this->getHTMLUnitToUnits($svgstyle[
'stroke-width'], 0, $this->svgunit, 
false);
 
29706                          $this->svgtextmode[
'stroke'] = 
false;
 
29708                     $this->StartTransform();
 
29709                     $this->SVGTransform($tm);
 
29710                     $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, $x, $y, 1, 1);
 
29717                     if (isset($attribs[
'xlink:href']) AND !empty($attribs[
'xlink:href'])) {
 
29718                          $svgdefid = substr($attribs[
'xlink:href'], 1);
 
29719                          if (isset($this->svgdefs[$svgdefid])) {
 
29720                               $use = $this->svgdefs[$svgdefid];
 
29721                               if (isset($attribs[
'xlink:href'])) {
 
29722                                    unset($attribs[
'xlink:href']);
 
29724                               if (isset($attribs[
'id'])) {
 
29725                                    unset($attribs[
'id']);
 
29727                               $attribs = array_merge($attribs, $use[
'attribs']);
 
29728                               $this->startSVGElementHandler($parser, $use[
'name'], $attribs);
 
29750                     $this->svgdefsmode = 
false;
 
29755                     $this->svgclipmode = 
false;
 
29760                     array_pop($this->svgstyles);
 
29761                     $this->StopTransform();
 
29766                     if ($this->svgtextmode[
'invisible']) {
 
29772                     $text = $this->svgtext;
 
29774                     $textlen = $this->GetStringWidth($text);
 
29775                     if ($this->svgtextmode[
'text-anchor'] != 
'start') {
 
29777                          if ($this->svgtextmode[
'text-anchor'] == 
'end') {
 
29778                               if ($this->svgtextmode[
'rtl']) {
 
29779                                    $this->x += $textlen;
 
29781                                    $this->x -= $textlen;
 
29783                          } 
elseif ($this->svgtextmode[
'text-anchor'] == 
'middle') {
 
29784                               if ($this->svgtextmode[
'rtl']) {
 
29785                                    $this->x += ($textlen / 2);
 
29787                                    $this->x -= ($textlen / 2);
 
29791                     $textrendermode = $this->textrendermode;
 
29792                     $textstrokewidth = $this->textstrokewidth;
 
29793                     $this->setTextRenderingMode($this->svgtextmode[
'stroke'], 
true, 
false);
 
29794                     if ($name == 
'text') {
 
29799                     $this->Cell($textlen, 0, $text, 0, 0, 
'', 
false, 
'', 0, 
false, 
'L', 
'T');
 
29800                     if ($name == 
'text') {
 
29806                     $this->textrendermode = $textrendermode;
 
29807                     $this->textstrokewidth = $textstrokewidth;
 
29808                     $this->svgtext = 
'';
 
29809                     $this->StopTransform();
 
29810                     array_pop($this->svgstyles);
 
29828           $this->svgtext .= 
$data;
 
getMargins()
Returns an array containing current margins: 
 
Transform($tm)
Apply graphic transformations. 
 
getPageDimensions($pagenum='')
Returns an array of page dimensions: 
 
SetLineWidth($width)
Defines the line width. 
 
_putimages()
Output images. 
 
_putshaders()
Output gradient shaders. 
 
$transfmatrix_key
Current key for transformation matrix. 
 
SetDrawSpotColor($name, $tint=100)
Defines the spot color used for all drawing operations (lines, rectangles and cell borders)...
 
setSpacesRE($re='/[^\S\xa0]/')
Set regular expression to detect withespaces or word separators. 
 
setFooterData($tc=array(0, 0, 0), $lc=array(0, 0, 0))
Set footer data. 
 
_addfield($type, $name, $x, $y, $w, $h, $prop)
Adds a javascript form field. 
 
setFontStretching($perc=100)
Set the percentage of character stretching. 
 
_outCurve($x1, $y1, $x2, $y2, $x3, $y3)
Append a cubic Bézier curve to the current path. 
 
foreach(array('date1', 'date2', 'type', 'renewals', 'width') as $item) $data
 
AddSpotColor($name, $c, $m, $y, $k)
Defines a new spot color. 
 
addHtmlLink($url, $name, $fill=false, $firstline=false, $color='', $style=-1, $firstblock=false)
Output anchor link. 
 
setJPEGQuality($quality)
Set the default JPEG compression quality (1-100) 
 
getCSSBorderDashStyle($style)
Returns the border dash style from CSS property. 
 
$rasterize_vector_images
Boolean flag: if true convert vector images (SVG, EPS) to raster image using GD or ImageMagick librar...
 
copyPage($page=0)
Clone the specified page to a new page. 
 
setFooter()
This method is used to render the page footer. 
 
_parsejpeg($file)
Extract info from a JPEG file without using the GD library. 
 
PolyLine($p, $style='', $line_style=array(), $fill_color=array())
Draws a polygonal line. 
 
empty_string($str)
Determine whether a string is empty. 
 
$default_graphic_vars
Array of default graphic settings. 
 
$default_form_prop
Deafult Javascript field properties. 
 
const K_BLANK_IMAGE
blank image 
 
formatTOCPageNumber($num)
Format the page numbers on the Table Of Content. 
 
getSpotColor($name)
Return the Spot color array. 
 
_getSHORT($str, $offset)
Get SHORT from string (Big Endian 16-bit signed integer). 
 
getLastH()
Get the last cell height. 
 
_freadint($f)
Read a 4-byte (32 bit) integer from file. 
 
$javascript
Javascript code. 
 
$crMargin
Cell right margin (used by regions). 
 
getGroupPageNo()
Return the current page in the group. 
 
serializeTCPDFtagParameters($pararray)
Serialize an array of parameters to be used with TCPDF tag in HTML code. 
 
Arrow($x0, $y0, $x1, $y1, $head_style=0, $arm_size=5, $arm_angle=15)
Draws a grahic arrow. 
 
$booklet
Booklet mode for double-sided pages. 
 
_parsepng($file)
Extract info from a PNG file without using the GD library. 
 
$AutoPageBreak
Automatic page breaking. 
 
$last_enc_key_c
Last RC4 computed key. 
 
$header_string
String to pring on page header after title. 
 
SetDrawColorArray($color, $ret=false)
Defines the color used for all drawing operations (lines, rectangles and cell borders). 
 
getPageHeight($pagenum='')
Returns the page height in units. 
 
getPageGroupAlias()
Return the alias for the total number of pages in the current page group. 
 
SetDisplayMode($zoom, $layout='SinglePage', $mode='UseNone')
Defines the way the document is to be displayed by the viewer. 
 
$listnum
HTML PARSER: current list nesting level. 
 
_putencryption()
Put encryption on PDF document. 
 
$fhPt
Height of page format in points. 
 
ImageSVG($file, $x='', $y='', $w=0, $h=0, $link='', $align='', $palign='', $border=0, $fitonpage=false)
Embedd a Scalable Vector Graphics (SVG) image. 
 
$underline
Underlining flag. 
 
SetMargins($left, $top, $right=-1, $keepmargins=false)
Defines the left, top and right margins. 
 
$FontSize
Current font size in user unit. 
 
getHtmlDomArray($html)
Returns the HTML DOM array. 
 
$imgscale
Adjusting factor to convert pixels to user units. 
 
Write($h, $txt, $link='', $fill=false, $align='', $ln=false, $stretch=0, $firstline=false, $firstblock=false, $maxh=0, $wadj=0, $margin='')
This method prints text from the current position. 
 
convertHTMLColorToDec($hcolor='#FFFFFF', $defcol=array('R'=>128,'G'=>128,'B'=>128))
Returns an array (RGB or CMYK) from an html color name, or a six-digit (i.e. 
 
const K_SMALL_RATIO
reduction factor for small font 
 
$subject
Document subject. 
 
setImageScale($scale)
Set the adjusting factor to convert pixels to user units. 
 
Link($x, $y, $w, $h, $link, $spaces=0)
Puts a link on a rectangular area of the page. 
 
const K_PATH_URL(isset($_SERVER['HTTP_HOST']) AND(!empty($_SERVER['HTTP_HOST'])))
URL path to tcpdf installation folder (http://localhost/tcpdf/). 
 
$linestyleJoin
PDF string for join value of the last line. 
 
$encoding
Default encoding. 
 
AddLink()
Creates a new internal link and returns its identifier. 
 
write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style='', $align='')
Print a Linear Barcode. 
 
_escapetext($s)
THIS METHOD IS DEPRECATED Format a text string. 
 
getInternalPageNumberAliases($a= '')
Return an array containing variations for the basic page number alias. 
 
$svgclipid
ID of last SVG clipPath. 
 
_enddoc()
Output end of document (EOF). 
 
Close()
Terminates the PDF document. 
 
writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='')
Allows to preserve some HTML formatting (limited support). 
 
Polygon($p, $style='', $line_style=array(), $fill_color=array(), $closed=true)
Draws a polygon. 
 
$linestyleWidth
PDF string for width value of the last line. 
 
$pagelen
Array containing page lengths in bytes. 
 
SetLineStyle($style, $ret=false)
Set line style. 
 
resetHeaderTemplate()
Reset the xobject template used by Header() method. 
 
setSignatureAppearance($x=0, $y=0, $w=0, $h=0, $page=-1)
Set the digital signature appearance (a cliccable rectangle area to get signature properties) ...
 
_putextgstates()
Put extgstates for object transparency. 
 
_getFIXED($str, $offset)
Get FIXED from string (32-bit signed fixed-point number (16.16). 
 
addExtGState($parms)
Add transparency parameters to the current extgstate. 
 
$customlistindent
HTML PARSER: custom indent amount for lists. 
 
_dooverlinew($x, $y, $w)
Overline for rectangular text area. 
 
_dounderlinew($x, $y, $w)
Underline for rectangular text area. 
 
$lasth
Height of last cell printed. 
 
$radio_groups
List of radio group objects IDs. 
 
_putEmbeddedFiles()
Embedd the attached files. 
 
AcceptPageBreak()
Whenever a page break condition is met, the method is called, and the break is issued or not dependin...
 
$colxshift
Array of: X difference between table cell x start and starting page margin, cellspacing, cellpadding. 
 
_UEvalue()
Compute UE value (used for encryption) 
 
$htmlLinkFontStyle
Default font style to add to html links. 
 
GetArrStringWidth($sa, $fontname='', $fontstyle='', $fontsize=0, $getarray=false)
Returns the string length of an array of chars in user unit or an array of characters widths...
 
_RC4($key, $text)
Returns the input text encrypted using RC4 algorithm and the specified key. 
 
Curve($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3, $style='', $line_style=array(), $fill_color=array())
Draws a Bezier curve. 
 
_dochecks()
Check for locale-related bug. 
 
getPageBuffer($page)
Get page buffer content. 
 
$pagegroups
Array that contains the number of pages in each page group. 
 
endLayer()
End the current PDF layer. 
 
_putxobjects()
Output Form XObjects Templates. 
 
setVisibility($v)
Set the visibility of the successive elements. 
 
_putdests()
Insert Named Destinations. 
 
_fixAES256Password($password)
Convert password for AES-256 encryption mode. 
 
$header_font
Default font used on page header. 
 
SetProtection($permissions=array('print', 'modify', 'copy', 'annot-forms', 'fill-forms', 'extract', 'assemble', 'print-high'), $user_pass='', $owner_pass=null, $mode=0, $pubkeys=null)
Set document protection Remark: the protection against modification is for people who have the full A...
 
SVGTransform($tm)
Apply SVG graphic transformation matrix. 
 
$isunicode
Boolean flag set to true when the input text is unicode (require unicode fonts). 
 
$last_enc_key
Last RC4 key encrypted (cached for optimisation). 
 
getPathPaintOperator($style, $default='S')
Get the Path-Painting Operators. 
 
$js_objects
Javascript objects array. 
 
$cell_margin
Array of cell margins ('T' => top, 'R' => right, 'B' => bottom, 'L' => left). 
 
getFontStyle()
Returns the current font style. 
 
$pageopen
Store the fage status (true when opened, false when closed). 
 
_outCurveY($x1, $y1, $x3, $y3)
Append a cubic Bézier curve to the current path. 
 
_puttruetypeunicode($font)
Adds unicode fonts. 
 
getNumLines($txt, $w=0, $reseth=false, $autopadding=true, $cellpadding='', $border=0)
This method return the estimated number of lines for print a simple text string using Multicell() met...
 
replaceMissingChars($text, $font='', $style='', $subs=array())
Replace missing font characters on selected font with specified substitutions. 
 
$HREF
HTML PARSER: array to store current link and rendering styles. 
 
if($rub=fetch_assoc($rub_query)) if(check_if_module_active('url_rewriting')) $class
 
$header_text_color
Color for header text (RGB array). 
 
fitBlock($w, $h, $x, $y, $fitonpage=false)
Set the block dimensions accounting for page breaks and page/column fitting. 
 
getDocCreationTimestamp()
Returns document creation timestamp in seconds. 
 
PageNoFormatted()
Returns the current page number formatted as a string. 
 
setColor($type, $col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='')
Defines the color used by the specified type ('draw', 'fill', 'text'). 
 
_setGDImageTransparency($new_image, $image)
Set the transparency for the given GD image. 
 
getCSSFontSpacing($spacing, $parent=0)
Returns the letter-spacing value from CSS value. 
 
$FontFamily
Current font family. 
 
setLIsymbol($symbol='!')
Set the default bullet to be used as LI bullet symbol. 
 
removeSHY($txt='')
Removes SHY characters from text. 
 
setRasterizeVectorImages($mode)
Enable/disable rasterization of vector images using ImageMagick library. 
 
SetDrawColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='')
Defines the color used for all drawing operations (lines, rectangles and cell borders). 
 
SetDefaultMonospacedFont($font)
Defines the default monospaced font. 
 
$tagvspaces
Array used for custom vertical spaces for HTML tags. 
 
_getBYTE($str, $offset)
Get BYTE from string (8-bit unsigned integer). 
 
$print_header
Boolean flag to print/hide page header. 
 
$signature_data
Digital signature data. 
 
Output($name='doc.pdf', $dest='I')
Send the document to a given destination: string, local file or browser. 
 
getCharBBox($char)
Returns the glyph bounding box of the specified character in the current font in user units...
 
SetAbsXY($x, $y)
Set the absolute X and Y coordinates of the current pointer. 
 
$form_mode
Current method to submit forms. 
 
getCellMargins()
Get the internal Cell margin array. 
 
movePage($frompage, $topage)
Move a page to a previous position. 
 
$bufferlen
Length of the buffer in bytes. 
 
SetY($y, $resetx=true, $rtloff=false)
Moves the current abscissa back to the left margin and sets the ordinate. 
 
_endpage()
Mark end of page. 
 
$pdflayers
Array of PDF layers data. 
 
setTempRTL($mode)
Force temporary RTL language direction. 
 
getPageRegions()
Return an array of no-write page regions. 
 
setPDFVersion($version='1.7')
Set the PDF version (check PDF reference for valid values). 
 
getHTMLUnitToUnits($htmlval, $refsize=1, $defaultunit='px', $points=false)
Convert HTML string containing value and unit of measure to user's units or points. 
 
encodeNameObject($name)
Encode a name object. 
 
_getstream($s, $n=0)
Format output stream (DEPRECATED). 
 
Rotate($angle, $x='', $y='')
Rotate object. 
 
$pages
Array containing pages. 
 
$CurOrientation
Current page orientation (P = Portrait, L = Landscape). 
 
PieSectorXY($xc, $yc, $rx, $ry, $a, $b, $style='FD', $cw=false, $o=0, $nc=2)
Draw the sector of an ellipse. 
 
setHtmlVSpace($tagvs)
Set the vertical spaces for HTML tags. 
 
getFontFamily()
Returns the current font family name. 
 
addHTMLTOC($page='', $toc_name='TOC', $templates=array(), $correct_align=true, $style='', $color=array(0, 0, 0))
Output a Table Of Content Index (TOC) using HTML templates. 
 
GetX()
Returns the relative X value of current position. 
 
getFontFamilyName($fontfamily)
Return normalized font name. 
 
CoonsPatchMesh($x, $y, $w, $h, $col1=array(), $col2=array(), $col3=array(), $col4=array(), $coords=array(0.00, 0.0, 0.33, 0.00, 0.67, 0.00, 1.00, 0.00, 1.00, 0.33, 1.00, 0.67, 1.00, 1.00, 0.67, 1.00, 0.33, 1.00, 0.00, 1.00, 0.00, 0.67, 0.00, 0.33), $coords_min=0, $coords_max=1, $antialias=false)
Paints a coons patch mesh. 
 
setRTL($enable, $resetx=true)
Enable or disable Right-To-Left language mode. 
 
$original_lMargin
Original left margin value. 
 
$spotcolor
Array containing spot color names and values. 
 
$tempfontsize
Temporary font size in points. 
 
_toPNG($image)
Convert the loaded image to a PNG and then return a structure for the PDF creator. 
 
$numfonts
Counts the number of fonts. 
 
replaceBuffer($data)
Replace the buffer content. 
 
$svggradients
Array of SVG gradients. 
 
$spot_colors
Array of Spot colors. 
 
hyphenateText($text, $patterns, $dictionary=array(), $leftmin=1, $rightmin=2, $charmin=1, $charmax=8)
Returns text with soft hyphens. 
 
$webcolor
Array containing HTML color names and values. 
 
_outLine($x, $y)
Append a straight line segment from the current point to the point (x, y). 
 
LinearGradient($x, $y, $w, $h, $col1=array(), $col2=array(), $coords=array(0, 0, 1, 0))
Paints a linear colour gradient. 
 
$bMargin
Page break margin. 
 
$fwPt
Width of page format in points. 
 
$outlines
Outlines for bookmark. 
 
setCellHeightRatio($h)
Set the height of the cell (line height) respect the font height. 
 
$check_page_regions
Boolean value true when page region check is active. 
 
setHeaderTemplateAutoreset($val=true)
Set a flag to automatically reset the xobject template used by Header() method at each page...
 
getCellPaddings()
Get the internal Cell padding array. 
 
$k
Scale factor (number of points in user unit). 
 
RadioButton($name, $w, $prop=array(), $opt=array(), $onvalue='On', $checked=false, $x='', $y='', $js=false)
Creates a RadioButton field. 
 
$epsmarker
String used to mark the beginning and end of EPS image blocks. 
 
$PageAnnots
Array of Annotations in pages. 
 
$w
Current width of page in user unit. 
 
getRawCharWidth($char)
Returns the length of the char in user unit for the current font. 
 
$objcopy
Cloned copy of the current class object. 
 
addTOCPage($orientation='', $format='', $keepmargins=false)
Adds a new TOC (Table Of Content) page to the document. 
 
sortBookmarks()
Sort bookmarks for page and key. 
 
$header_logo_width
Width of header image logo in user units. 
 
$default_table_columns
Default number of columns for html table. 
 
_datestring($n=0, $timestamp=0)
Returns a formatted date for meta information. 
 
_getTTFtableChecksum($table, $length)
Returs the checksum of a TTF table. 
 
getColorStringFromArray($c)
Convert a color array into a string representation. 
 
_putsignature()
Add certification signature (DocMDP or UR3) You can set only one signature type. 
 
MirrorL($angle=0, $x='', $y='')
Reflection against a straight line through point (x, y) with the gradient angle (angle). 
 
setGraphicVars($gvars, $extended=false)
Set graphic variables. 
 
startLayer($name='', $print=true, $view=true)
Start a new pdf layer. 
 
SetCreator($creator)
Defines the creator of the document. 
 
$diffs
Array of encoding differences. 
 
setTextShadow($params=array('enabled'=>false, 'depth_w'=>0, 'depth_h'=>0, 'color'=>false, 'opacity'=>1, 'blend_mode'=>'Normal'))
Set parameters for drop shadow effect for text. 
 
getAutoPageBreak()
Return the auto-page-break mode (true or false). 
 
getBuffer()
Get buffer content. 
 
$alias_tot_pages
String alias for total number of pages. 
 
$buffer
Buffer holding in-memory PDF. 
 
addJavascriptObject($script, $onload=false)
Adds a javascript object and return object ID. 
 
$column_start_page
Starting page for columns. 
 
arrUTF8ToUTF16BE($unicode, $setbom=false)
Converts array of UTF-8 characters to UTF16-BE string. 
 
$file_id
File ID (used on document trailer). 
 
Rect($x, $y, $w, $h, $style='', $border_style=array(), $fill_color=array())
Draws a rectangle. 
 
getStringHeight($w, $txt, $reseth=false, $autopadding=true, $cellpadding='', $border=0)
This method return the estimated height needed for printing a simple text string using the Multicell(...
 
$keywords
Document keywords. 
 
SetX($x, $rtloff=false)
Defines the abscissa of the current position. 
 
$cache_file_length
Array used to store the lengths of cache files. 
 
$LineWidth
Line width in user unit. 
 
StartTransform()
Starts a 2D tranformation saving current graphic state. 
 
$PageBreakTrigger
Threshold used to trigger page breaks. 
 
$FontAscent
Current font ascent (distance between font top and baseline). 
 
$pageobjects
Array of object IDs for each page. 
 
GetNumChars($s)
Returns the numbero of characters in a string. 
 
$thead
Table header content to be repeated on each new page. 
 
$CurrentFont
Current font info. 
 
_putbookmarks()
Create a bookmark PDF string. 
 
getAbsFontMeasure($s)
Convert a relative font measure into absolute value. 
 
$pdfproducer
Set the document producer metadata. 
 
SetTitle($title)
Defines the title of the document. 
 
SetTopMargin($margin)
Defines the top margin. 
 
$numpages
Counts the number of pages. 
 
getFontSize()
Returns the current font size. 
 
getAliasRightShift()
Returns the string alias used right align page numbers. 
 
getRandomSeed($seed='')
Returns a string containing random data to be used as a seed for encryption methods. 
 
getVectorsAngle($x1, $y1, $x2, $y2)
Returns the angle in radiants between two vectors. 
 
checkPageRegions($h, $x, $y)
Check page for no-write regions and adapt current coordinates and page margins if necessary...
 
_putcidfont0($font)
Output CID-0 fonts. 
 
const K_PATH_IMAGES
images directory 
 
_AES($key, $text)
Returns the input text exrypted using AES algorithm and the specified key. 
 
startPage($orientation='', $format='', $tocpage=false)
Starts a new page to the document. 
 
setImageBuffer($image, $data)
Set image buffer content. 
 
_md5_16($str)
Encrypts a string using MD5 and returns it's value as a binary string. 
 
$offsets
Array of object offsets. 
 
MirrorH($x='')
Horizontal Mirroring. 
 
Circle($x0, $y0, $r, $angstr=0, $angend=360, $style='', $line_style=array(), $fill_color=array(), $nc=2)
Draws a circle. 
 
convertSVGtMatrix($tm)
Convert SVG transformation matrix to PDF. 
 
SetLeftMargin($margin)
Defines the left margin. 
 
setBookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0, 0, 0))
Adds a bookmark - alias for Bookmark(). 
 
$cell_padding
Array of cell internal paddings ('T' => top, 'R' => right, 'B' => bottom, 'L' => left). 
 
objclone($object)
Creates a copy of a class object. 
 
ScaleXY($s, $x='', $y='')
Vertical and horizontal proportional Scaling. 
 
setSVGStyles($svgstyle, $prevsvgstyle, $x=0, $y=0, $w=1, $h=1, $clip_function='', $clip_params=array())
Apply the requested SVG styles (*** TO BE COMPLETED ***) 
 
$bordermrk
Array used to store positions inside the pages buffer (keys are the page numbers). 
 
stringRightTrim($str, $replace='')
Right trim the input string. 
 
$signature_appearance
Data for digital signature appearance. 
 
AddFont($family, $style='', $fontfile='', $subset='default')
Imports a TrueType, Type1, core, or CID0 font and makes it available. 
 
$form_obj_id
List of form annotations IDs. 
 
$alias_right_shift
String alias for right shift compensation used to correctly align page numbers on the right...
 
const K_CELL_HEIGHT_RATIO
height of cell respect font height 
 
$bgcolor
Current background color. 
 
$alias_group_tot_pages
String alias for total number of pages in a single group. 
 
$tocpage
Boolean flag true when we are on TOC (Table Of Content) page. 
 
getSpaceString()
Returns the string used to find spaces. 
 
$img_rb_x
The right-bottom (or left-bottom for RTL) corner X coordinate of last inserted image. 
 
PieSector($xc, $yc, $r, $a, $b, $style='FD', $cw=true, $o=90)
Draw the sector of a circle. 
 
setStartingPageNumber($num=1)
Set the starting page number. 
 
$svgstyles
Array of SVG properties. 
 
const K_PATH_CACHE
cache directory for temporary files (full path) 
 
$encmaps
Object containing font encoding maps. 
 
lastPage($resetmargins=false)
Reset pointer to the last document page. 
 
_escape($s)
Add "\" before "\", "(" and ")". 
 
getScaleFactor()
Returns the scale factor (number of points in user unit). 
 
setPageFormat($format, $orientation='P')
Change the format of the current page. 
 
setPageBuffer($page, $data, $append=false)
Set page buffer content. 
 
$start_transaction_page
Store page number when startTransaction() is called. 
 
GetLineWidth()
Returns the current the line width. 
 
$LayoutMode
Layout display mode. 
 
setPrintFooter($val=true)
Set a flag to print page footer. 
 
Skew($angle_x, $angle_y, $x='', $y='')
Skew. 
 
$svggradientid
ID of last SVG gradient. 
 
UTF8ArrToLatin1($unicode)
Converts UTF-8 characters array to array of Latin1 characters  
 
replaceRightShiftPageNumAliases($page, $aliases, $diff)
Replace right shift page number aliases with spaces to correct right alignment. 
 
IncludeJS($script)
Adds a javascript. 
 
_objectkey($n)
Compute encryption key depending on object number where the encrypted data is stored. 
 
addTTFfont($fontfile, $fonttype='', $enc='', $flags=32, $outpath='', $platid=3, $encid=1, $addcbbox=false)
Convert and add the selected TrueType or Type1 font to the fonts folder (that must be writeable)...
 
getImageRBX()
Return the right-bottom (or left-bottom for RTL) corner X coordinate of last inserted image...
 
ImageEps($file, $x='', $y='', $w=0, $h=0, $link='', $useBoundingBox=true, $align='', $palign='', $border=0, $fitonpage=false, $fixoutvals=false)
Embed vector-based Adobe Illustrator (AI) or AI-compatible EPS files. 
 
convertStringToHexString($s)
Convert string to hexadecimal string (byte string) 
 
$intmrk
Array used to store positions inside the pages buffer (keys are the page numbers). 
 
$page_boxes
Define the page boundaries boxes to be set on document. 
 
$custom_xmp
Custom XMP data. 
 
getTimestamp($date)
Returns timestamp in seconds from formatted date-time. 
 
SetAbsY($y)
Set the absolute Y coordinate of the current pointer. 
 
$newline
Boolean flag to indicate if a new line is created. 
 
$currpagegroup
Current page group number. 
 
extractCSSproperties($cssdata)
Extracts the CSS properties from a CSS string. 
 
const PDF_FONT_NAME_MAIN
default main font name 
 
SetFillColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='')
Defines the color used for all filling operations (filled rectangles and cell backgrounds). 
 
$y
Current vertical position in user unit for cell positioning. 
 
$header_line_color
Color for header line (RGB array). 
 
getTextShadow()
Return the text shadow parameters array. 
 
_destroy($destroyall=false, $preserve_objcopy=false)
Unset all class variables except the following critical variables. 
 
addHTMLVertSpace($hbz=0, $hb=0, $cell=false, $firsttag=false, $lasttag=false)
Add vertical spaces if needed. 
 
$font_obj_ids
Store the font object IDs. 
 
$openMarkedContent
Boolean flag to indicate if marked-content sequence is open. 
 
getRTL()
Return the RTL status. 
 
SetAuthor($author)
Defines the author of the document. 
 
$pdfa_mode
If true set the document to PDF/A mode. 
 
$page_regions
Array of no-write regions. 
 
$radiobutton_groups
List of radio buttons parent objects. 
 
const K_TCPDF_CALLS_IN_HTML
if true allows to call TCPDF methods using HTML syntax IMPORTANT: For security reason, disable this feature if you are printing user HTML content. 
 
rfread($handle, $length)
Binary-safe and URL-safe file read. 
 
_OEvalue()
Compute OE value (used for encryption) 
 
const K_PATH_FONTS
path for PDF fonts use K_PATH_MAIN. 
 
This is a PHP class containing UnicOde data for TCPDF library. 
 
$doc_creation_timestamp
Document creation date-time. 
 
$enc_padding
Encryption padding string. 
 
RegularPolygon($x0, $y0, $r, $ns, $angle=0, $draw_circle=false, $style='', $line_style=array(), $fill_color=array(), $circle_style='', $circle_outLine_style=array(), $circle_fill_color=array())
Draws a regular polygon. 
 
RoundedRectXY($x, $y, $w, $h, $rx, $ry, $round_corner='1111', $style='', $border_style=array(), $fill_color=array())
Draws a rounded rectangle. 
 
setEqualColumns($numcols=0, $width=0, $y='')
Set multiple columns of the same size. 
 
_putannotsrefs($n)
Output references to page annotations. 
 
Cell($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')
Prints a cell (rectangular area) with optional borders, background color and character string...
 
set_mqr($mqr)
Sets the current active configuration setting of magic_quotes_runtime (if the set_magic_quotes_runtim...
 
getCSSMargin($cssmargin, $width=0)
Get the internal Cell margin from CSS attribute. 
 
getDocModificationTimestamp()
Returns document modification timestamp in seconds. 
 
$transfmatrix
Array of transformation matrix. 
 
$fontkeys
Store the font keys. 
 
$gradients
Array for storing gradient information. 
 
getUserPermissionCode($permissions, $mode=0)
Return the premission code used on encryption (P value). 
 
Text($x, $y, $txt, $fstroke=false, $fclip=false, $ffill=true, $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M', $rtloff=false)
Prints a text cell at the specified position. 
 
setFontBuffer($font, $data)
Set font buffer content. 
 
Clip($x, $y, $w, $h)
Set a rectangular clipping area. 
 
getPage()
Get current document page number. 
 
$img_rb_y
The right-bottom corner Y coordinate of last inserted image. 
 
GetCharWidth($char, $notlast=true)
Returns the length of the char in user unit for the current font considering current stretching and s...
 
setContentMark($page=0)
Set start-writing mark on selected page. 
 
SkewY($angle_y, $x='', $y='')
Skew vertically. 
 
$empty_signature_appearance
Array of empty digital signature appearances. 
 
$dests
A dictionary of names and corresponding destinations (Dests key on document Catalog). 
 
$svgtextmode
SVG text properties. 
 
setFontSubBuffer($font, $key, $data)
Set font buffer content. 
 
const K_PATH_MAIN(substr($k_path_main,-1)!= '/')
Installation path (/var/www/tcpdf/). 
 
$sig_annot_ref
Placemark used during digital signature process. 
 
setBuffer($data)
Set buffer content (always append data). 
 
$imagekeys
Store the image keys. 
 
setUserRights($enable=true, $document='/FullSave', $annots='/Create/Delete/Modify/Copy/Import/Export', $form='/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate', $signature='/Modify', $ef='/Create/Delete/Modify/Import', $formex='')
Set User's Rights for PDF Reader WARNING: This is experimental and currently do not work...
 
setHeaderData($ln='', $lw=0, $ht='', $hs='', $tc=array(0, 0, 0), $lc=array(0, 0, 0))
Set header data. 
 
stringLeftTrim($str, $replace='')
Left trim the input string. 
 
$strokecolor
Current stroke color. 
 
PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www...
 
$encryptdata
Array containing encryption settings. 
 
setHeaderMargin($hm=10)
Set header margin. 
 
$tcpdflink
If true print TCPDF meta link. 
 
_outRect($x, $y, $w, $h, $op)
Append a rectangle to the current path as a complete subpath, with lower-left corner (x...
 
StarPolygon($x0, $y0, $r, $nv, $ng, $angle=0, $draw_circle=false, $style='', $line_style=array(), $fill_color=array(), $circle_style='', $circle_outLine_style=array(), $circle_fill_color=array())
Draws a star polygon. 
 
setPageBoxes($page, $type, $llx, $lly, $urx, $ury, $points=false)
Set page boundaries. 
 
_getxobjectdict()
Return XObjects Dictionary. 
 
_outCurveV($x2, $y2, $x3, $y3)
Append a cubic Bézier curve to the current path. 
 
$txtshadow
Text shadow data array. 
 
setExtraXMP($xmp)
Set additional XMP data to be added on the default XMP data just before the end of "x:xmpmeta" tag...
 
Footer()
This method is used to render the page footer. 
 
$footer_margin
Minimum distance between footer and bottom page margin. 
 
$extgstates
Array of transparency objects and parameters. 
 
UTF8ToUTF16BE($str, $setbom=false)
Converts UTF-8 strings to UTF16-BE. 
 
getBarcode()
Get current barcode. 
 
getImageFileType($imgfile, $iminfo=array())
Return the image type given the file name or array returned by getimagesize() function. 
 
_getfontpath()
Return fonts path. 
 
adjustCellPadding($brd=0)
Adjust the internal Cell padding array to take account of the line width. 
 
_putinfo()
Adds some Metadata information (Document Information Dictionary) (see Chapter 14.3.3 Document Information Dictionary of PDF32000_2008.pdf Reference) 
 
$fonts
Array of used fonts. 
 
$compress
Compression flag. 
 
fixHTMLCode($html, $default_css='', $tagvs='', $tidy_options='')
Cleanup HTML code (requires HTML Tidy library). 
 
SetFont($family, $style='', $size=null, $fontfile='', $subset='default', $out=true)
Sets the font used to print character strings. 
 
TranslateY($t_y)
Translate graphic object vertically. 
 
getEncPermissionsString($protection)
Convert encryption P value to a string of bytes, low-order byte first. 
 
MirrorV($y='')
Verical Mirroring. 
 
stringTrim($str, $replace='')
Trim the input string. 
 
$diskcache
If true enables disk caching. 
 
getFontDescent($font, $style='', $size=0)
Return the font descent value. 
 
deletePage($page)
Remove the specified page. 
 
endSVGElementHandler($parser, $name)
Sets the closing SVG element handler function for the XML parser. 
 
utf8StrRev($str, $setbom=false, $forcertl=false)
Reverse the RLT substrings using the Bidirectional Algorithm (http://unicode.org/reports/tr9/). 
 
$form_action
Current form action (used during XHTML rendering). 
 
$font_stretching
Percentage of character stretching. 
 
setFooterMargin($fm=10)
Set footer margin. 
 
$FontFiles
Array of font files. 
 
SetTextColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='')
Defines the color used for text. 
 
$svgcliptm
Array of SVG clipPath tranformation matrix. 
 
$listordered
HTML PARSER: array of boolean values, true in case of ordered list (OL), false otherwise. 
 
setPrintHeader($val=true)
Set a flag to print page header. 
 
$transfmrk
Array used to store positions of graphics transformation blocks inside the page buffer. 
 
$sign
Boolean flag to enable document digital signature. 
 
setFormDefaultProp($prop=array())
Set default properties for form fields. 
 
getHeaderMargin()
Returns header margin in user units. 
 
getCSSBorderWidth($width)
Returns the border width from CSS property. 
 
$print_footer
Boolean flag to print/hide page footer. 
 
getFooterFont()
Get Footer font. 
 
setPage($pnum, $resetmargins=false)
Move pointer at the specified document page and update page dimensions. 
 
utf8Bidi($ta, $str='', $forcertl=false)
Reverse the RLT substrings using the Bidirectional Algorithm (http://unicode.org/reports/tr9/). 
 
setLastH($h)
Set the last cell height. 
 
_putstream($s, $n=0)
Output a stream (DEPRECATED). 
 
_putAPXObject($w=0, $h=0, $stream='')
Put appearance streams XObject used to define annotation's appearance states. 
 
$sig_obj_id
Digital signature object ID. 
 
$FontStyle
Current font style. 
 
openHTMLTagHandler($dom, $key, $cell)
Process opening tags. 
 
getHeaderData()
Returns header data: 
 
getCSSPadding($csspadding, $width=0)
Get the internal Cell padding from CSS attribute. 
 
$cache_maxsize_UTF8StringToArray
Maximum size of cache array used for UTF8StringToArray() method. 
 
startSVGElementHandler($parser, $name, $attribs, $ctm=array())
Sets the opening SVG element handler function for the XML parser. 
 
$linethrough
line trough state 
 
_putcatalog()
Output Catalog. 
 
Polycurve($x0, $y0, $segments, $style='', $line_style=array(), $fill_color=array())
Draws a poly-Bezier curve. 
 
$embeddedfiles
Array of files to embedd. 
 
_putheader()
Output PDF File Header (7.5.2). 
 
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
 
$ur
Array with additional document-wide usage rights for the document. 
 
getFormattedDate($time)
Returns a formatted date-time. 
 
resetLastH()
Reset the last cell height. 
 
UniArrSubString($uniarr, $start='', $end='')
Extract a slice of the $uniarr array and return it as string. 
 
$overprint
Overprint mode array. 
 
$links
Array of internal links. 
 
setColumnsArray($columns)
Set columns array. 
 
$default_monospaced_font
Default monospace font. 
 
Button($name, $w, $h, $caption, $action, $prop=array(), $opt=array(), $x='', $y='', $js=false)
Creates a button field. 
 
$textstrokewidth
Text stroke width in doc units. 
 
$header_xobjid
ID of the stored default header template (-1 = not set). 
 
getNumPages()
Get the total number of insered pages. 
 
_getUSHORT($str, $offset)
Get USHORT from string (Big Endian 16-bit unsigned integer). 
 
TextField($name, $w, $h, $prop=array(), $opt=array(), $x='', $y='', $js=false)
Creates a text field. 
 
$PageMode
A name object specifying how the document should be displayed when opened. 
 
getNumberOfColumns()
Return the current number of columns. 
 
isValidCSSSelectorForTag($dom, $key, $selector)
Returns true if the CSS selector is valid for the selected HTML tag. 
 
Open()
This method begins the generation of the PDF document. 
 
removePageRegion($key)
Remove a single no-write region. 
 
$creator
Document creator. 
 
ScaleY($s_y, $x='', $y='')
Vertical Scaling. 
 
getPageSizeFromFormat($format)
Get page dimensions from format name. 
 
$svgclipmode
Boolean value true when in SVG clipPath tag. 
 
_dounderline($x, $y, $txt)
Underline text. 
 
_putjavascript()
Create a javascript PDF string. 
 
selectColumn($col='')
Set position at a given column. 
 
$annotation_fonts
List of fonts used on form fields (fontname => fontkey). 
 
$endlinex
End position of the latest inserted line. 
 
$footer_font
Default font used on page footer. 
 
_dolinethrough($x, $y, $txt)
Line through text. 
 
$svgclippaths
Array of SVG clipPath commands. 
 
setLanguageArray($language)
Set language array. 
 
$cntmrk
Array used to store content positions inside the pages buffer (keys are the page numbers). 
 
startPageGroup($page= '')
Create a new page group. 
 
$h
Current height of page in user unit. 
 
updateCIDtoGIDmap($map, $cid, $gid)
Update the CIDToGIDMap string with a new value. 
 
_newobj()
Begin a new object and return the object number. 
 
setPageMark()
Set start-writing mark on current page stream used to put borders and fills. 
 
AliasNumPage($s='')
This method is DEPRECATED and doesn't have any effect. 
 
setOverprint($stroking=true, $nonstroking='', $mode=0)
Set overprint mode for stroking (OP) and non-stroking (op) painting operations. 
 
ListBox($name, $w, $h, $values, $prop=array(), $opt=array(), $x='', $y='', $js=false)
Creates a List-box field. 
 
getBorderMode($brd, $position='start')
Get the border mode accounting for multicell position (opens bottom side of multicell crossing pages)...
 
_outellipticalarc($xc, $yc, $rx, $ry, $xang=0, $angs=0, $angf=360, $pie=false, $nc=2, $startpoint=true, $ccw=true, $svg=false)
Append an elliptical arc to the current path. 
 
Ln($h='', $cell=false)
Performs a line break. 
 
if(empty($GLOBALS['site_parameters']['unsubscribe_order_process']))
 
SetCompression($compress=true)
Activates or deactivates page compression. 
 
write2DBarcode($code, $type, $x='', $y='', $w='', $h='', $style='', $align='', $distort=false)
Print 2D Barcode. 
 
getImageBuffer($image)
Get image buffer content. 
 
Image($file, $x='', $y='', $w=0, $h=0, $type='', $link='', $align='', $resize=false, $dpi=300, $palign='', $ismask=false, $imgmask=false, $border=0, $fitbox=false, $hidden=false, $fitonpage=false, $alt=false, $altimgs=array())
Puts an image in the page. 
 
$footerpos
Array used to store footer positions of each page. 
 
_escapeXML($str)
Escape some special characters (< > &) for XML output. 
 
_generateencryptionkey()
Compute encryption key. 
 
getRemainingWidth()
Returns the remaining width between the current position and margins. 
 
$header_xobj_autoreset
If true reset the Header Xobject template at each page. 
 
AddPage($orientation='', $format='', $keepmargins=false, $tocpage=false)
Adds a new page to the document. 
 
$wPt
Current width of page in points. 
 
_putfontwidths($font, $cidoffset=0)
Outputs font widths. 
 
setExtGState($gs)
Add an extgstate. 
 
$cell_height_ratio
Default cell height ratio. 
 
$overline
Overlining flag. 
 
$premode
Boolean flag to indicate if we are inside a PRE tag. 
 
setColorArray($type, $color, $ret=false)
Set the color array for the specified type ('draw', 'fill', 'text'). 
 
$columns
Array of column measures (width, space, starting Y position). 
 
_putannotsobjs()
Output annotations objects for all pages. 
 
PageNo()
Returns the current page number. 
 
const K_THAI_TOPCHARS
set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language...
 
$dpi
DPI (Dot Per Inch) Document Resolution (do not change). 
 
$fontlist
List of available fonts on filesystem. 
 
__destruct()
Default destructor. 
 
$rtl
Boolean flag to indicate if the document language is Right-To-Left. 
 
$inxobj
Boolean value true when we are inside an XObject. 
 
$header_title
Title to be printed on default page header. 
 
RadialGradient($x, $y, $w, $h, $col1=array(), $col2=array(), $coords=array(0.5, 0.5, 0.5, 0.5, 1))
Paints a radial colour gradient. 
 
$footerlen
Array used to store footer length of each page. 
 
$newpagegroup
Array of page numbers were a new page group was started (the page numbers are the keys of the array)...
 
inPageBody()
Check if we are on the page body (excluding page header and footer). 
 
$encrypted
IBoolean flag indicating whether document is protected. 
 
SetAutoPageBreak($auto, $margin=0)
Enables or disables the automatic page breaking mode. 
 
getImageRBY()
Return the right-bottom (or left-bottom for RTL) corner Y coordinate of last inserted image...
 
sendOutputData($data, $length)
Ouput input data and compress it if possible. 
 
writeBarcode($x, $y, $w, $h, $type, $style, $font, $xres, $code)
This function is DEPRECATED, please use the new write1DBarcode() function. 
 
SkewX($angle_x, $x='', $y='')
Skew horizontally. 
 
$svginheritprop
Array of hinheritable SVG properties. 
 
registrationMark($x, $y, $r, $double=false, $cola=array(0, 0, 0), $colb=array(255, 255, 255))
Paints a registration mark. 
 
$barcode
Barcode to print on page footer (only if set). 
 
$linestyleDash
PDF string for dash value of the last line. 
 
getCSSFontStretching($stretch, $parent=100)
Returns the percentage of font stretching from CSS value. 
 
$htmlvspace
Count the latest inserted vertical spaces on HTML. 
 
setFooterFont($font)
Set footer font. 
 
$feps
Epsilon value used for float calculations. 
 
addEmptySignatureAppearance($x=0, $y=0, $w=0, $h=0, $page=-1)
Add an empty digital signature appearance (a cliccable rectangle area to get signature properties) ...
 
_getFWORD($str, $offset)
Get FWORD from string (Big Endian 16-bit signed integer). 
 
UTF8StringToArray($str)
Converts UTF-8 strings to codepoints array. 
 
getAlpha()
Get the alpha mode array (CA, ca, BM, AIS). 
 
getGroupPageNoFormatted()
Returns the current group page number formatted as a string. 
 
getDestination()
Return the Named Destination array. 
 
_dooverline($x, $y, $txt)
Overline text. 
 
SetTextColorArray($color, $ret=false)
Defines the color used for text. 
 
$listindentlevel
HTML PARSER: current list indententation level. 
 
putHtmlListBullet($listdepth, $listtype='', $size=10)
Output an HTML list bullet or ordered item symbol. 
 
writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=false, $reseth=true, $align='', $autopadding=true)
Prints a cell (rectangular area) with optional borders, background color and html text string...
 
readDiskCache($filename)
Read data from a temporary file on filesystem. 
 
intToRoman($number)
Returns the Roman representation of an integer number. 
 
$htmlLinkColorArray
Default color for html links. 
 
$state
Current document state. 
 
endTemplate()
End the current XObject Template started with startTemplate() and restore the previous graphic state...
 
_beginpage($orientation='', $format='')
Initialize a new page. 
 
Header()
This method is used to render the page header. 
 
ImagePngAlpha($file, $x, $y, $wpx, $hpx, $w, $h, $type, $link, $align, $resize, $dpi, $palign, $filehash='')
Extract info from a PNG image with alpha channel using the GD library. 
 
$signature_max_length
Digital signature max length. 
 
UTF8ToLatin1($str)
Converts UTF-8 strings to Latin1 when using the standard 14 core fonts. 
 
_getannotsrefs($n)
Get references to page annotations. 
 
getFontSpacing()
Get the amount to increase or decrease the space between characters in a text. 
 
startTemplate($w=0, $h=0, $group=false)
Start a new XObject Template. 
 
getPDFData()
Returns the PDF data. 
 
_out($s)
Output a string to the document. 
 
setTextRenderingMode($stroke=0, $fill=true, $clip=false)
Set Text rendering mode. 
 
AliasNbPages($s='')
This method is DEPRECATED and doesn't have any effect. 
 
GetY()
Returns the ordinate of the current position. 
 
$listindent
HTML PARSER: indent amount for lists. 
 
unhtmlentities($text_to_convert)
Reverse function for htmlentities. 
 
getAnnotOptFromJSProp($prop)
Convert JavaScript form fields properties array to Annotation Properties array. 
 
$GLOBALS['page_columns_count']
 
GetStringWidth($s, $fontname='', $fontstyle='', $fontsize=0, $getarray=false)
Returns the length of a string in user unit. 
 
_Ovalue()
Compute O value (used for encryption) 
 
getFontBBox()
Returns the bounding box of the current font in user units. 
 
$viewer_preferences
PDF viewer preferences. 
 
$lisymbol
Symbol used for HTML unordered list items. 
 
$page_obj_id
ID of page objects. 
 
endTOCPage()
Terminate the current TOC (Table Of Content) page. 
 
$force_srgb
If true force sRGB color profile for all document. 
 
replaceChar($oldchar, $newchar)
Replace a char if is defined on the current font. 
 
Bookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0, 0, 0), $x=-1)
Adds a bookmark. 
 
$alias_num_page
String alias for page number. 
 
getBreakMargin($pagenum='')
Returns the page break margin. 
 
setHeader()
This method is used to render the page header. 
 
getSVGTransformMatrix($attribute)
Get the tranformation matrix from SVG transform attribute. 
 
$cache_UTF8StringToArray
Cache array for UTF8StringToArray() method. 
 
getPageNumGroupAlias()
Return the alias for the page number on the current page group. 
 
getCSSBorderMargin($cssbspace, $width=0)
Get the border-spacing from CSS attribute. 
 
$header_logo
Header image logo. 
 
Translate($t_x, $t_y)
Translate graphic object horizontally and vertically. 
 
getFontBuffer($font)
Get font buffer content. 
 
SetFillColorArray($color, $ret=false)
Defines the color used for all filling operations (filled rectangles and cell backgrounds). 
 
_getTrueTypeFontSubset($font, $subsetchars)
Returns a subset of the TrueType font data without the unused glyphs. 
 
$footer_line_color
Color for footer line (RGB array). 
 
_getULONG($str, $offset)
Get ULONG from string (Big Endian 32-bit unsigned integer). 
 
_putresources()
Output Resources. 
 
UTF8ArrSubString($strarr, $start='', $end='')
Extract a slice of the $strarr array and return it as string. 
 
SetLink($link, $y=0, $page=-1)
Defines the page and position a link points to. 
 
$num_columns
Number of colums. 
 
GetAbsX()
Returns the absolute X value of current position. 
 
setSpotColor($type, $name, $tint=100)
Set the spot color for the specified type ('draw', 'fill', 'text'). 
 
setBarcode($bc='')
Set document barcode. 
 
SetBooklet($booklet=true, $inner=-1, $outer=-1)
Set the booklet mode for double-sided pages. 
 
$font_spacing
Increases or decreases the space between characters in a text by the specified amount (tracking)...
 
formatPageNumber($num)
Format the page numbers. 
 
$listcount
HTML PARSER: array count list items on nested lists. 
 
SetCellPadding($pad)
Set the same internal Cell padding for top, right, bottom, left-. 
 
_putviewerpreferences()
Output viewer preferences. 
 
cropMark($x, $y, $w, $h, $type='T, R, B, L', $color=array(0, 0, 0))
Paints crop marks. 
 
drawHTMLTagBorder($tag, $xmax)
Draw an HTML block border and fill. 
 
$opencell
Boolean flag to indicate if the border of the cell sides that cross the page should be removed...
 
ScaleX($s_x, $x='', $y='')
Horizontal Scaling. 
 
colorRegistrationBar($x, $y, $w, $h, $transition=true, $vertical=false, $colors='A, R, G, B, C, M, Y, K')
Paints color transition registration bars. 
 
Scale($s_x, $s_y, $x='', $y='')
Vertical and horizontal non-proportional Scaling. 
 
Error($msg)
This method is automatically called in case of fatal error; it simply outputs the message and halts t...
 
getTransformationMatrixProduct($ta, $tb)
Get the product of two SVG tranformation matrices. 
 
getCellHeightRatio()
return the height of cell repect font height. 
 
$theadMargins
Margins used for table header. 
 
isCharDefined($char, $font='', $style='')
Return true in the character is present in the specified font. 
 
$FontSizePt
Current font size in points. 
 
MirrorP($x='', $y='')
Point reflection mirroring. 
 
getHyphenPatternsFromTEX($file)
Returns an array of hyphenation patterns. 
 
$header_margin
Minimum distance between header and top page margin. 
 
$internal_encoding
PHP internal encoding. 
 
getAliasNbPages()
Returns the string alias used for the total number of pages. 
 
$svgdir
Directory used for the last SVG image. 
 
SetFontSize($size, $out=true)
Defines the size of the current font. 
 
setFontSubsetting($enable=true)
Enable or disable default option for font subsetting. 
 
SetRightMargin($margin)
Defines the right margin. 
 
$alias_group_num_page
String alias for group page number. 
 
addTOC($page='', $numbersfont='', $filler='.', $toc_name='TOC', $style='', $color=array(0, 0, 0))
Output a Table of Content Index (TOC). 
 
setViewerPreferences($preferences)
Set the viewer preferences dictionary controlling the way the document is to be presented on the scre...
 
$lispacer
Spacer string for LI tags. 
 
_getrawstream($s, $n=0)
get raw output stream. 
 
$TextColor
Commands for text color. 
 
$FillColor
Commands for filling color. 
 
$font_subsetting
Boolean flag: if true enables font subsetting by default. 
 
StopTransform()
Stops a 2D tranformation restoring previous graphic state. 
 
RoundedRect($x, $y, $w, $h, $r, $round_corner='1111', $style='', $border_style=array(), $fill_color=array())
Draws a rounded rectangle. 
 
$n_dests
Object ID for Named Destinations. 
 
SetDocInfoUnicode($unicode=true)
Turn on/off Unicode mode for document information dictionary (meta tags). 
 
getTCPDFVersion()
Return the current TCPDF version. 
 
setFontSpacing($spacing=0)
Set the amount to increase or decrease the space between characters in a text. 
 
$re_spaces
Regular expression used to find blank characters (required for word-wrapping). 
 
_putpages()
Output pages (and replace page number aliases). 
 
_putresourcedict()
Output Resources Dictionary. 
 
setPageRegions($regions=array())
Set no-write regions on page. 
 
$pdfunit
Default unit of measure for document. 
 
$x
Current horizontal position in user unit for cell positioning. 
 
$original_rMargin
Original right margin value. 
 
UTF8ArrayToUniArray($ta)
Convert an array of UTF8 values to array of unicode characters. 
 
_outPoint($x, $y)
Begin a new subpath by moving the current point to coordinates (x, y), omitting any connecting line s...
 
swapMargins($reverse=true)
Swap the left and right margins. 
 
$maxselcol
Maximum page and column selected. 
 
getOriginalMargins()
Returns an array containing original margins: 
 
$textrendermode
Text rendering mode: 0 = Fill text; 1 = Stroke text; 2 = Fill, then stroke text; 3 = Neither fill nor...
 
resetColumns()
Remove columns and reset page margins. 
 
$jpeg_quality
Set the default JPEG compression quality (1-100). 
 
getPageWidth($pagenum='')
Returns the page width in units. 
 
pixelsToUnits($px)
Converts pixels to User's Units. 
 
$ColorFlag
Indicates whether fill and text colors are different. 
 
revstrpos($haystack, $needle, $offset=0)
Find position of last occurrence of a substring in a string. 
 
$textindent
Text indentation value (used for text-indent CSS attribute). 
 
setPageBoxTypes($boxes)
Set page boxes to be included on page descriptions. 
 
$form_enctype
Current form encryption type (used during XHTML rendering). 
 
PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www.tcpdf.org). 
 
$docinfounicode
If true set the document information dictionary in Unicode. 
 
$tmprtl
Boolean flag used to force RTL or LTR string direction. 
 
$linestyleCap
PDF string for CAP value of the last line. 
 
setDocCreationTimestamp($time)
Set the document creation timestamp. 
 
setPageUnit($unit)
Set the units of measure for the document. 
 
getFontSubsetting()
Return the default option for font subsetting. 
 
$ZoomMode
Zoom display mode. 
 
$svgunit
Deafult unit of measure for SVG. 
 
$DrawColor
Commands for drawing color. 
 
Line($x1, $y1, $x2, $y2, $style=array())
Draws a line between two points. 
 
setTableHeader()
This method is used to render the table header on new page (if any). 
 
$cached_files
Array of cached files. 
 
checkPageBreak($h=0, $y='', $addpage=true)
Add page if needed. 
 
getColumn()
Return the current column number. 
 
getFormDefaultProp()
Return the default properties for form fields. 
 
isUnicodeFont()
Return true if the current font is unicode type. 
 
$CoreFonts
Array of standard font names. 
 
printTemplate($id, $x='', $y='', $w=0, $h=0, $align='', $palign='', $fitonpage=false)
Print an XObject Template. 
 
$xobjects
Array of XObjects. 
 
getGDgamma($c)
Get the GD-corrected PNG gamma value from alpha color. 
 
getFontSizePt()
Returns the current font size in points unit. 
 
isRTLTextDir()
Return the current temporary RTL status. 
 
setDefaultTableColumns($cols=4)
Set the default number of columns in a row for HTML tables. 
 
SetXY($x, $y, $rtloff=false)
Defines the abscissa and ordinate of the current position. 
 
_getUFWORD($str, $offset)
Get UFWORD from string (Big Endian 16-bit unsigned integer). 
 
SetTextSpotColor($name, $tint=100)
Defines the spot color used for text. 
 
$emptypagemrk
Array used to store page positions to track empty pages (keys are the page numbers). 
 
$cache_size_UTF8StringToArray
Current size of cache array used for UTF8StringToArray() method. 
 
setImageSubBuffer($image, $key, $data)
Set image buffer content for a specified sub-key. 
 
$inthead
True when we are printing the thead section on a new page. 
 
addPageRegion($region)
Add a single no-write region on selected page. 
 
$doc_modification_timestamp
Document modification date-time. 
 
$images
Array of used images. 
 
utf8StrArrRev($arr, $str='', $setbom=false, $forcertl=false)
Reverse the RLT substrings array using the Bidirectional Algorithm (http://unicode.org/reports/tr9/). 
 
$svgdefsmode
Boolean value true when in SVG defs group. 
 
Ellipse($x0, $y0, $rx, $ry='', $angle=0, $astart=0, $afinish=360, $style='', $line_style=array(), $fill_color=array(), $nc=2)
Draws an ellipse. 
 
endPage($tocpage=false)
Terminate the current page. 
 
getCSSdataArray($dom, $key, $css)
Returns the styles array that apply for the selected HTML tag. 
 
getGraphicVars()
Returns current graphic variables as array. 
 
_putXMP()
Put XMP data object and return ID. 
 
setAlpha($stroking=1, $bm='Normal', $nonstroking='', $ais=false)
Set alpha for stroking (CA) and non-stroking (ca) operations. 
 
$FontDescent
Current font descent (distance between font bottom and baseline). 
 
MultiCell($w, $h, $txt, $border=0, $align='J', $fill=false, $ln=1, $x='', $y='', $reseth=true, $stretch=0, $ishtml=false, $autopadding=true, $maxh=0, $valign='T', $fitcell=false)
This method allows printing text with line breaks. 
 
swapPageBoxCoordinates($page)
Swap X and Y coordinates of page boxes (change page boxes orientation). 
 
getBorderStartPosition()
Return the starting coordinates to draw an html border. 
 
hyphenateWord($word, $patterns, $dictionary=array(), $leftmin=1, $rightmin=2, $charmin=1, $charmax=8)
Returns an array of chars containing soft hyphens. 
 
_JScolor($color)
Convert color to javascript color. 
 
$InHeader
Flag set when processing page header. 
 
rollbackTransaction($self=false)
This method allows to undo the latest transaction by returning the latest saved TCPDF object with sta...
 
SetKeywords($keywords)
Associates keywords with the document, generally in the form 'keyword1 keyword2 ...'. 
 
getObjFilename($name)
Returns a temporary filename for caching object on filesystem. 
 
$OutlineRoot
Outline root for bookmark. 
 
writeDiskCache($filename, $data, $append=false)
Writes data to a temporary file on filesystem. 
 
getSignatureAppearanceArray($x=0, $y=0, $w=0, $h=0, $page=-1)
Get the array that defines the signature appearance (page and rectangle coordinates). 
 
$starting_page_number
Starting page number. 
 
$xobjid
Current XObject ID. 
 
_encrypt_data($n, $s)
Encrypt the input string. 
 
$unicode
Object containing unicode data. 
 
setPageOrientation($orientation, $autopagebreak='', $bottommargin='')
Set page orientation. 
 
setSignature($signing_cert='', $private_key='', $private_key_password='', $extracerts='', $cert_type=2, $info=array())
Enable document signature (requires the OpenSSL Library). 
 
$clMargin
Cell left margin (used by regions). 
 
get_mqr()
Gets the current active configuration setting of magic_quotes_runtime (if the get_magic_quotes_runtim...
 
setDocModificationTimestamp($time)
Set the document modification timestamp. 
 
setHeaderFont($font)
Set header font. 
 
$byterange_string
ByteRange placemark used during digital signature process. 
 
SetAbsX($x)
Set the absolute X coordinate of the current pointer. 
 
setCellPaddings($left='', $top='', $right='', $bottom='')
Set the internal Cell paddings. 
 
getCellCode($w, $h=0, $txt='', $border=0, $ln=0, $align='', $fill=false, $link='', $stretch=0, $ignore_min_height=false, $calign='T', $valign='M')
Returns the PDF string code to print a cell (rectangular area) with optional borders, background color and character string. 
 
$page
Current page number. 
 
getFontAscent($font, $style='', $size=0)
Return the font ascent value. 
 
$footer_text_color
Color for footer text (RGB array). 
 
PHP class for generating PDF documents without requiring external extensions. 
 
_datastring($s, $n=0)
Format a data string for meta information. 
 
segSVGContentHandler($parser, $data)
Sets the character data handler function for the XML parser. 
 
commitTransaction()
Delete the copy of the current TCPDF object used for undo operation. 
 
$start_transaction_y
Store Y position when startTransaction() is called. 
 
_getobj($objid='')
Return the starting object string for the selected object ID. 
 
SetSubject($subject)
Defines the subject of the document. 
 
_dolinethroughw($x, $y, $w)
Line through for rectangular text area. 
 
SetFillSpotColor($name, $tint=100)
Defines the spot color used for all filling operations (filled rectangles and cell backgrounds)...
 
getCellBorder($x, $y, $w, $h, $brd)
Returns the code to draw the cell border. 
 
getCSSBorderStyle($cssborder)
Returns the border style array from CSS border properties. 
 
getAliasNumPage()
Returns the string alias used for the page number. 
 
getOverprint()
Get the overprint mode array (OP, op, OPM). 
 
$numimages
Counts the number of pages. 
 
setOpenCell($isopen)
Set the top/bottom cell sides to be open or closed when the cell cross the page. 
 
convertHexStringToString($bs)
Convert hexadecimal string to string. 
 
setListIndentWidth($width)
Set custom width for list indentation. 
 
Gradient($type, $coords, $stops, $background=array(), $antialias=false)
Output gradient. 
 
getFontsList()
Fill the list of available fonts ($this->fontlist). 
 
$InFooter
Flag set when processing page footer. 
 
getImageScale()
Returns the adjusting factor to convert pixels to user units. 
 
setSRGBmode($mode=false)
Set flag to force sRGB_IEC61966-2.1 black scaled ICC color profile for the whole document. 
 
$current_column
Current column number. 
 
_Uvalue()
Compute U value (used for encryption) 
 
$hPt
Current height of page in points. 
 
_putspotcolors()
Output Spot Colors Resources. 
 
replacePageNumAliases($page, $replace, $diff=0)
Replace page number aliases with number. 
 
_textstring($s, $n=0)
Format a text string for meta information. 
 
setHtmlLinksStyle($color=array(0, 0, 255), $fontstyle='U')
Set the color and font style for HTML links. 
 
SVGPath($d, $style='')
Draws an SVG path. 
 
getTagStyleFromCSSarray($css)
Compact CSS data array into single string. 
 
unichr($c)
Returns the unicode caracter specified by UTF-8 value. 
 
_toJPEG($image)
Convert the loaded image to a JPEG and then return a structure for the PDF creator. 
 
Annotation($x, $y, $w, $h, $text, $opt=array('Subtype'=>'Text'), $spaces=0)
Puts a markup annotation on a rectangular area of the page. 
 
$svgdefs
Array of SVG defs. 
 
__construct($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding='UTF-8', $diskcache=false, $pdfa=false)
This is the class constructor. 
 
$re_space
Array of $re_spaces parts. 
 
setCellMargins($left='', $top='', $right='', $bottom='')
Set the internal Cell margins. 
 
getFontStretching()
Get the percentage of character stretching. 
 
$fgcolor
Current foreground color. 
 
This is a PHP class containing Font encodings maps class for TCPDF library. 
 
getHeaderFont()
Get header font. 
 
TranslateX($t_x)
Translate graphic object horizontally. 
 
$gdgammacache
Cache array for computed GD gamma values. 
 
setDestination($name, $y=-1, $page='', $x=-1)
Add a Named Destination. 
 
startTransaction()
Stores a copy of the current TCPDF object used for undo operation. 
 
getAllInternalPageNumberAliases()
Return an array containing all internal page aliases. 
 
getFooterMargin()
Returns footer margin in user units.