111require_once(dirname(__FILE__).
'/tcpdf_autoconfig.php');
 
  113require_once(dirname(__FILE__).
'/include/tcpdf_font_data.php');
 
  115require_once(dirname(__FILE__).
'/include/tcpdf_fonts.php');
 
  117require_once(dirname(__FILE__).
'/include/tcpdf_colors.php');
 
  119require_once(dirname(__FILE__).
'/include/tcpdf_images.php');
 
  121require_once(dirname(__FILE__).
'/include/tcpdf_static.php');
 
  288        protected $cell_margin = array(
'T' => 0, 
'R' => 0, 
'B' => 0, 
'L' => 0);
 
  690        protected $txtshadow = array(
'enabled'=>
false, 
'depth_w'=>0, 
'depth_h'=>0, 
'color'=>
false, 
'opacity'=>1, 
'blend_mode'=>
'Normal');
 
 1338        protected $default_form_prop = array(
'lineWidth'=>1, 
'borderStyle'=>
'solid', 
'fillColor'=>array(255, 255, 255), 
'strokeColor'=>array(128, 128, 128));
 
 1457        protected $colxshift = array(
'x' => 0, 
's' => array(
'H' => 0, 
'V' => 0), 
'p' => array(
'L' => 0, 
'T' => 0, 
'R' => 0, 
'B' => 0));
 
 1681                'alignment-baseline' => 
'auto',
 
 1682                'baseline-shift' => 
'baseline',
 
 1684                'clip-path' => 
'none',
 
 1685                'clip-rule' => 
'nonzero',
 
 1687                'color-interpolation' => 
'sRGB',
 
 1688                'color-interpolation-filters' => 
'linearRGB',
 
 1689                'color-profile' => 
'auto',
 
 1690                'color-rendering' => 
'auto',
 
 1692                'direction' => 
'ltr',
 
 1693                'display' => 
'inline',
 
 1694                'dominant-baseline' => 
'auto',
 
 1695                'enable-background' => 
'accumulate',
 
 1697                'fill-opacity' => 1,
 
 1698                'fill-rule' => 
'nonzero',
 
 1700                'flood-color' => 
'black',
 
 1701                'flood-opacity' => 1,
 
 1703                'font-family' => 
'helvetica',
 
 1704                'font-size' => 
'medium',
 
 1705                'font-size-adjust' => 
'none',
 
 1706                'font-stretch' => 
'normal',
 
 1707                'font-style' => 
'normal',
 
 1708                'font-variant' => 
'normal',
 
 1709                'font-weight' => 
'normal',
 
 1710                'glyph-orientation-horizontal' => 
'0deg',
 
 1711                'glyph-orientation-vertical' => 
'auto',
 
 1712                'image-rendering' => 
'auto',
 
 1713                'kerning' => 
'auto',
 
 1714                'letter-spacing' => 
'normal',
 
 1715                'lighting-color' => 
'white',
 
 1717                'marker-end' => 
'none',
 
 1718                'marker-mid' => 
'none',
 
 1719                'marker-start' => 
'none',
 
 1722                'overflow' => 
'auto',
 
 1723                'pointer-events' => 
'visiblePainted',
 
 1724                'shape-rendering' => 
'auto',
 
 1725                'stop-color' => 
'black',
 
 1726                'stop-opacity' => 1,
 
 1728                'stroke-dasharray' => 
'none',
 
 1729                'stroke-dashoffset' => 0,
 
 1730                'stroke-linecap' => 
'butt',
 
 1731                'stroke-linejoin' => 
'miter',
 
 1732                'stroke-miterlimit' => 4,
 
 1733                'stroke-opacity' => 1,
 
 1734                'stroke-width' => 1,
 
 1735                'text-anchor' => 
'start',
 
 1736                'text-decoration' => 
'none',
 
 1737                'text-rendering' => 
'auto',
 
 1738                'unicode-bidi' => 
'normal',
 
 1739                'visibility' => 
'visible',
 
 1740                'word-spacing' => 
'normal',
 
 1741                'writing-mode' => 
'lr-tb',
 
 1742                'text-color' => 
'black',
 
 1743                'transfmatrix' => array(1, 0, 0, 1, 0, 0)
 
 1787        protected $overprint = array(
'OP' => 
false, 
'op' => 
false, 
'OPM' => 0);
 
 1795        protected $alpha = array(
'CA' => 1, 
'ca' => 1, 
'BM' => 
'/Normal', 
'AIS' => 
false);
 
 1802        protected $page_boxes = array(
'MediaBox', 
'CropBox', 
'BleedBox', 
'TrimBox', 
'ArtBox');
 
 1838        public function __construct($orientation=
'P', $unit=
'mm', $format=
'A4', $unicode=
true, 
$encoding=
'UTF-8', $diskcache=
false, $pdfa=
false) {
 
 1840                if (function_exists(
'mb_internal_encoding') AND mb_internal_encoding()) {
 
 1841                        $this->internal_encoding = mb_internal_encoding();
 
 1842                        mb_internal_encoding(
'ASCII');
 
 1845                $serformat = (is_array($format) ? json_encode($format) : $format);
 
 1847                $this->font_obj_ids = array();
 
 1848                $this->page_obj_id = array();
 
 1849                $this->form_obj_id = array();
 
 1851                $this->pdfa_mode = $pdfa;
 
 1852                $this->force_srgb = 
false;
 
 1855                $this->tmprtl = 
false;
 
 1859                $this->isunicode = $unicode;
 
 1861                $this->transfmrk[0] = array();
 
 1862                $this->pagedim = array();
 
 1865                $this->pages = array();
 
 1867                $this->fonts = array();
 
 1868                $this->FontFiles = array();
 
 1869                $this->diffs = array();
 
 1870                $this->images = array();
 
 1871                $this->links = array();
 
 1872                $this->gradients = array();
 
 1873                $this->InFooter = 
false;
 
 1876                $this->FontStyle = 
'';
 
 1877                $this->FontSizePt = 12;
 
 1878                $this->underline = 
false;
 
 1879                $this->overline = 
false;
 
 1880                $this->linethrough = 
false;
 
 1881                $this->DrawColor = 
'0 G';
 
 1882                $this->FillColor = 
'0 g';
 
 1883                $this->TextColor = 
'0 g';
 
 1884                $this->ColorFlag = 
false;
 
 1885                $this->pdflayers = array();
 
 1887                $this->encrypted = 
false;
 
 1888                $this->last_enc_key = 
'';
 
 1890                $this->CoreFonts = array(
 
 1891                        'courier'=>
'Courier',
 
 1892                        'courierB'=>
'Courier-Bold',
 
 1893                        'courierI'=>
'Courier-Oblique',
 
 1894                        'courierBI'=>
'Courier-BoldOblique',
 
 1895                        'helvetica'=>
'Helvetica',
 
 1896                        'helveticaB'=>
'Helvetica-Bold',
 
 1897                        'helveticaI'=>
'Helvetica-Oblique',
 
 1898                        'helveticaBI'=>
'Helvetica-BoldOblique',
 
 1899                        'times'=>
'Times-Roman',
 
 1900                        'timesB'=>
'Times-Bold',
 
 1901                        'timesI'=>
'Times-Italic',
 
 1902                        'timesBI'=>
'Times-BoldItalic',
 
 1904                        'zapfdingbats'=>
'ZapfDingbats' 
 1916                $cpadding = $margin / 10;
 
 1921                $this->LineWidth = 0.57 / 
$this->k;
 
 1922                $this->linestyleWidth = sprintf(
'%F w', ($this->LineWidth * $this->k));
 
 1923                $this->linestyleCap = 
'0 J';
 
 1924                $this->linestyleJoin = 
'0 j';
 
 1925                $this->linestyleDash = 
'[] 0 d';
 
 1934                $this->tcpdflink = 
true;
 
 1936                $this->HREF = array();
 
 1938                $this->fgcolor = array(
'R' => 0, 
'G' => 0, 
'B' => 0);
 
 1939                $this->strokecolor = array(
'R' => 0, 
'G' => 0, 
'B' => 0);
 
 1940                $this->bgcolor = array(
'R' => 255, 
'G' => 255, 
'B' => 255);
 
 1941                $this->extgstates = array();
 
 1944                $this->sign = 
false;
 
 1945                $this->tsa_timestamp = 
false;
 
 1946                $this->tsa_data = array();
 
 1947                $this->signature_appearance = array(
'page' => 1, 
'rect' => 
'0 0 0 0', 
'name' => 
'Signature');
 
 1948                $this->empty_signature_appearance = array();
 
 1950                $this->ur[
'enabled'] = 
false;
 
 1951                $this->ur[
'document'] = 
'/FullSave';
 
 1952                $this->ur[
'annots'] = 
'/Create/Delete/Modify/Copy/Import/Export';
 
 1953                $this->ur[
'form'] = 
'/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate';
 
 1954                $this->ur[
'signature'] = 
'/Modify';
 
 1955                $this->ur[
'ef'] = 
'/Create/Delete/Modify/Import';
 
 1956                $this->ur[
'formex'] = 
'';
 
 1958                $this->jpeg_quality = 75;
 
 1962                $this->
SetFont($this->FontFamily, $this->FontStyle, $this->FontSizePt);
 
 1963                $this->
setHeaderFont(array($this->FontFamily, $this->FontStyle, $this->FontSizePt));
 
 1964                $this->
setFooterFont(array($this->FontFamily, $this->FontStyle, $this->FontSizePt));
 
 1966                if ($this->isunicode AND (@preg_match(
'/\pL/u', 
'a') == 1)) {
 
 1978                $this->default_form_prop = array(
'lineWidth'=>1, 
'borderStyle'=>
'solid', 
'fillColor'=>array(255, 255, 255), 
'strokeColor'=>array(128, 128, 128));
 
 1980                $this->doc_creation_timestamp = time();
 
 1984                $this->header_xobj_autoreset = 
false;
 
 1985                $this->custom_xmp = 
'';
 
 1988                register_shutdown_function(array($this, 
'_destroy'), 
true);
 
 1998                if (isset($this->internal_encoding) AND !empty($this->internal_encoding)) {
 
 1999                        mb_internal_encoding($this->internal_encoding);
 
 2012                $unit = strtolower($unit);
 
 2023                                $this->k = $this->dpi / 25.4;
 
 2028                                $this->k = $this->dpi / 2.54;
 
 2038                                $this->
Error(
'Incorrect unit: '.$unit);
 
 2042                $this->pdfunit = $unit;
 
 2043                if (isset($this->CurOrientation)) {
 
 2104                if (!empty($format) AND isset($this->pagedim[$this->page])) {
 
 2106                        unset($this->pagedim[$this->page]);
 
 2108                if (is_string($format)) {
 
 2111                        $this->fwPt = $pf[0];
 
 2112                        $this->fhPt = $pf[1];
 
 2115                        if (isset($format[
'MediaBox'])) {
 
 2116                                $this->pagedim = 
TCPDF_STATIC::setPageBoxes($this->page, 
'MediaBox', $format[
'MediaBox'][
'llx'], $format[
'MediaBox'][
'lly'], $format[
'MediaBox'][
'urx'], $format[
'MediaBox'][
'ury'], 
false, $this->k, $this->pagedim);
 
 2117                                $this->fwPt = (($format[
'MediaBox'][
'urx'] - $format[
'MediaBox'][
'llx']) * $this->k);
 
 2118                                $this->fhPt = (($format[
'MediaBox'][
'ury'] - $format[
'MediaBox'][
'lly']) * $this->k);
 
 2120                                if (isset($format[0]) AND is_numeric($format[0]) AND isset($format[1]) AND is_numeric($format[1])) {
 
 2121                                        $pf = array(($format[0] * $this->k), ($format[1] * $this->k));
 
 2123                                        if (!isset($format[
'format'])) {
 
 2125                                                $format[
'format'] = 
'A4';
 
 2129                                $this->fwPt = $pf[0];
 
 2130                                $this->fhPt = $pf[1];
 
 2131                                $this->pagedim = 
TCPDF_STATIC::setPageBoxes($this->page, 
'MediaBox', 0, 0, $this->fwPt, $this->fhPt, 
true, $this->k, $this->pagedim);
 
 2134                        if (isset($format[
'CropBox'])) {
 
 2135                                $this->pagedim = 
TCPDF_STATIC::setPageBoxes($this->page, 
'CropBox', $format[
'CropBox'][
'llx'], $format[
'CropBox'][
'lly'], $format[
'CropBox'][
'urx'], $format[
'CropBox'][
'ury'], 
false, $this->k, $this->pagedim);
 
 2138                        if (isset($format[
'BleedBox'])) {
 
 2139                                $this->pagedim = 
TCPDF_STATIC::setPageBoxes($this->page, 
'BleedBox', $format[
'BleedBox'][
'llx'], $format[
'BleedBox'][
'lly'], $format[
'BleedBox'][
'urx'], $format[
'BleedBox'][
'ury'], 
false, $this->k, $this->pagedim);
 
 2142                        if (isset($format[
'TrimBox'])) {
 
 2143                                $this->pagedim = 
TCPDF_STATIC::setPageBoxes($this->page, 
'TrimBox', $format[
'TrimBox'][
'llx'], $format[
'TrimBox'][
'lly'], $format[
'TrimBox'][
'urx'], $format[
'TrimBox'][
'ury'], 
false, $this->k, $this->pagedim);
 
 2146                        if (isset($format[
'ArtBox'])) {
 
 2147                                $this->pagedim = 
TCPDF_STATIC::setPageBoxes($this->page, 
'ArtBox', $format[
'ArtBox'][
'llx'], $format[
'ArtBox'][
'lly'], $format[
'ArtBox'][
'urx'], $format[
'ArtBox'][
'ury'], 
false, $this->k, $this->pagedim);
 
 2150                        if (isset($format[
'BoxColorInfo'])) {
 
 2151                                $this->pagedim[
$this->page][
'BoxColorInfo'] = $format[
'BoxColorInfo'];
 
 2153                        if (isset($format[
'Rotate']) AND (($format[
'Rotate'] % 90) == 0)) {
 
 2155                                $this->pagedim[
$this->page][
'Rotate'] = intval($format[
'Rotate']);
 
 2157                        if (isset($format[
'PZ'])) {
 
 2159                                $this->pagedim[
$this->page][
'PZ'] = floatval($format[
'PZ']);
 
 2161                        if (isset($format[
'trans'])) {
 
 2163                                if (isset($format[
'trans'][
'Dur'])) {
 
 2165                                        $this->pagedim[
$this->page][
'trans'][
'Dur'] = floatval($format[
'trans'][
'Dur']);
 
 2167                                $stansition_styles = array(
'Split', 
'Blinds', 
'Box', 
'Wipe', 
'Dissolve', 
'Glitter', 
'R', 
'Fly', 
'Push', 
'Cover', 
'Uncover', 
'Fade');
 
 2168                                if (isset($format[
'trans'][
'S']) AND in_array($format[
'trans'][
'S'], $stansition_styles)) {
 
 2170                                        $this->pagedim[
$this->page][
'trans'][
'S'] = $format[
'trans'][
'S'];
 
 2171                                        $valid_effect = array(
'Split', 
'Blinds');
 
 2172                                        $valid_vals = array(
'H', 
'V');
 
 2173                                        if (isset($format[
'trans'][
'Dm']) AND in_array($format[
'trans'][
'S'], $valid_effect) AND in_array($format[
'trans'][
'Dm'], $valid_vals)) {
 
 2174                                                $this->pagedim[
$this->page][
'trans'][
'Dm'] = $format[
'trans'][
'Dm'];
 
 2176                                        $valid_effect = array(
'Split', 
'Box', 
'Fly');
 
 2177                                        $valid_vals = array(
'I', 
'O');
 
 2178                                        if (isset($format[
'trans'][
'M']) AND in_array($format[
'trans'][
'S'], $valid_effect) AND in_array($format[
'trans'][
'M'], $valid_vals)) {
 
 2179                                                $this->pagedim[
$this->page][
'trans'][
'M'] = $format[
'trans'][
'M'];
 
 2181                                        $valid_effect = array(
'Wipe', 
'Glitter', 
'Fly', 
'Cover', 
'Uncover', 
'Push');
 
 2182                                        if (isset($format[
'trans'][
'Di']) AND in_array($format[
'trans'][
'S'], $valid_effect)) {
 
 2183                                                if (((($format[
'trans'][
'Di'] == 90) OR ($format[
'trans'][
'Di'] == 180)) AND ($format[
'trans'][
'S'] == 
'Wipe'))
 
 2184                                                        OR (($format[
'trans'][
'Di'] == 315) AND ($format[
'trans'][
'S'] == 
'Glitter'))
 
 2185                                                        OR (($format[
'trans'][
'Di'] == 0) OR ($format[
'trans'][
'Di'] == 270))) {
 
 2186                                                        $this->pagedim[
$this->page][
'trans'][
'Di'] = intval($format[
'trans'][
'Di']);
 
 2189                                        if (isset($format[
'trans'][
'SS']) AND ($format[
'trans'][
'S'] == 
'Fly')) {
 
 2190                                                $this->pagedim[
$this->page][
'trans'][
'SS'] = floatval($format[
'trans'][
'SS']);
 
 2192                                        if (isset($format[
'trans'][
'B']) AND ($format[
'trans'][
'B'] === 
true) AND ($format[
'trans'][
'S'] == 
'Fly')) {
 
 2193                                                $this->pagedim[
$this->page][
'trans'][
'B'] = 
'true';
 
 2198                                if (isset($format[
'trans'][
'D'])) {
 
 2200                                        $this->pagedim[
$this->page][
'trans'][
'D'] = floatval($format[
'trans'][
'D']);
 
 2218                if (!isset($this->pagedim[$this->page][
'MediaBox'])) {
 
 2220                        $this->pagedim = 
TCPDF_STATIC::setPageBoxes($this->page, 
'MediaBox', 0, 0, $this->fwPt, $this->fhPt, 
true, $this->k, $this->pagedim);
 
 2222                if (!isset($this->pagedim[$this->page][
'CropBox'])) {
 
 2224                        $this->pagedim = 
TCPDF_STATIC::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, $this->k, $this->pagedim);
 
 2226                if (!isset($this->pagedim[$this->page][
'BleedBox'])) {
 
 2228                        $this->pagedim = 
TCPDF_STATIC::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, $this->k, $this->pagedim);
 
 2230                if (!isset($this->pagedim[$this->page][
'TrimBox'])) {
 
 2232                        $this->pagedim = 
TCPDF_STATIC::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, $this->k, $this->pagedim);
 
 2234                if (!isset($this->pagedim[$this->page][
'ArtBox'])) {
 
 2236                        $this->pagedim = 
TCPDF_STATIC::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, $this->k, $this->pagedim);
 
 2238                if (!isset($this->pagedim[$this->page][
'Rotate'])) {
 
 2242                if (!isset($this->pagedim[$this->page][
'PZ'])) {
 
 2246                if ($this->fwPt > $this->fhPt) {
 
 2248                        $default_orientation = 
'L';
 
 2251                        $default_orientation = 
'P';
 
 2253                $valid_orientations = array(
'P', 
'L');
 
 2254                if (empty($orientation)) {
 
 2255                        $orientation = $default_orientation;
 
 2257                        $orientation = strtoupper($orientation[0]);
 
 2259                if (in_array($orientation, $valid_orientations) AND ($orientation != $default_orientation)) {
 
 2260                        $this->CurOrientation = $orientation;
 
 2264                        $this->CurOrientation = $default_orientation;
 
 2268                if ((abs($this->pagedim[$this->page][
'MediaBox'][
'urx'] - $this->hPt) < $this->feps) AND (abs($this->pagedim[$this->page][
'MediaBox'][
'ury'] - $this->wPt) < $this->feps)){
 
 2272                $this->w = ($this->wPt / 
$this->k);
 
 2273                $this->h = ($this->hPt / 
$this->k);
 
 2275                        if (isset($this->AutoPageBreak)) {
 
 2278                                $autopagebreak = 
true;
 
 2282                        if (isset($this->bMargin)) {
 
 2286                                $bottommargin = 2 * 28.35 / 
$this->k;
 
 2296                $this->pagedim[
$this->page][
'bm'] = $bottommargin;
 
 2299                $this->pagedim[
$this->page][
'pb'] = $autopagebreak;
 
 2324                $this->re_spaces = $re;
 
 2325                $re_parts = explode(
'/', $re);
 
 2327                $this->re_space = array();
 
 2328                if (isset($re_parts[1]) AND !empty($re_parts[1])) {
 
 2329                        $this->re_space[
'p'] = $re_parts[1];
 
 2331                        $this->re_space[
'p'] = 
'[\s]';
 
 2334                if (isset($re_parts[2]) AND !empty($re_parts[2])) {
 
 2335                        $this->re_space[
'm'] = $re_parts[2];
 
 2337                        $this->re_space[
'm'] = 
'';
 
 2348        public function setRTL($enable, $resetx=
true) {
 
 2349                $enable = $enable ? true : 
false;
 
 2350                $resetx = ($resetx AND ($enable != $this->rtl));
 
 2351                $this->rtl = $enable;
 
 2352                $this->tmprtl = 
false;
 
 2376                switch (strtoupper($mode)) {
 
 2397                $this->tmprtl = $newmode;
 
 2407                return ($this->rtl OR ($this->tmprtl == 
'R'));
 
 2430                        $height += ($this->cell_padding[
'T'] + $this->cell_padding[
'B']);
 
 2432                return round($height, 6);
 
 2462                $this->imgscale = $scale;
 
 2486                if (empty($pagenum)) {
 
 2489                return $this->pagedim[$pagenum];
 
 2502                if (empty($pagenum)) {
 
 2505                return $this->pagedim[$pagenum][
'w'];
 
 2518                if (empty($pagenum)) {
 
 2521                return $this->pagedim[$pagenum][
'h'];
 
 2534                if (empty($pagenum)) {
 
 2537                return $this->pagedim[$pagenum][
'bm'];
 
 2561        public function SetMargins($left, $top, $right=-1, $keepmargins=
false) {
 
 2563                $this->lMargin = $left;
 
 2564                $this->tMargin = $top;
 
 2568                $this->rMargin = $right;
 
 2585                $this->lMargin = $margin;
 
 2586                if (($this->page > 0) AND ($this->x < $margin)) {
 
 2600                $this->tMargin = $margin;
 
 2601                if (($this->page > 0) AND ($this->y < $margin)) {
 
 2614                $this->rMargin = $margin;
 
 2615                if (($this->page > 0) AND ($this->x > ($this->w - $margin))) {
 
 2616                        $this->x = $this->w - $margin;
 
 2629                        $this->cell_padding[
'L'] = $pad;
 
 2630                        $this->cell_padding[
'T'] = $pad;
 
 2631                        $this->cell_padding[
'R'] = $pad;
 
 2632                        $this->cell_padding[
'B'] = $pad;
 
 2647                if (($left !== 
'') AND ($left >= 0)) {
 
 2648                        $this->cell_padding[
'L'] = $left;
 
 2650                if (($top !== 
'') AND ($top >= 0)) {
 
 2651                        $this->cell_padding[
'T'] = $top;
 
 2653                if (($right !== 
'') AND ($right >= 0)) {
 
 2654                        $this->cell_padding[
'R'] = $right;
 
 2656                if (($bottom !== 
'') AND ($bottom >= 0)) {
 
 2657                        $this->cell_padding[
'B'] = $bottom;
 
 2683                if (($left !== 
'') AND ($left >= 0)) {
 
 2684                        $this->cell_margin[
'L'] = $left;
 
 2686                if (($top !== 
'') AND ($top >= 0)) {
 
 2687                        $this->cell_margin[
'T'] = $top;
 
 2689                if (($right !== 
'') AND ($right >= 0)) {
 
 2690                        $this->cell_margin[
'R'] = $right;
 
 2692                if (($bottom !== 
'') AND ($bottom >= 0)) {
 
 2693                        $this->cell_margin[
'B'] = $bottom;
 
 2719                if (is_string($brd)) {
 
 2721                        $slen = strlen($brd);
 
 2723                        for ($i = 0; $i < $slen; ++$i) {
 
 2724                                $newbrd[$brd[$i]] = 
true;
 
 2727                } elseif (($brd === 1) OR ($brd === 
true) OR (is_numeric($brd) AND (intval($brd) > 0))) {
 
 2728                        $brd = array(
'LRTB' => 
true);
 
 2730                if (!is_array($brd)) {
 
 2736                if (isset($brd[
'mode'])) {
 
 2737                        $mode = $brd[
'mode'];
 
 2738                        unset($brd[
'mode']);
 
 2747                                $line_width = 
$style[
'width'];
 
 2761                                        $adj = ($line_width / 2);
 
 2766                        if ((strpos(
$border,
'T') !== 
false) AND ($this->cell_padding[
'T'] < $adj)) {
 
 2767                                $this->cell_padding[
'T'] = $adj;
 
 2769                        if ((strpos(
$border,
'R') !== 
false) AND ($this->cell_padding[
'R'] < $adj)) {
 
 2770                                $this->cell_padding[
'R'] = $adj;
 
 2772                        if ((strpos(
$border,
'B') !== 
false) AND ($this->cell_padding[
'B'] < $adj)) {
 
 2773                                $this->cell_padding[
'B'] = $adj;
 
 2775                        if ((strpos(
$border,
'L') !== 
false) AND ($this->cell_padding[
'L'] < $adj)) {
 
 2776                                $this->cell_padding[
'L'] = $adj;
 
 2779                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']));
 
 2791                $this->AutoPageBreak = $auto ? true : 
false;
 
 2792                $this->bMargin = $margin;
 
 2793                $this->PageBreakTrigger = $this->h - $margin;
 
 2815                if (($zoom == 
'fullpage') OR ($zoom == 
'fullwidth') OR ($zoom == 
'real') OR ($zoom == 
'default') OR (!is_string($zoom))) {
 
 2816                        $this->ZoomMode = $zoom;
 
 2818                        $this->
Error(
'Incorrect zoom display mode: '.$zoom);
 
 2832                if (function_exists(
'gzcompress')) {
 
 2833                        $this->compress = 
$compress ? true : 
false;
 
 2835                        $this->compress = 
false;
 
 2846                $this->force_srgb = $mode ? true : 
false;
 
 2857                $this->docinfounicode = $unicode ? true : 
false;
 
 2925                        die(
'<strong>TCPDF ERROR: </strong>'.$msg);
 
 2927                        throw new Exception(
'TCPDF ERROR: '.$msg);
 
 2952                if ($this->state == 3) {
 
 2955                if ($this->page == 0) {
 
 2959                if ($this->tcpdflink) {
 
 2963                        $this->lastpage(
true);
 
 2966                        $this->y = $this->h - (1 / 
$this->k);
 
 2972                        $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";
 
 2973                        $lnk = 
"\x68\x74\x74\x70\x3a\x2f\x2f\x77\x77\x77\x2e\x74\x63\x70\x64\x66\x2e\x6f\x72\x67";
 
 2974                        $this->
Cell(0, 0, $msg, 0, 0, 
'L', 0, $lnk, 0, 
false, 
'D', 
'B');
 
 2995        public function setPage($pnum, $resetmargins=
false) {
 
 2996                if (($pnum == $this->page) AND ($this->state == 2)) {
 
 2999                if (($pnum > 0) AND ($pnum <= $this->numpages)) {
 
 3004                        $this->page = $pnum;
 
 3009                        $this->tMargin = $this->pagedim[
$this->page][
'tm'];
 
 3010                        $this->bMargin = $this->pagedim[
$this->page][
'bm'];
 
 3011                        $this->original_lMargin = $this->pagedim[
$this->page][
'olm'];
 
 3012                        $this->original_rMargin = $this->pagedim[
$this->page][
'orm'];
 
 3013                        $this->AutoPageBreak = $this->pagedim[
$this->page][
'pb'];
 
 3014                        $this->CurOrientation = $this->pagedim[
$this->page][
'or'];
 
 3018                        if ($resetmargins) {
 
 3019                                $this->lMargin = $this->pagedim[
$this->page][
'olm'];
 
 3020                                $this->rMargin = $this->pagedim[
$this->page][
'orm'];
 
 3021                                $this->
SetY($this->tMargin);
 
 3024                                if ($this->pagedim[$this->page][
'olm'] != $this->pagedim[$oldpage][
'olm']) {
 
 3026                                        $this->lMargin += $deltam;
 
 3027                                        $this->rMargin -= $deltam;
 
 3031                        $this->
Error(
'Wrong page number on setPage() function: '.$pnum);
 
 3077        public function addTOCPage($orientation=
'', $format=
'', $keepmargins=
false) {
 
 3078                $this->
AddPage($orientation, $format, $keepmargins, 
true);
 
 3102        public function AddPage($orientation=
'', $format=
'', $keepmargins=
false, 
$tocpage=
false) {
 
 3103                if ($this->inxobj) {
 
 3107                if (!isset($this->original_lMargin) OR $keepmargins) {
 
 3110                if (!isset($this->original_rMargin) OR $keepmargins) {
 
 3128                if (($this->page == 0) OR ($this->numpages > $this->page) OR (!$this->pageopen[$this->page])) {
 
 3138                        $this->tocpage = 
false;
 
 3154                        $this->tocpage = 
true;
 
 3157                if ($this->tocpage) {
 
 3161                        foreach ($tmpoutlines as $key => $outline) {
 
 3162                                if (!$outline[
'f'] AND ($outline[
'p'] > $this->numpages)) {
 
 3163                                        $this->outlines[$key][
'p'] = ($outline[
'p'] + 1);
 
 3168                        foreach ($tmpdests as $key => $dest) {
 
 3169                                if (!$dest[
'f'] AND ($dest[
'p'] > $this->numpages)) {
 
 3170                                        $this->dests[$key][
'p'] = ($dest[
'p'] + 1);
 
 3175                        foreach ($tmplinks as $key => $link) {
 
 3176                                if (!$link[
'f'] AND ($link[
'p'] > $this->numpages)) {
 
 3177                                        $this->links[$key][
'p'] = ($link[
'p'] + 1);
 
 3181                if ($this->numpages > $this->page) {
 
 3183                        $this->
setPage($this->page + 1);
 
 3184                        $this->
SetY($this->tMargin);
 
 3188                if ($this->state == 0) {
 
 3240                if (isset($this->footerlen[
$page])) {
 
 3241                        $this->cntmrk[
$page] = $this->pagelen[
$page] - $this->footerlen[
$page];
 
 3243                        $this->cntmrk[
$page] = $this->pagelen[
$page];
 
 3257        public function setHeaderData($ln=
'', $lw=0, $ht=
'', $hs=
'', $tc=array(0,0,0), $lc=array(0,0,0)) {
 
 3258                $this->header_logo = $ln;
 
 3259                $this->header_logo_width = $lw;
 
 3260                $this->header_title = $ht;
 
 3261                $this->header_string = $hs;
 
 3262                $this->header_text_color = $tc;
 
 3263                $this->header_line_color = $lc;
 
 3273                $this->footer_text_color = $tc;
 
 3274                $this->footer_line_color = $lc;
 
 3302                $this->header_margin = $hm;
 
 3322                $this->footer_margin = $fm;
 
 3340                $this->print_header = $val ? true : 
false;
 
 3349                $this->print_footer = $val ? true : 
false;
 
 3375                $this->header_xobjid = 
false;
 
 3384                $this->header_xobj_autoreset = $val ? true : 
false;
 
 3393                if ($this->header_xobjid === 
false) {
 
 3395                        $this->header_xobjid = $this->
startTemplate($this->w, $this->tMargin);
 
 3404                        if (($headerdata[
'logo']) AND ($headerdata[
'logo'] != 
K_BLANK_IMAGE)) {
 
 3406                                if (($imgtype == 
'eps') OR ($imgtype == 
'ai')) {
 
 3408                                } elseif ($imgtype == 
'svg') {
 
 3417                        $cell_height = $this->
getCellHeight($headerfont[2] / $this->k);
 
 3420                                $header_x = $this->original_rMargin + ($headerdata[
'logo_width'] * 1.1);
 
 3422                                $header_x = $this->original_lMargin + ($headerdata[
'logo_width'] * 1.1);
 
 3424                        $cw = $this->w - $this->original_lMargin - $this->original_rMargin - ($headerdata[
'logo_width'] * 1.1);
 
 3427                        $this->
SetFont($headerfont[0], 
'B', $headerfont[2] + 1);
 
 3428                        $this->
SetX($header_x);
 
 3429                        $this->
Cell($cw, $cell_height, $headerdata[
'title'], 0, 1, 
'', 0, 
'', 0);
 
 3431                        $this->
SetFont($headerfont[0], $headerfont[1], $headerfont[2]);
 
 3432                        $this->
SetX($header_x);
 
 3433                        $this->
MultiCell($cw, $cell_height, $headerdata[
'string'], 0, 
'', 0, 1, 
'', 
'', 
true, 0, 
false, 
true, 0, 
'T', 
false);
 
 3435                        $this->
SetLineStyle(array(
'width' => 0.85 / $this->k, 
'cap' => 
'butt', 
'join' => 
'miter', 
'dash' => 0, 
'color' => $headerdata[
'line_color']));
 
 3436                        $this->
SetY((2.835 / $this->k) + max($imgy, $this->y));
 
 3438                                $this->
SetX($this->original_rMargin);
 
 3440                                $this->
SetX($this->original_lMargin);
 
 3442                        $this->
Cell(($this->w - $this->original_lMargin - $this->original_rMargin), 0, 
'', 
'T', 0, 
'C');
 
 3448                if (!$this->header_xobj_autoreset AND $this->booklet AND (($this->page % 2) == 0)) {
 
 3453                        $x = $this->w + $dx;
 
 3457                $this->
printTemplate($this->header_xobjid, 
$x, 0, 0, 0, 
'', 
'', 
false);
 
 3458                if ($this->header_xobj_autoreset) {
 
 3460                        $this->header_xobjid = 
false;
 
 3474                $this->
SetLineStyle(array(
'width' => $line_width, 
'cap' => 
'butt', 
'join' => 
'miter', 
'dash' => 0, 
'color' => $this->footer_line_color));
 
 3478                        $this->
Ln($line_width);
 
 3479                        $barcode_width = round(($this->w - $this->original_lMargin - $this->original_rMargin) / 3);
 
 3481                                'position' => $this->rtl?
'R':
'L',
 
 3482                                'align' => $this->rtl?
'R':
'L',
 
 3485                                'cellfitalign' => 
'',
 
 3488                                'fgcolor' => array(0,0,0),
 
 3494                $w_page = isset($this->l[
'w_page']) ? $this->l[
'w_page'].
' ' : 
'';
 
 3495                if (empty($this->pagegroups)) {
 
 3496                        $pagenumtxt = $w_page.$this->getAliasNumPage().
' / '.$this->
getAliasNbPages();
 
 3498                        $pagenumtxt = $w_page.$this->getPageNumGroupAlias().
' / '.$this->
getPageGroupAlias();
 
 3500                $this->
SetY($cur_y);
 
 3503                        $this->
SetX($this->original_rMargin);
 
 3504                        $this->
Cell(0, 0, $pagenumtxt, 
'T', 0, 
'L');
 
 3506                        $this->
SetX($this->original_lMargin);
 
 3517                if (!$this->print_header OR ($this->state != 2)) {
 
 3520                $this->InHeader = 
true;
 
 3532                        $this->
SetXY($this->original_rMargin, $this->header_margin);
 
 3534                        $this->
SetXY($this->original_lMargin, $this->header_margin);
 
 3536                $this->
SetFont($this->header_font[0], $this->header_font[1], $this->header_font[2]);
 
 3540                        $this->
SetXY($this->original_rMargin, $this->tMargin);
 
 3542                        $this->
SetXY($this->original_lMargin, $this->tMargin);
 
 3546                $this->thead = $temp_thead;
 
 3547                $this->theadMargins = $temp_theadMargins;
 
 3549                $this->InHeader = 
false;
 
 3558                if ($this->state != 2) {
 
 3561                $this->InFooter = 
true;
 
 3567                if ($this->print_footer) {
 
 3569                        $this->current_column = 0;
 
 3570                        $this->num_columns = 1;
 
 3581                                $this->
SetXY($this->original_rMargin, $footer_y);
 
 3583                                $this->
SetXY($this->original_lMargin, $footer_y);
 
 3585                        $this->
SetFont($this->footer_font[0], $this->footer_font[1], $this->footer_font[2]);
 
 3589                                $this->
SetXY($this->original_rMargin, $this->tMargin);
 
 3591                                $this->
SetXY($this->original_lMargin, $this->tMargin);
 
 3595                        $this->thead = $temp_thead;
 
 3596                        $this->theadMargins = $temp_theadMargins;
 
 3600                $this->current_column = $gvars[
'current_column'];
 
 3601                $this->num_columns = $gvars[
'num_columns'];
 
 3604                $this->InFooter = 
false;
 
 3614                return (($this->InHeader === 
false) AND ($this->InFooter === 
false));
 
 3623                if ($this->num_columns > 1) {
 
 3627                if (isset($this->theadMargins[
'top'])) {
 
 3629                        $this->tMargin = $this->theadMargins[
'top'];
 
 3638                        $this->lMargin = $this->theadMargins[
'lmargin'] + ($this->pagedim[
$this->page][
'olm'] - $this->pagedim[$this->theadMargins[
'page']][
'olm']);
 
 3639                        $this->rMargin = $this->theadMargins[
'rmargin'] + ($this->pagedim[
$this->page][
'orm'] - $this->pagedim[$this->theadMargins[
'page']][
'orm']);
 
 3640                        $this->cell_padding = $this->theadMargins[
'cell_padding'];
 
 3647                        if ($this->theadMargins[
'cell']) {
 
 3649                                        $this->x -= $this->cell_padding[
'R'];
 
 3651                                        $this->x += $this->cell_padding[
'L'];
 
 3655                        if (!empty($this->theadMargins[
'gvars'])) {
 
 3658                                $this->rMargin = $gvars[
'rMargin'];
 
 3659                                $this->lMargin = $gvars[
'lMargin'];
 
 3662                        $this->
writeHTML($this->thead, 
false, 
false, 
false, 
false, 
'');
 
 3665                        if (!isset($this->theadMargins[
'top'])) {
 
 3669                        if (!isset($this->columns[0][
'th'])) {
 
 3670                                $this->columns[0][
'th'] = array();
 
 3672                        $this->columns[0][
'th'][
'\''.$this->page.
'\''] = 
$this->y;
 
 3676                        $this->lMargin = $prev_lMargin;
 
 3677                        $this->rMargin = $prev_rMargin;
 
 3678                        $this->cell_padding = $prev_cell_padding;
 
 3717                if (!isset($this->spot_colors[$name])) {
 
 3718                        $i = (1 + count($this->spot_colors));
 
 3719                        $this->spot_colors[$name] = array(
'C' => $c, 
'M' => $m, 
'Y' => 
$y, 
'K' => 
$k, 
'name' => $name, 
'i' => $i);
 
 3734                if ($spotcolor === 
false) {
 
 3735                        $this->
Error(
'Undefined spot color: '.$name.
', you must add it using the AddSpotColor() method.');
 
 3737                $tint = (max(0, min(100, $tint)) / 100);
 
 3738                $pdfcolor = sprintf(
'/CS%d ', $this->spot_colors[$name][
'i']);
 
 3741                                $pdfcolor .= sprintf(
'CS %F SCN', $tint);
 
 3742                                $this->DrawColor = $pdfcolor;
 
 3743                                $this->strokecolor = $spotcolor;
 
 3747                                $pdfcolor .= sprintf(
'cs %F scn', $tint);
 
 3748                                $this->FillColor = $pdfcolor;
 
 3749                                $this->bgcolor = $spotcolor;
 
 3753                                $pdfcolor .= sprintf(
'cs %F scn', $tint);
 
 3754                                $this->TextColor = $pdfcolor;
 
 3755                                $this->fgcolor = $spotcolor;
 
 3760                if ($this->state == 2) {
 
 3761                        $this->
_out($pdfcolor);
 
 3763                if ($this->inxobj) {
 
 3765                        $this->xobjects[
$this->xobjid][
'spot_colors'][$name] = $this->spot_colors[$name];
 
 3818                if (is_array($color)) {
 
 3819                        $color = array_values($color);
 
 3821                        $c = isset($color[0]) ? $color[0] : -1;
 
 3823                        $m = isset($color[1]) ? $color[1] : -1;
 
 3825                        $y = isset($color[2]) ? $color[2] : -1;
 
 3827                        $k = isset($color[3]) ? $color[3] : -1;
 
 3829                        $name = isset($color[4]) ? $color[4] : 
'';
 
 3892        public function setColor($type, $col1=0, $col2=-1, $col3=-1, $col4=-1, 
$ret=
false, $name=
'') {
 
 3894                if (!is_numeric($col1)) {
 
 3897                if (!is_numeric($col2)) {
 
 3900                if (!is_numeric($col3)) {
 
 3903                if (!is_numeric($col4)) {
 
 3908                if (($col2 == -1) AND ($col3 == -1) AND ($col4 == -1)) {
 
 3910                        $col1 = max(0, min(255, $col1));
 
 3911                        $intcolor = array(
'G' => $col1);
 
 3912                        $pdfcolor = sprintf(
'%F ', ($col1 / 255));
 
 3914                } elseif ($col4 == -1) {
 
 3916                        $col1 = max(0, min(255, $col1));
 
 3917                        $col2 = max(0, min(255, $col2));
 
 3918                        $col3 = max(0, min(255, $col3));
 
 3919                        $intcolor = array(
'R' => $col1, 
'G' => $col2, 
'B' => $col3);
 
 3920                        $pdfcolor = sprintf(
'%F %F %F ', ($col1 / 255), ($col2 / 255), ($col3 / 255));
 
 3923                        $col1 = max(0, min(100, $col1));
 
 3924                        $col2 = max(0, min(100, $col2));
 
 3925                        $col3 = max(0, min(100, $col3));
 
 3926                        $col4 = max(0, min(100, $col4));
 
 3929                                $intcolor = array(
'C' => $col1, 
'M' => $col2, 
'Y' => $col3, 
'K' => $col4);
 
 3930                                $pdfcolor = sprintf(
'%F %F %F %F ', ($col1 / 100), ($col2 / 100), ($col3 / 100), ($col4 / 100));
 
 3934                                $intcolor = array(
'C' => $col1, 
'M' => $col2, 
'Y' => $col3, 
'K' => $col4, 
'name' => $name);
 
 3935                                $this->
AddSpotColor($name, $col1, $col2, $col3, $col4);
 
 3941                                $pdfcolor .= strtoupper($suffix);
 
 3942                                $this->DrawColor = $pdfcolor;
 
 3943                                $this->strokecolor = $intcolor;
 
 3947                                $pdfcolor .= $suffix;
 
 3948                                $this->FillColor = $pdfcolor;
 
 3949                                $this->bgcolor = $intcolor;
 
 3953                                $pdfcolor .= $suffix;
 
 3954                                $this->TextColor = $pdfcolor;
 
 3955                                $this->fgcolor = $intcolor;
 
 3960                if (($type != 
'text') AND ($this->state == 2)) {
 
 3962                                $this->
_out($pdfcolor);
 
 3983                return $this->
setColor(
'draw', $col1, $col2, $col3, $col4, 
$ret, $name);
 
 4000                return $this->
setColor(
'fill', $col1, $col2, $col3, $col4, 
$ret, $name);
 
 4017                return $this->
setColor(
'text', $col1, $col2, $col3, $col4, 
$ret, $name);
 
 4032        public function GetStringWidth($s, $fontname=
'', $fontstyle=
'', $fontsize=0, $getarray=
false) {
 
 4033                return $this->
GetArrStringWidth(
TCPDF_FONTS::utf8Bidi(
TCPDF_FONTS::UTF8StringToArray($s, $this->isunicode, $this->CurrentFont), $s, $this->tmprtl, $this->isunicode, $this->CurrentFont), $fontname, $fontstyle, $fontsize, $getarray);
 
 4054                        $this->
SetFont($fontname, $fontstyle, $fontsize, 
'', 
'default', 
false);
 
 4062                foreach ($sa as $ck => $char) {
 
 4064                        $cw = $this->
GetCharWidth($char, isset($sa[($ck + 1)]));
 
 4070                        $this->
SetFont($prev_FontFamily, $prev_FontStyle, $prev_FontSizePt, 
'', 
'default', 
false);
 
 4090                if (($this->font_spacing < 0) OR (($this->font_spacing > 0) AND $notlast)) {
 
 4094                if ($this->font_stretching != 100) {
 
 4096                        $chw *= ($this->font_stretching / 100);
 
 4114                if (isset($this->CurrentFont[
'cw'][$char])) {
 
 4115                        $w = $this->CurrentFont[
'cw'][$char];
 
 4116                } elseif (isset($this->CurrentFont[
'dw'])) {
 
 4118                        $w = $this->CurrentFont[
'dw'];
 
 4119                } elseif (isset($this->CurrentFont[
'cw'][32])) {
 
 4121                        $w = $this->CurrentFont[
'cw'][32];
 
 4149                        while ((
$file = readdir($fontsdir)) !== 
false) {
 
 4150                                if (substr(
$file, -4) == 
'.php') {
 
 4151                                        array_push($this->fontlist, strtolower(basename(
$file, 
'.php')));
 
 4154                        closedir($fontsdir);
 
 4172                if ($subset === 
'default') {
 
 4175                if ($this->pdfa_mode) {
 
 4182                                $this->
Error(
'Empty font family');
 
 4186                if (substr($family, -1) == 
'I') {
 
 4188                        $family = substr($family, 0, -1);
 
 4190                if (substr($family, -1) == 
'B') {
 
 4192                        $family = substr($family, 0, -1);
 
 4195                $family = strtolower($family);
 
 4196                if ((!$this->isunicode) AND ($family == 
'arial')) {
 
 4197                        $family = 
'helvetica';
 
 4199                if (($family == 
'symbol') OR ($family == 
'zapfdingbats')) {
 
 4202                if ($this->pdfa_mode AND (isset($this->CoreFonts[$family]))) {
 
 4204                        $family = 
'pdfa'.$family;
 
 4206                $tempstyle = strtoupper(
$style);
 
 4209                if (strpos($tempstyle, 
'U') !== 
false) {
 
 4210                        $this->underline = 
true;
 
 4212                        $this->underline = 
false;
 
 4215                if (strpos($tempstyle, 
'D') !== 
false) {
 
 4216                        $this->linethrough = 
true;
 
 4218                        $this->linethrough = 
false;
 
 4221                if (strpos($tempstyle, 
'O') !== 
false) {
 
 4222                        $this->overline = 
true;
 
 4224                        $this->overline = 
false;
 
 4227                if (strpos($tempstyle, 
'B') !== 
false) {
 
 4231                if (strpos($tempstyle, 
'I') !== 
false) {
 
 4235                $fontkey = $family.$style;
 
 4236                $font_style = 
$style.($this->underline ? 
'U' : 
'').($this->linethrough ? 
'D' : 
'').($this->overline ? 
'O' : 
'');
 
 4237                $fontdata = array(
'fontkey' => $fontkey, 
'family' => $family, 
'style' => $font_style);
 
 4240                if ($fb !== 
false) {
 
 4241                        if ($this->inxobj) {
 
 4243                                $this->xobjects[
$this->xobjid][
'fonts'][$fontkey] = $fb[
'i'];
 
 4250                        $fontdir = dirname($fontfile);
 
 4258                $missing_style = 
false;
 
 4262                        $tmp_fontfile = str_replace(
' ', 
'', $family).strtolower(
$style).
'.php';
 
 4265                                $missing_style = 
true;
 
 4267                                $tmp_fontfile = str_replace(
' ', 
'', $family).
'.php';
 
 4275                        $this->
Error(
'Could not include font definition file: '.$family.
'');
 
 4278                if ((!isset($type)) OR (!isset($cw))) {
 
 4279                        $this->
Error(
'The font definition file has a bad format: '.$fontfile.
'');
 
 4289                        $cidinfo = array(
'Registry'=>
'Adobe', 
'Ordering'=>
'Identity', 
'Supplement'=>0);
 
 4290                        $cidinfo[
'uni2cid'] = array();
 
 4309                        if (isset($desc[
'MissingWidth']) AND ($desc[
'MissingWidth'] > 0)) {
 
 4310                                $dw = $desc[
'MissingWidth'];
 
 4311                        } elseif (isset($cw[32])) {
 
 4318                if ($type == 
'core') {
 
 4319                        $name = $this->CoreFonts[$fontkey];
 
 4321                } elseif (($type == 
'TrueType') OR ($type == 
'Type1')) {
 
 4323                } elseif ($type == 
'TrueTypeUnicode') {
 
 4324                        $enc = 
'Identity-H';
 
 4325                } elseif ($type == 
'cidfont0') {
 
 4326                        if ($this->pdfa_mode) {
 
 4327                                $this->
Error(
'All fonts must be embedded in PDF/A mode!');
 
 4330                        $this->
Error(
'Unknow font type: '.$type.
'');
 
 4333                if (!isset($name) OR empty($name)) {
 
 4337                if (($type != 
'core') AND $missing_style) {
 
 4339                        $styles = array(
'' => 
'', 
'B' => 
',Bold', 
'I' => 
',Italic', 
'BI' => 
',BoldItalic');
 
 4340                        $name .= $styles[$bistyle];
 
 4342                        if (strpos($bistyle, 
'B') !== 
false) {
 
 4343                                if (isset($desc[
'StemV'])) {
 
 4345                                        $desc[
'StemV'] = round($desc[
'StemV'] * 1.75);
 
 4348                                        $desc[
'StemV'] = 123;
 
 4352                        if (strpos($bistyle, 
'I') !== 
false) {
 
 4353                                if (isset($desc[
'ItalicAngle'])) {
 
 4354                                        $desc[
'ItalicAngle'] -= 11;
 
 4356                                        $desc[
'ItalicAngle'] = -11;
 
 4358                                if (isset($desc[
'Flags'])) {
 
 4359                                        $desc[
'Flags'] |= 64; 
 
 4361                                        $desc[
'Flags'] = 64;
 
 4366                if (!isset($cbbox)) {
 
 4370                $subsetchars = array_fill(0, 255, 
true);
 
 4371                $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));
 
 4372                if ($this->inxobj) {
 
 4376                if (isset($diff) AND (!empty($diff))) {
 
 4379                        $nb = count($this->diffs);
 
 4380                        for ($i=1; $i <= $nb; ++$i) {
 
 4381                                if ($this->diffs[$i] == $diff) {
 
 4388                                $this->diffs[
$d] = $diff;
 
 4393                        if (!isset($this->FontFiles[
$file])) {
 
 4394                                if ((strcasecmp($type,
'TrueType') == 0) OR (strcasecmp($type, 
'TrueTypeUnicode') == 0)) {
 
 4395                                        $this->FontFiles[
$file] = array(
'length1' => $originalsize, 
'fontdir' => $fontdir, 
'subset' => $subset, 
'fontkeys' => array($fontkey));
 
 4396                                } elseif ($type != 
'core') {
 
 4397                                        $this->FontFiles[
$file] = array(
'length1' => $size1, 
'length2' => $size2, 
'fontdir' => $fontdir, 
'subset' => $subset, 
'fontkeys' => array($fontkey));
 
 4401                                $this->FontFiles[
$file][
'subset'] = ($this->FontFiles[
$file][
'subset'] AND $subset);
 
 4402                                if (!in_array($fontkey, $this->FontFiles[
$file][
'fontkeys'])) {
 
 4403                                        $this->FontFiles[
$file][
'fontkeys'][] = $fontkey;
 
 4429                if (
$size === 
null) {
 
 4436                $fontdata = $this->
AddFont($family, 
$style, $fontfile, $subset);
 
 4437                $this->FontFamily = $fontdata[
'family'];
 
 4438                $this->FontStyle = $fontdata[
'style'];
 
 4439                if (isset($this->CurrentFont[
'fontkey']) AND isset($this->CurrentFont[
'subsetchars'])) {
 
 4441                        $this->
setFontSubBuffer($this->CurrentFont[
'fontkey'], 
'subsetchars', $this->CurrentFont[
'subsetchars']);
 
 4443                $this->CurrentFont = $this->
getFontBuffer($fontdata[
'fontkey']);
 
 4457                $this->FontSizePt = 
$size;
 
 4461                if (isset($this->CurrentFont[
'desc'][
'FontBBox'])) {
 
 4462                        $bbox = explode(
' ', substr($this->CurrentFont[
'desc'][
'FontBBox'], 1, -1));
 
 4463                        $font_height = ((intval($bbox[3]) - intval($bbox[1])) * 
$size / 1000);
 
 4465                        $font_height = 
$size * 1.219;
 
 4467                if (isset($this->CurrentFont[
'desc'][
'Ascent']) AND ($this->CurrentFont[
'desc'][
'Ascent'] > 0)) {
 
 4468                        $font_ascent = ($this->CurrentFont[
'desc'][
'Ascent'] * 
$size / 1000);
 
 4470                if (isset($this->CurrentFont[
'desc'][
'Descent']) AND ($this->CurrentFont[
'desc'][
'Descent'] <= 0)) {
 
 4471                        $font_descent = (- $this->CurrentFont[
'desc'][
'Descent'] * 
$size / 1000);
 
 4473                if (!isset($font_ascent) AND !isset($font_descent)) {
 
 4475                        $font_ascent = 0.76 * $font_height;
 
 4476                        $font_descent = $font_height - $font_ascent;
 
 4477                } elseif (!isset($font_descent)) {
 
 4478                        $font_descent = $font_height - $font_ascent;
 
 4479                } elseif (!isset($font_ascent)) {
 
 4480                        $font_ascent = $font_height - $font_descent;
 
 4482                $this->FontAscent = ($font_ascent / 
$this->k);
 
 4483                $this->FontDescent = ($font_descent / 
$this->k);
 
 4484                if (
$out AND ($this->page > 0) AND (isset($this->CurrentFont[
'i'])) AND ($this->state == 2)) {
 
 4485                        $this->
_out(sprintf(
'BT /F%d %F Tf ET', $this->CurrentFont[
'i'], $this->FontSizePt));
 
 4497                if (isset($this->CurrentFont[
'desc'][
'FontBBox'])) {
 
 4498                        $tmpbbox = explode(
' ', substr($this->CurrentFont[
'desc'][
'FontBBox'], 1, -1));
 
 4499                        $fbbox = array_map(array($this,
'getAbsFontMeasure'), $tmpbbox);
 
 4502                        if (isset($this->CurrentFont[
'desc'][
'MaxWidth'])) {
 
 4503                                $maxw = $this->
getAbsFontMeasure(intval($this->CurrentFont[
'desc'][
'MaxWidth']));
 
 4506                                if (isset($this->CurrentFont[
'desc'][
'MissingWidth'])) {
 
 4507                                        $maxw = max($maxw, $this->CurrentFont[
'desc'][
'MissingWidth']);
 
 4509                                if (isset($this->CurrentFont[
'desc'][
'AvgWidth'])) {
 
 4510                                        $maxw = max($maxw, $this->CurrentFont[
'desc'][
'AvgWidth']);
 
 4512                                if (isset($this->CurrentFont[
'dw'])) {
 
 4513                                        $maxw = max($maxw, $this->CurrentFont[
'dw']);
 
 4515                                foreach ($this->CurrentFont[
'cw'] as $char => 
$w) {
 
 4516                                        $maxw = max($maxw, 
$w);
 
 4523                        $fbbox = array(0, (0 - $this->FontDescent), $maxw, $this->FontAscent);
 
 4535                return ($s * $this->FontSize / 1000);
 
 4546                if (isset($this->CurrentFont[
'cw'][$c])) {
 
 4549                        if (isset($this->CurrentFont[
'cbbox'][$c])) {
 
 4550                                $result = $this->CurrentFont[
'cbbox'][$c];
 
 4552                        return array_map(array($this,
'getAbsFontMeasure'), 
$result);
 
 4570                if (isset($fontinfo[
'desc'][
'Descent']) AND ($fontinfo[
'desc'][
'Descent'] <= 0)) {
 
 4571                        $descent = (- $fontinfo[
'desc'][
'Descent'] * 
$size / 1000);
 
 4573                        $descent = (1.219 * 0.24 * 
$size);
 
 4575                return ($descent / $this->k);
 
 4591                if (isset($fontinfo[
'desc'][
'Ascent']) AND ($fontinfo[
'desc'][
'Ascent'] > 0)) {
 
 4592                        $ascent = ($fontinfo[
'desc'][
'Ascent'] * 
$size / 1000);
 
 4594                        $ascent = 1.219 * 0.76 * 
$size;
 
 4596                return ($ascent / $this->k);
 
 4609                if (is_string($char)) {
 
 4616                                return (isset($this->CurrentFont[
'cw'][intval($char)]));
 
 4622                return (isset($fontinfo[
'cw'][intval($char)]));
 
 4645                foreach ($uniarr as 
$k => $chr) {
 
 4646                        if (!isset($fontinfo[
'cw'][$chr])) {
 
 4648                                if (isset($subs[$chr])) {
 
 4650                                        if (is_array($subs[$chr])) {
 
 4651                                                foreach($subs[$chr] as $s) {
 
 4652                                                        if (isset($fontinfo[
'cw'][$s])) {
 
 4657                                        } elseif (isset($fontinfo[
'cw'][$subs[$chr]])) {
 
 4658                                                $uniarr[
$k] = $subs[$chr];
 
 4673                $this->default_monospaced_font = $font;
 
 4685                $n = count($this->links) + 1;
 
 4686                $this->links[
$n] = array(
'p' => 0, 
'y' => 0, 
'f' => 
false);
 
 4712                $this->links[$link] = array(
'p' => 
$page, 
'y' => 
$y, 
'f' => $fixed);
 
 4746                if ($this->inxobj) {
 
 4748                        $this->xobjects[
$this->xobjid][
'annotations'][] = array(
'x' => 
$x, 
'y' => 
$y, 
'w' => 
$w, 
'h' => 
$h, 
'text' => 
$text, 
'opt' => $opt, 
'spaces' => $spaces);
 
 4760                if (isset($this->transfmatrix) AND !empty($this->transfmatrix)) {
 
 4761                        for ($i=$this->transfmatrix_key; $i > 0; --$i) {
 
 4762                                $maxid = count($this->transfmatrix[$i]) - 1;
 
 4763                                for ($j=$maxid; $j >= 0; --$j) {
 
 4764                                        $ctm = $this->transfmatrix[$i][$j];
 
 4765                                        if (isset($ctm[
'a'])) {
 
 4767                                                $y = ($this->h - 
$y) * $this->k;
 
 4773                                                $x1 = ($ctm[
'a'] * $xt) + ($ctm[
'c'] * $yt) + $ctm[
'e'];
 
 4774                                                $y1 = ($ctm[
'b'] * $xt) + ($ctm[
'd'] * $yt) + $ctm[
'f'];
 
 4778                                                $x2 = ($ctm[
'a'] * $xt) + ($ctm[
'c'] * $yt) + $ctm[
'e'];
 
 4779                                                $y2 = ($ctm[
'b'] * $xt) + ($ctm[
'd'] * $yt) + $ctm[
'f'];
 
 4783                                                $x3 = ($ctm[
'a'] * $xt) + ($ctm[
'c'] * $yt) + $ctm[
'e'];
 
 4784                                                $y3 = ($ctm[
'b'] * $xt) + ($ctm[
'd'] * $yt) + $ctm[
'f'];
 
 4788                                                $x4 = ($ctm[
'a'] * $xt) + ($ctm[
'c'] * $yt) + $ctm[
'e'];
 
 4789                                                $y4 = ($ctm[
'b'] * $xt) + ($ctm[
'd'] * $yt) + $ctm[
'f'];
 
 4791                                                $x = min($x1, $x2, $x3, $x4);
 
 4792                                                $y = max($y1, $y2, $y3, $y4);
 
 4793                                                $w = (max($x1, $x2, $x3, $x4) - 
$x) / $this->k;
 
 4794                                                $h = (
$y - min($y1, $y2, $y3, $y4)) / $this->k;
 
 4801                if ($this->page <= 0) {
 
 4806                if (!isset($this->PageAnnots[
$page])) {
 
 4807                        $this->PageAnnots[
$page] = array();
 
 4809                $this->PageAnnots[
$page][] = array(
'n' => ++$this->n, 
'x' => 
$x, 
'y' => 
$y, 
'w' => 
$w, 
'h' => 
$h, 
'txt' => 
$text, 
'opt' => $opt, 
'numspaces' => $spaces);
 
 4810                if (!$this->pdfa_mode) {
 
 4813                                AND (!isset($this->embeddedfiles[basename($opt[
'FS'])]))) {
 
 4814                                $this->embeddedfiles[basename($opt[
'FS'])] = array(
'f' => ++$this->n, 
'n' => ++$this->n, 
'file' => $opt[
'FS']);
 
 4818                if (isset($opt[
'mk'][
'i']) AND @file_exists($opt[
'mk'][
'i'])) {
 
 4819                        $this->
Image($opt[
'mk'][
'i'], 
'', 
'', 10, 10, 
'', 
'', 
'', 
false, 300, 
'', 
false, 
false, 0, 
false, 
true);
 
 4821                if (isset($opt[
'mk'][
'ri']) AND @file_exists($opt[
'mk'][
'ri'])) {
 
 4822                        $this->
Image($opt[
'mk'][
'ri'], 
'', 
'', 0, 0, 
'', 
'', 
'', 
false, 300, 
'', 
false, 
false, 0, 
false, 
true);
 
 4824                if (isset($opt[
'mk'][
'ix']) AND @file_exists($opt[
'mk'][
'ix'])) {
 
 4825                        $this->
Image($opt[
'mk'][
'ix'], 
'', 
'', 0, 0, 
'', 
'', 
'', 
false, 300, 
'', 
false, 
false, 0, 
false, 
true);
 
 4836                if ($this->pdfa_mode) {
 
 4840                reset($this->embeddedfiles);
 
 4841                foreach ($this->embeddedfiles as 
$filename => $filedata) {
 
 4843                        if (
$data !== FALSE) {
 
 4844                                $rawsize = strlen(
$data);
 
 4847                                        $this->efnames[
$filename] = $filedata[
'f'].
' 0 R';
 
 4850                                        $out .= 
'<</Type /Filespec /F '.$this->_datastring(
$filename, $filedata[
'f']).
' /EF <</F '.$filedata[
'n'].
' 0 R>> >>';
 
 4851                                        $out .= 
"\n".
'endobj';
 
 4855                                        if ($this->compress) {
 
 4857                                                $filter = 
' /Filter /FlateDecode';
 
 4861                                        $out .= 
'<< /Type /EmbeddedFile'.$filter.
' /Length '.strlen($stream).
' /Params <</Size '.$rawsize.
'>> >>';
 
 4862                                        $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
 4863                                        $out .= 
"\n".
'endobj';
 
 4893        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) {
 
 4898                $this->
Cell(0, 0, 
$txt, 
$border, $ln, $align, $fill, $link, $stretch, $ignore_min_height, $calign, $valign);
 
 4914                if ($this->num_columns > 1) {
 
 4916                        if ($this->current_column < ($this->num_columns - 1)) {
 
 4919                        } elseif ($this->AutoPageBreak) {
 
 4949                                $this->
AddPage($this->CurOrientation);
 
 4951                                $oldpage = $this->page - 1;
 
 4953                                        if ($this->pagedim[$this->page][
'orm'] != $this->pagedim[$oldpage][
'orm']) {
 
 4954                                                $this->x = 
$x - ($this->pagedim[
$this->page][
'orm'] - $this->pagedim[$oldpage][
'orm']);
 
 4959                                        if ($this->pagedim[$this->page][
'olm'] != $this->pagedim[$oldpage][
'olm']) {
 
 4960                                                $this->x = 
$x + ($this->pagedim[
$this->page][
'olm'] - $this->pagedim[$oldpage][
'olm']);
 
 4968                if ($current_page != $this->page) {
 
 4994        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') {
 
 4998                if (!$ignore_min_height) {
 
 5000                        if (
$h < $min_cell_height) {
 
 5001                                $h = $min_cell_height;
 
 5004                $this->
checkPageBreak(
$h + $this->cell_margin[
'T'] + $this->cell_margin[
'B']);
 
 5006                if ($this->txtshadow[
'enabled']) {
 
 5015                        $this->x += $this->txtshadow[
'depth_w'];
 
 5016                        $this->y += $this->txtshadow[
'depth_h'];
 
 5020                        if ($this->txtshadow[
'opacity'] != 
$alpha[
'CA']) {
 
 5021                                $this->
setAlpha($this->txtshadow[
'opacity'], $this->txtshadow[
'blend_mode']);
 
 5023                        if ($this->state == 2) {
 
 5024                                $this->
_out($this->
getCellCode(
$w, 
$h, 
$txt, 
$border, $ln, $align, $fill, $link, $stretch, 
true, $calign, $valign));
 
 5032                        if ($this->txtshadow[
'opacity'] != 
$alpha[
'CA']) {
 
 5036                if ($this->state == 2) {
 
 5037                        $this->
_out($this->
getCellCode(
$w, 
$h, 
$txt, 
$border, $ln, $align, $fill, $link, $stretch, 
true, $calign, $valign));
 
 5039                $this->cell_padding = $prev_cell_padding;
 
 5040                $this->cell_margin = $prev_cell_margin;
 
 5063        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') {
 
 5071                if (!$ignore_min_height) {
 
 5073                        if (
$h < $min_cell_height) {
 
 5074                                $h = $min_cell_height;
 
 5081                        $x = $this->x - $this->cell_margin[
'R'];
 
 5083                        $x = $this->x + $this->cell_margin[
'L'];
 
 5085                $y = $this->y + $this->cell_margin[
'T'];
 
 5095                                                $y -= $this->cell_padding[
'T'];
 
 5146                                                $y -= (
$h - $this->cell_padding[
'B']);
 
 5180                                $yt = 
$y + $this->cell_padding[
'T'];
 
 5201                                $w = $this->w - $this->rMargin - 
$x;
 
 5210                if ($fill OR (
$border == 1)) {
 
 5212                                $op = (
$border == 1) ? 
'B' : 
'f';
 
 5221                        $s .= sprintf(
'%F %F %F %F re %s ', $xk, (($this->h - 
$y) * 
$k), (
$w * 
$k), (-
$h * 
$k), $op);
 
 5227                        if ($this->isunicode) {
 
 5228                                if (($this->CurrentFont[
'type'] == 
'core') OR ($this->CurrentFont[
'type'] == 
'TrueType') OR ($this->CurrentFont[
'type'] == 
'Type1')) {
 
 5232                                        $unicode = 
TCPDF_FONTS::utf8Bidi($unicode, 
'', $this->tmprtl, $this->isunicode, $this->CurrentFont);
 
 5236                                                $numchars = count($unicode);
 
 5238                                                $longtail = array(0x0e1b, 0x0e1d, 0x0e1f);
 
 5240                                                $lowtail = array(0x0e0e, 0x0e0f);
 
 5242                                                $upvowel = array(0x0e31, 0x0e34, 0x0e35, 0x0e36, 0x0e37);
 
 5244                                                $tonemark = array(0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c);
 
 5246                                                $lowvowel = array(0x0e38, 0x0e39, 0x0e3a);
 
 5248                                                for ($i = 0; $i < $numchars; $i++) {
 
 5249                                                        if (($unicode[$i] >= 0x0e00) && ($unicode[$i] <= 0x0e5b)) {
 
 5250                                                                $ch0 = $unicode[$i];
 
 5251                                                                $ch1 = ($i > 0) ? $unicode[($i - 1)] : 0;
 
 5252                                                                $ch2 = ($i > 1) ? $unicode[($i - 2)] : 0;
 
 5253                                                                $chn = ($i < ($numchars - 1)) ? $unicode[($i + 1)] : 0;
 
 5254                                                                if (in_array($ch0, $tonemark)) {
 
 5255                                                                        if ($chn == 0x0e33) {
 
 5257                                                                                if (in_array($ch1, $longtail)) {
 
 5259                                                                                        $output[] = $this->
replaceChar($ch0, (0xf713 + $ch0 - 0x0e48));
 
 5264                                                                        } elseif (in_array($ch1, $longtail) OR (in_array($ch2, $longtail) AND in_array($ch1, $lowvowel))) {
 
 5266                                                                                $output[] = $this->
replaceChar($ch0, (0xf705 + $ch0 - 0x0e48));
 
 5267                                                                        } elseif (in_array($ch1, $upvowel)) {
 
 5268                                                                                if (in_array($ch2, $longtail)) {
 
 5270                                                                                        $output[] = $this->
replaceChar($ch0, (0xf713 + $ch0 - 0x0e48));
 
 5277                                                                                $output[] = $this->
replaceChar($ch0, (0xf70a + $ch0 - 0x0e48));
 
 5279                                                                } elseif (($ch0 == 0x0e33) AND (in_array($ch1, $longtail) OR (in_array($ch2, $longtail) AND in_array($ch1, $tonemark)))) {
 
 5283                                                                                $this->CurrentFont[
'subsetchars'][0xf711] = 
true;
 
 5285                                                                                $this->CurrentFont[
'subsetchars'][0x0e32] = 
true;
 
 5289                                                                } elseif (in_array($ch1, $longtail)) {
 
 5290                                                                        if ($ch0 == 0x0e31) {
 
 5293                                                                        } elseif (in_array($ch0, $upvowel)) {
 
 5295                                                                                $output[] = $this->
replaceChar($ch0, (0xf701 + $ch0 - 0x0e34));
 
 5296                                                                        } elseif ($ch0 == 0x0e47) {
 
 5303                                                                } elseif (in_array($ch1, $lowtail) AND in_array($ch0, $lowvowel)) {
 
 5305                                                                        $output[] = $this->
replaceChar($ch0, (0xf718 + $ch0 - 0x0e38));
 
 5306                                                                } elseif (($ch0 == 0x0e0d) AND in_array($chn, $lowvowel)) {
 
 5309                                                                } elseif (($ch0 == 0x0e10) AND in_array($chn, $lowvowel)) {
 
 5317                                                                $output[] = $unicode[$i];
 
 5322                                                $this->
setFontSubBuffer($this->CurrentFont[
'fontkey'], 
'subsetchars', $this->CurrentFont[
'subsetchars']);
 
 5337                                        $ratio = ((
$w - $this->cell_padding[
'L'] - $this->cell_padding[
'R']) / $width);
 
 5340                                if (($ratio < 1) OR (($ratio > 1) AND (($stretch % 2) == 0))) {
 
 5344                                                $this->font_spacing += (
$w - $this->cell_padding[
'L'] - $this->cell_padding[
'R'] - $width) / (max(($this->
GetNumChars(
$txt) - 1), 1) * ($this->font_stretching / 100));
 
 5347                                                $this->font_stretching *= $ratio;
 
 5350                                        $width = 
$w - $this->cell_padding[
'L'] - $this->cell_padding[
'R'];
 
 5355                        if ($this->font_stretching != 100) {
 
 5357                                $rs .= sprintf(
'BT %F Tz ET ', $this->font_stretching);
 
 5359                        if ($this->font_spacing != 0) {
 
 5361                                $rs .= sprintf(
'BT %F Tc ET ', ($this->font_spacing * $this->k));
 
 5363                        if ($this->ColorFlag AND ($this->textrendermode < 4)) {
 
 5364                                $s .= 
'q '.$this->TextColor.
' ';
 
 5367                        $s .= sprintf(
'BT %d Tr %F w ET ', $this->textrendermode, ($this->textstrokewidth * $this->k));
 
 5369                        $ns = substr_count(
$txt, chr(32));
 
 5372                        if (($align == 
'J') AND ($ns > 0)) {
 
 5377                                        $spacewidth = -1000 * (
$w - $width - $this->cell_padding[
'L'] - $this->cell_padding[
'R']) / ($ns?$ns:1) / ($this->FontSize?$this->FontSize:1);
 
 5378                                        if ($this->font_stretching != 100) {
 
 5380                                                $spacewidth /= ($this->font_stretching / 100);
 
 5383                                        $txt2 = str_replace(chr(0).chr(32), 
') '.sprintf(
'%F', $spacewidth).
' (', $txt2);
 
 5384                                        $unicode_justification = 
true;
 
 5389                                        $spacewidth = ((
$w - $width - $this->cell_padding[
'L'] - $this->cell_padding[
'R']) / ($ns?$ns:1)) * $this->k;
 
 5390                                        if ($this->font_stretching != 100) {
 
 5392                                                $spacewidth /= ($this->font_stretching / 100);
 
 5395                                        $rs .= sprintf(
'BT %F Tw ET ', $spacewidth);
 
 5397                                $width = 
$w - $this->cell_padding[
'L'] - $this->cell_padding[
'R'];
 
 5400                        $txt2 = str_replace(
"\r", 
' ', $txt2);
 
 5403                                        $dx = (
$w - $width) / 2;
 
 5408                                                $dx = $this->cell_padding[
'R'];
 
 5410                                                $dx = 
$w - $width - $this->cell_padding[
'R'];
 
 5416                                                $dx = 
$w - $width - $this->cell_padding[
'L'];
 
 5418                                                $dx = $this->cell_padding[
'L'];
 
 5425                                                $dx = $this->cell_padding[
'R'];
 
 5427                                                $dx = $this->cell_padding[
'L'];
 
 5433                                $xdx = 
$x - $dx - $width;
 
 5439                        $s .= sprintf(
'BT %F %F Td [(%s)] TJ ET', $xdk, (($this->h - $basefonty) * 
$k), $txt2);
 
 5440                        if (isset($uniblock)) {
 
 5444                                $spw = ((
$w - $txwidth - $this->cell_padding[
'L'] - $this->cell_padding[
'R']) / ($ns?$ns:1));
 
 5445                                foreach ($uniblock as $uk => $uniarr) {
 
 5446                                        if (($uk % 2) == 0) {
 
 5448                                                if ($spacewidth != 0) {
 
 5450                                                        $xshift += (count(array_keys($uniarr, 32)) * $spw);
 
 5457                                                $s .= sprintf(
' BT %F %F Td [(%s)] TJ ET', ($xdk + ($xshift * 
$k)), $ty, $topchr);
 
 5461                        if ($this->underline) {
 
 5462                                $s .= 
' '.$this->_dounderlinew($xdx, $basefonty, $width);
 
 5464                        if ($this->linethrough) {
 
 5465                                $s .= 
' '.$this->_dolinethroughw($xdx, $basefonty, $width);
 
 5467                        if ($this->overline) {
 
 5468                                $s .= 
' '.$this->_dooverlinew($xdx, $basefonty, $width);
 
 5470                        if ($this->ColorFlag AND ($this->textrendermode < 4)) {
 
 5474                                $this->
Link($xdx, $yt, $width, ($this->FontAscent + $this->FontDescent), $link, $ns);
 
 5481                        if ($this->font_spacing != 0) {
 
 5483                                $rs .= 
' BT 0 Tc ET';
 
 5485                        if ($this->font_stretching != 100) {
 
 5487                                $rs .= 
' BT 100 Tz ET';
 
 5492                        $rs .= 
' BT 0 Tw ET';
 
 5495                $this->font_stretching = $prev_font_stretching;
 
 5496                $this->font_spacing = $prev_font_spacing;
 
 5500                        $this->y = 
$y + 
$h + $this->cell_margin[
'B'];
 
 5511                                $this->x = 
$x - 
$w - $this->cell_margin[
'L'];
 
 5513                                $this->x = 
$x + 
$w + $this->cell_margin[
'R'];
 
 5516                $gstyles = 
''.$this->linestyleWidth.
' '.$this->linestyleCap.
' '.$this->linestyleJoin.
' '.$this->linestyleDash.
' '.$this->DrawColor.
' '.$this->FillColor.
"\n";
 
 5518                $this->cell_padding = $prev_cell_padding;
 
 5519                $this->cell_margin = $prev_cell_margin;
 
 5534                        $this->CurrentFont[
'subsetchars'][$newchar] = 
true;
 
 5560                        $brd = array(
'LRTB' => 
true);
 
 5571                $yeL = (($this->h - (
$y + 
$h)) * 
$k);
 
 5572                $yeT = (($this->h - 
$y) * 
$k);
 
 5577                if (is_string($brd)) {
 
 5579                        $slen = strlen($brd);
 
 5581                        for ($i = 0; $i < $slen; ++$i) {
 
 5582                                $newbrd[$brd[$i]] = array(
'cap' => 
'square', 
'join' => 
'miter');
 
 5586                if (isset($brd[
'mode'])) {
 
 5587                        $mode = $brd[
'mode'];
 
 5588                        unset($brd[
'mode']);
 
 5595                                $prev_style = $this->linestyleWidth.
' '.$this->linestyleCap.
' '.$this->linestyleJoin.
' '.$this->linestyleDash.
' '.$this->DrawColor.
' ';
 
 5600                                        $off = (($this->LineWidth / 2) * 
$k);
 
 5614                                        $off = ($this->LineWidth / 2) * 
$k;
 
 5642                                $s .= sprintf(
'%F %F %F %F re S ', $xT, $yT, (
$w * 
$k), (-
$h * 
$k));
 
 5643                        } elseif (strlen(
$border) == 3) {
 
 5644                                if (strpos(
$border,
'B') === 
false) { 
 
 5645                                        $s .= sprintf(
'%F %F m ', $xL, $yL);
 
 5646                                        $s .= sprintf(
'%F %F l ', $xT, $yT);
 
 5647                                        $s .= sprintf(
'%F %F l ', $xR, $yR);
 
 5648                                        $s .= sprintf(
'%F %F l ', $xB, $yB);
 
 5650                                } elseif (strpos(
$border,
'L') === 
false) { 
 
 5651                                        $s .= sprintf(
'%F %F m ', $xT, $yT);
 
 5652                                        $s .= sprintf(
'%F %F l ', $xR, $yR);
 
 5653                                        $s .= sprintf(
'%F %F l ', $xB, $yB);
 
 5654                                        $s .= sprintf(
'%F %F l ', $xL, $yL);
 
 5656                                } elseif (strpos(
$border,
'T') === 
false) { 
 
 5657                                        $s .= sprintf(
'%F %F m ', $xR, $yR);
 
 5658                                        $s .= sprintf(
'%F %F l ', $xB, $yB);
 
 5659                                        $s .= sprintf(
'%F %F l ', $xL, $yL);
 
 5660                                        $s .= sprintf(
'%F %F l ', $xT, $yT);
 
 5662                                } elseif (strpos(
$border,
'R') === 
false) { 
 
 5663                                        $s .= sprintf(
'%F %F m ', $xB, $yB);
 
 5664                                        $s .= sprintf(
'%F %F l ', $xL, $yL);
 
 5665                                        $s .= sprintf(
'%F %F l ', $xT, $yT);
 
 5666                                        $s .= sprintf(
'%F %F l ', $xR, $yR);
 
 5669                        } elseif (strlen(
$border) == 2) {
 
 5670                                if ((strpos(
$border,
'L') !== 
false) AND (strpos(
$border,
'T') !== 
false)) { 
 
 5671                                        $s .= sprintf(
'%F %F m ', $xL, $yL);
 
 5672                                        $s .= sprintf(
'%F %F l ', $xT, $yT);
 
 5673                                        $s .= sprintf(
'%F %F l ', $xR, $yR);
 
 5675                                } elseif ((strpos(
$border,
'T') !== 
false) AND (strpos(
$border,
'R') !== 
false)) { 
 
 5676                                        $s .= sprintf(
'%F %F m ', $xT, $yT);
 
 5677                                        $s .= sprintf(
'%F %F l ', $xR, $yR);
 
 5678                                        $s .= sprintf(
'%F %F l ', $xB, $yB);
 
 5680                                } elseif ((strpos(
$border,
'R') !== 
false) AND (strpos(
$border,
'B') !== 
false)) { 
 
 5681                                        $s .= sprintf(
'%F %F m ', $xR, $yR);
 
 5682                                        $s .= sprintf(
'%F %F l ', $xB, $yB);
 
 5683                                        $s .= sprintf(
'%F %F l ', $xL, $yL);
 
 5685                                } elseif ((strpos(
$border,
'B') !== 
false) AND (strpos(
$border,
'L') !== 
false)) { 
 
 5686                                        $s .= sprintf(
'%F %F m ', $xB, $yB);
 
 5687                                        $s .= sprintf(
'%F %F l ', $xL, $yL);
 
 5688                                        $s .= sprintf(
'%F %F l ', $xT, $yT);
 
 5690                                } elseif ((strpos(
$border,
'L') !== 
false) AND (strpos(
$border,
'R') !== 
false)) { 
 
 5691                                        $s .= sprintf(
'%F %F m ', $xL, $yL);
 
 5692                                        $s .= sprintf(
'%F %F l ', $xT, $yT);
 
 5694                                        $s .= sprintf(
'%F %F m ', $xR, $yR);
 
 5695                                        $s .= sprintf(
'%F %F l ', $xB, $yB);
 
 5697                                } elseif ((strpos(
$border,
'T') !== 
false) AND (strpos(
$border,
'B') !== 
false)) { 
 
 5698                                        $s .= sprintf(
'%F %F m ', $xT, $yT);
 
 5699                                        $s .= sprintf(
'%F %F l ', $xR, $yR);
 
 5701                                        $s .= sprintf(
'%F %F m ', $xB, $yB);
 
 5702                                        $s .= sprintf(
'%F %F l ', $xL, $yL);
 
 5706                                if (strpos(
$border,
'L') !== 
false) { 
 
 5707                                        $s .= sprintf(
'%F %F m ', $xL, $yL);
 
 5708                                        $s .= sprintf(
'%F %F l ', $xT, $yT);
 
 5710                                } elseif (strpos(
$border,
'T') !== 
false) { 
 
 5711                                        $s .= sprintf(
'%F %F m ', $xT, $yT);
 
 5712                                        $s .= sprintf(
'%F %F l ', $xR, $yR);
 
 5714                                } elseif (strpos(
$border,
'R') !== 
false) { 
 
 5715                                        $s .= sprintf(
'%F %F m ', $xR, $yR);
 
 5716                                        $s .= sprintf(
'%F %F l ', $xB, $yB);
 
 5718                                } elseif (strpos(
$border,
'B') !== 
false) { 
 
 5719                                        $s .= sprintf(
'%F %F m ', $xB, $yB);
 
 5720                                        $s .= sprintf(
'%F %F l ', $xL, $yL);
 
 5726                                $s .= 
"\n".$this->linestyleWidth.
' '.$this->linestyleCap.
' '.$this->linestyleJoin.
' '.$this->linestyleDash.
' '.$this->DrawColor.
"\n";
 
 5757        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) {
 
 5764                $this->cell_padding[
'T'] = 0;
 
 5765                $this->cell_padding[
'B'] = 0;
 
 5777                if ((
$h > 0) AND $this->
inPageBody() AND ((
$y + 
$h + $mc_margin[
'T'] + $mc_margin[
'B']) > $this->PageBreakTrigger)) {
 
 5779                        $newh = ($this->PageBreakTrigger - 
$y);
 
 5780                        $resth = (
$h - $newh); 
 
 5795                $oy = 
$y + $mc_margin[
'T'];
 
 5797                        $ox = ($this->w - 
$x - $mc_margin[
'R']);
 
 5799                        $ox = (
$x + $mc_margin[
'L']);
 
 5806                                $w = ($this->x - $this->lMargin - $mc_margin[
'L']);
 
 5808                                $w = ($this->w - $this->x - $this->rMargin - $mc_margin[
'R']);
 
 5815                        $this->rMargin = ($this->w - 
$this->x);
 
 5816                        $this->lMargin = ($this->x - 
$w);
 
 5819                        $this->rMargin = ($this->w - $this->x - 
$w);
 
 5825                        $this->y += $mc_padding[
'T'];
 
 5834                                $tobottom = ($this->h - $this->y - $this->bMargin - $this->cell_padding[
'T'] - $this->cell_padding[
'B']);
 
 5835                                $h = $maxh = max(min(
$h, $tobottom), min($maxh, $tobottom));
 
 5841                                if ($fitcell AND ($text_height > $maxh) AND ($this->FontSizePt > 1)) {
 
 5846                                        $maxit = (2 * min(100, max(10, intval($fmax)))); 
 
 5847                                        while ($maxit >= 0) {
 
 5848                                                $fmid = (($fmax + $fmin) / 2);
 
 5852                                                $diff = ($maxh - $text_height);
 
 5854                                                        if ($diff <= $diff_epsilon) {
 
 5873                                if ($text_height < $maxh) {
 
 5874                                        if ($valign == 
'M') {
 
 5876                                                $this->y += (($maxh - $text_height) / 2);
 
 5877                                        } elseif ($valign == 
'B') {
 
 5879                                                $this->y += ($maxh - $text_height);
 
 5883                        $nl = $this->
Write($this->lasth, 
$txt, 
'', 0, $align, 
true, $stretch, 
false, 
true, $maxh, 0, $mc_margin);
 
 5891                        $this->y += $mc_padding[
'B'];
 
 5898                        $skip = ($endpage - $startpage);
 
 5900                        while ($tmpresth > 0) {
 
 5905                                if ($this->num_columns > 1) {
 
 5917                if ($this->num_columns == 0) {
 
 5918                        $this->num_columns = 1;
 
 5922                $this->check_page_regions = 
false;
 
 5931                        if ($this->num_columns < 2) {
 
 5937                        if (
$page > $startpage) {
 
 5938                                if (($this->rtl) AND ($this->pagedim[
$page][
'orm'] != $this->pagedim[$startpage][
'orm'])) {
 
 5939                                        $this->x -= ($this->pagedim[
$page][
'orm'] - $this->pagedim[$startpage][
'orm']);
 
 5940                                } elseif ((!$this->rtl) AND ($this->pagedim[
$page][
'olm'] != $this->pagedim[$startpage][
'olm'])) {
 
 5941                                        $this->x += ($this->pagedim[
$page][
'olm'] - $this->pagedim[$startpage][
'olm']);
 
 5944                        if ($startpage == $endpage) {
 
 5946                                for ($column = $startcolumn; $column <= $endcolumn; ++$column) { 
 
 5949                                                $this->x -= $mc_margin[
'R'];
 
 5951                                                $this->x += $mc_margin[
'L'];
 
 5953                                        if ($startcolumn == $endcolumn) { 
 
 5955                                                $h = max(
$h, ($currentY - $oy));
 
 5957                                        } elseif ($column == $startcolumn) { 
 
 5958                                                $cborder = $border_start;
 
 5961                                        } elseif ($column == $endcolumn) { 
 
 5962                                                $cborder = $border_end;
 
 5968                                                $cborder = $border_middle;
 
 5972                                        $ccode .= $this->
getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
 5974                        } elseif (
$page == $startpage) { 
 
 5978                                                $this->x -= $mc_margin[
'R'];
 
 5980                                                $this->x += $mc_margin[
'L'];
 
 5982                                        if ($column == $startcolumn) { 
 
 5983                                                $cborder = $border_start;
 
 5987                                                $cborder = $border_middle;
 
 5991                                        $ccode .= $this->
getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
 5993                        } elseif (
$page == $endpage) { 
 
 5994                                for ($column = 0; $column <= $endcolumn; ++$column) { 
 
 5997                                                $this->x -= $mc_margin[
'R'];
 
 5999                                                $this->x += $mc_margin[
'L'];
 
 6001                                        if ($column == $endcolumn) {
 
 6003                                                $cborder = $border_end;
 
 6010                                                $cborder = $border_middle;
 
 6014                                        $ccode .= $this->
getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
 6020                                                $this->x -= $mc_margin[
'R'];
 
 6022                                                $this->x += $mc_margin[
'L'];
 
 6024                                        $cborder = $border_middle;
 
 6027                                        $ccode .= $this->
getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
 6030                        if ($cborder OR $fill) {
 
 6031                                $offsetlen = strlen($ccode);
 
 6033                                if ($this->inxobj) {
 
 6035                                        if (end($this->xobjects[$this->xobjid][
'transfmrk']) !== 
false) {
 
 6036                                                $pagemarkkey = key($this->xobjects[$this->xobjid][
'transfmrk']);
 
 6037                                                $pagemark = $this->xobjects[
$this->xobjid][
'transfmrk'][$pagemarkkey];
 
 6038                                                $this->xobjects[
$this->xobjid][
'transfmrk'][$pagemarkkey] += $offsetlen;
 
 6044                                        $pstart = substr($pagebuff, 0, $pagemark);
 
 6045                                        $pend = substr($pagebuff, $pagemark);
 
 6046                                        $this->xobjects[
$this->xobjid][
'outdata'] = $pstart.$ccode.$pend;
 
 6048                                        if (end($this->transfmrk[$this->page]) !== 
false) {
 
 6049                                                $pagemarkkey = key($this->transfmrk[$this->page]);
 
 6050                                                $pagemark = $this->transfmrk[
$this->page][$pagemarkkey];
 
 6051                                                $this->transfmrk[
$this->page][$pagemarkkey] += $offsetlen;
 
 6052                                        } elseif ($this->InFooter) {
 
 6060                                        $pstart = substr($pagebuff, 0, $pagemark);
 
 6061                                        $pend = substr($pagebuff, $pagemark);
 
 6069                $currentY = $this->
GetY();
 
 6071                if ($this->num_columns > 1) {
 
 6077                        if ($this->page > $startpage) {
 
 6079                                $dl = ($this->pagedim[
$this->page][
'olm'] - $this->pagedim[$startpage][
'olm']);
 
 6080                                $dr = ($this->pagedim[
$this->page][
'orm'] - $this->pagedim[$startpage][
'orm']);
 
 6081                                if (($dl != 0) OR ($dr != 0)) {
 
 6082                                        $this->lMargin += $dl;
 
 6083                                        $this->rMargin += $dr;
 
 6089                        $this->
SetY($currentY + $mc_margin[
'B']);
 
 6091                                $this->
SetX(
$x + 
$w + $mc_margin[
'L'] + $mc_margin[
'R']);
 
 6097                        $this->
SetX(
$x + 
$w + $mc_margin[
'L'] + $mc_margin[
'R']);
 
 6100                $this->cell_padding = $prev_cell_padding;
 
 6101                $this->cell_margin = $prev_cell_margin;
 
 6121                if (
$txt === NULL) {
 
 6131                if (is_array($cellpadding)) {
 
 6132                        $this->cell_padding = $cellpadding;
 
 6142                $wmax = 
$w - $this->cell_padding[
'L'] - $this->cell_padding[
'R'];
 
 6151                $length = count($chars);
 
 6152                $lastSeparator = -1;
 
 6153                for ($i = 0; $i < $length; ++$i) {
 
 6155                        $charWidth = $charsWidth[$i];
 
 6160                                                        AND ($i > 0) AND ($i < ($length - 1))
 
 6161                                                        AND @preg_match(
'/[\p{L}]/'.$this->re_space[
'm'], 
TCPDF_FONTS::unichr($chars[($i - 1)], $this->isunicode))
 
 6162                                                        AND @preg_match(
'/[\p{L}]/'.$this->re_space[
'm'], 
TCPDF_FONTS::unichr($chars[($i + 1)], $this->isunicode))
 
 6166                                $lastSeparator = $i;
 
 6168                        if ((($sum + $charWidth) > $wmax) OR ($c == 10)) {
 
 6171                                        $lastSeparator = -1;
 
 6173                                } elseif ($lastSeparator != -1) {
 
 6174                                        $i = $lastSeparator;
 
 6175                                        $lastSeparator = -1;
 
 6184                if ($chars[($length - 1)] == 10) {
 
 6187                $this->cell_padding = $prev_cell_padding;
 
 6188                $this->lasth = $prev_lasth;
 
 6243                if (is_array($cellpadding)) {
 
 6244                        $this->cell_padding = $cellpadding;
 
 6248                $height = $this->
getCellHeight(($lines * $this->FontSize), $autopadding);
 
 6249                $this->cell_padding = $prev_cell_padding;
 
 6250                $this->lasth = $prev_lasth;
 
 6272        public function Write(
$h, 
$txt, $link=
'', $fill=
false, $align=
'', $ln=
false, $stretch=0, $firstline=
false, $firstblock=
false, $maxh=0, $wadj=0, $margin=
'') {
 
 6275                if (strlen(
$txt) == 0) {
 
 6279                if ($margin === 
'') {
 
 6284                $s = str_replace(
"\r", 
'', 
$txt);
 
 6303                array_walk($chrw, array($this, 
'getRawCharWidth'));
 
 6304                $maxchwidth = max($chrw);
 
 6308                $nb = count($chars);
 
 6310                $shy_replacement = 45;
 
 6313                $shy_replacement_width = $this->
GetCharWidth($shy_replacement);
 
 6323                $wmax = (
$w - $wadj);
 
 6325                        $wmax -= ($this->cell_padding[
'L'] + $this->cell_padding[
'R']);
 
 6327                if ((!$firstline) AND (($chrwidth > $wmax) OR ($maxchwidth > $wmax))) {
 
 6334                $maxy = $this->y + $maxh - max($row_height, 
$h);
 
 6348                        if (($maxh > 0) AND ($this->y > $maxy) ) {
 
 6355                                if ($align == 
'J') {
 
 6367                                        $tmparr = array_slice($chars, $j, ($i - $j));
 
 6369                                                $tmparr = 
TCPDF_FONTS::utf8Bidi($tmparr, $tmpstr, $this->tmprtl, $this->isunicode, $this->CurrentFont);
 
 6374                                                $this->endlinex = $startx - $linew;
 
 6376                                                $this->endlinex = $startx + $linew;
 
 6388                                if (!empty($tmpstr) OR ($this->y < ($this->PageBreakTrigger - $row_height))) {
 
 6389                                        $this->
Cell(
$w, 
$h, $tmpstr, 0, 1, $talign, $fill, $link, $stretch);
 
 6393                                        $this->cell_padding = $tmpcellpadding;
 
 6403                                if ((($this->y + $this->lasth) > $this->PageBreakTrigger) AND ($this->
inPageBody())) {
 
 6406                                                $this->x -= $margin[
'R'];
 
 6408                                                $this->x += $margin[
'L'];
 
 6410                                        $this->lMargin += $margin[
'L'];
 
 6411                                        $this->rMargin += $margin[
'R'];
 
 6414                                $wmax = (
$w - $this->cell_padding[
'L'] - $this->cell_padding[
'R']);
 
 6425                                                        AND ($i < ($nb - 1))
 
 6426                                                        AND @preg_match(
'/[\p{L}]/'.$this->re_space[
'm'], 
TCPDF_FONTS::unichr($pc, $this->isunicode))
 
 6427                                                        AND @preg_match(
'/[\p{L}]/'.$this->re_space[
'm'], 
TCPDF_FONTS::unichr($chars[($i + 1)], $this->isunicode))
 
 6435                                        if (($c == 173) OR ($c == 45)) {
 
 6439                                                        $tmp_shy_replacement_width = 0;
 
 6440                                                        $tmp_shy_replacement_char = 
'';
 
 6442                                                        $tmp_shy_replacement_width = $shy_replacement_width;
 
 6443                                                        $tmp_shy_replacement_char = $shy_replacement_char;
 
 6457                                if ((
$l > $wmax) OR (($c == 173) AND ((
$l + $tmp_shy_replacement_width) >= $wmax))) {
 
 6458                                        if (($c == 173) AND ((
$l + $tmp_shy_replacement_width) > $wmax)) {
 
 6465                                                if (($this->rtl AND ($this->x <= ($this->w - $this->rMargin - $this->cell_padding[
'R'] - $margin[
'R'] - $chrwidth)))
 
 6466                                                        OR ((!$this->rtl) AND ($this->x >= ($this->lMargin + $this->cell_padding[
'L'] + $margin[
'L'] + $chrwidth)))) {
 
 6478                                                                $tmparr = array_slice($chars, $j, ($i - $j));
 
 6480                                                                        $tmparr = 
TCPDF_FONTS::utf8Bidi($tmparr, $tmpstr, $this->tmprtl, $this->isunicode, $this->CurrentFont);
 
 6485                                                                        $this->endlinex = $startx - $linew;
 
 6487                                                                        $this->endlinex = $startx + $linew;
 
 6498                                                        $this->
Cell(
$w, 
$h, $tmpstr, 0, 1, $align, $fill, $link, $stretch);
 
 6501                                                                $this->cell_padding = $tmpcellpadding;
 
 6509                                                if ($this->rtl AND (!$firstblock) AND ($sep < $i)) {
 
 6517                                                if (isset($nextstr[0]) AND ($this->
GetStringWidth($nextstr[0]) > $pw)) {
 
 6522                                                                $tmparr = array_slice($chars, $j, ($i - $j));
 
 6524                                                                        $tmparr = 
TCPDF_FONTS::utf8Bidi($tmparr, $tmpstr, $this->tmprtl, $this->isunicode, $this->CurrentFont);
 
 6529                                                                        $this->endlinex = ($startx - $linew);
 
 6531                                                                        $this->endlinex = ($startx + $linew);
 
 6542                                                        $this->
Cell(
$w, 
$h, $tmpstr, 0, 1, $align, $fill, $link, $stretch);
 
 6545                                                                $this->cell_padding = $tmpcellpadding;
 
 6554                                                                $shy_width = $tmp_shy_replacement_width;
 
 6556                                                                        $shy_char_left = $tmp_shy_replacement_char;
 
 6557                                                                        $shy_char_right = 
'';
 
 6559                                                                        $shy_char_left = 
'';
 
 6560                                                                        $shy_char_right = $tmp_shy_replacement_char;
 
 6564                                                                $shy_char_left = 
'';
 
 6565                                                                $shy_char_right = 
'';
 
 6570                                                                $tmparr = array_slice($chars, $j, (($sep + $endspace) - $j));
 
 6572                                                                        $tmparr = 
TCPDF_FONTS::utf8Bidi($tmparr, $tmpstr, $this->tmprtl, $this->isunicode, $this->CurrentFont);
 
 6577                                                                        $this->endlinex = $startx - $linew - $shy_width;
 
 6579                                                                        $this->endlinex = $startx + $linew + $shy_width;
 
 6591                                                        $this->
Cell(
$w, 
$h, $shy_char_left.$tmpstr.$shy_char_right, 0, 1, $align, $fill, $link, $stretch);
 
 6594                                                                if ($chars[$sep] == 45) {
 
 6598                                                                $this->cell_padding = $tmpcellpadding;
 
 6608                                        if ((($this->y + $this->lasth) > $this->PageBreakTrigger) AND ($this->
inPageBody())) {
 
 6611                                                        $this->x -= $margin[
'R'];
 
 6613                                                        $this->x += $margin[
'L'];
 
 6615                                                $this->lMargin += $margin[
'L'];
 
 6616                                                $this->rMargin += $margin[
'R'];
 
 6619                                        $wmax = 
$w - $this->cell_padding[
'L'] - $this->cell_padding[
'R'];
 
 6664                                $tmparr = array_slice($chars, $j, ($nb - $j));
 
 6666                                        $tmparr = 
TCPDF_FONTS::utf8Bidi($tmparr, $tmpstr, $this->tmprtl, $this->isunicode, $this->CurrentFont);
 
 6671                                        $this->endlinex = $startx - $linew;
 
 6673                                        $this->endlinex = $startx + $linew;
 
 6684                        $this->
Cell(
$w, 
$h, $tmpstr, 0, $ln, $align, $fill, $link, $stretch);
 
 6687                                $this->cell_padding = $tmpcellpadding;
 
 6706                        return ($this->x - $this->lMargin);
 
 6708                        return ($this->w - $this->rMargin - $this->x);
 
 6739                if ($fitonpage OR $this->AutoPageBreak) {
 
 6740                        $ratio_wh = (
$w / 
$h);
 
 6741                        if (
$h > ($this->PageBreakTrigger - $this->tMargin)) {
 
 6743                                $w = (
$h * $ratio_wh);
 
 6750                                        $h = (
$w / $ratio_wh);
 
 6762                                $x += ($this->x - $prev_x);
 
 6764                        $this->newline = 
true;
 
 6772                                $ratio_wh = (
$w / 
$h);
 
 6781                                $h = $this->PageBreakTrigger - 
$y;
 
 6782                                $w = (
$h * $ratio_wh);
 
 6784                        if ((!$this->rtl) AND ((
$x + 
$w) > ($this->w - $this->rMargin))) {
 
 6785                                $w = $this->w - $this->rMargin - 
$x;
 
 6786                                $h = (
$w / $ratio_wh);
 
 6787                        } elseif (($this->rtl) AND ((
$x - 
$w) < ($this->lMargin))) {
 
 6789                                $h = (
$w / $ratio_wh);
 
 6829        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()) {
 
 6830                if ($this->state != 2) {
 
 6833                if (strcmp(
$x, 
'') === 0) {
 
 6836                if (strcmp(
$y, 
'') === 0) {
 
 6844                if (
$file[0] === 
'@') {
 
 6848                        if (
$file[0] === 
'*') {
 
 6854                        if (!@file_exists(
$file)) {
 
 6856                                $tfile = str_replace(
' ', 
'%20', 
$file);
 
 6857                                if (@file_exists($tfile)) {
 
 6861                        if (($imsize = @getimagesize(
$file)) === FALSE) {
 
 6862                                if (in_array(
$file, $this->imagekeys)) {
 
 6866                                } elseif (strpos(
$file, 
'__tcpdf_'.$this->file_id.
'_img') === FALSE) {
 
 6873                        $original_file = 
$file;
 
 6877                                $this->
Error(
'Unable to write file: '.
$file);
 
 6882                        $imsize = @getimagesize(
$file);
 
 6883                        if ($imsize === FALSE) {
 
 6885                                $file = $original_file;
 
 6888                if ($imsize === FALSE) {
 
 6889                        if ((
$w > 0) AND (
$h > 0)) {
 
 6893                                $imsize = array($pw, $ph);
 
 6895                                $this->
Error(
'[Image] Unable to get the size of the image: '.
$file);
 
 6899                $filehash = md5(
$file);
 
 6901                list($pixw, $pixh) = $imsize;
 
 6903                if ((
$w <= 0) AND (
$h <= 0)) {
 
 6907                } elseif (
$w <= 0) {
 
 6908                        $w = 
$h * $pixw / $pixh;
 
 6909                } elseif (
$h <= 0) {
 
 6910                        $h = 
$w * $pixh / $pixw;
 
 6911                } elseif (($fitbox !== 
false) AND (
$w > 0) AND (
$h > 0)) {
 
 6912                        if (strlen($fitbox) !== 2) {
 
 6917                        if (((
$w * $pixh) / (
$h * $pixw)) < 1) {
 
 6921                                $h = 
$w * $pixh / $pixw;
 
 6923                                $hdiff = ($oldh - 
$h);
 
 6925                                switch (strtoupper($fitbox[1])) {
 
 6942                                $w = 
$h * $pixw / $pixh;
 
 6944                                $wdiff = ($oldw - 
$w);
 
 6946                                switch (strtoupper($fitbox[0])) {
 
 6973                $neww = round(
$w * $this->k * 
$dpi / $this->dpi);
 
 6974                $newh = round(
$h * $this->k * 
$dpi / $this->dpi);
 
 6976                $newsize = ($neww * $newh);
 
 6977                $pixsize = ($pixw * $pixh);
 
 6978                if (intval($resize) == 2) {
 
 6980                } elseif ($newsize >= $pixsize) {
 
 6985                if (in_array(
$file, $this->imagekeys)) {
 
 6989                        if (strpos(
$file, 
'__tcpdf_'.$this->file_id.
'_imgmask_') === FALSE) {
 
 6992                                if ((($oldsize < $newsize) AND ($resize)) OR (($oldsize < $pixsize) AND (!$resize))) {
 
 6996                } elseif (($ismask === 
false) AND ($imgmask === 
false) AND (strpos(
$file, 
'__tcpdf_'.$this->file_id.
'_imgmask_') === FALSE)) {
 
 6998                        $tempfile_plain = 
K_PATH_CACHE.
'__tcpdf_'.$this->file_id.
'_imgmask_plain_'.$filehash;
 
 7000                        $tempfile_alpha = 
K_PATH_CACHE.
'__tcpdf_'.$this->file_id.
'_imgmask_alpha_'.$filehash;
 
 7002                        if (in_array($tempfile_plain, $this->imagekeys)) {
 
 7007                                if ((($oldsize < $newsize) AND ($resize)) OR (($oldsize < $pixsize) AND (!$resize))) {
 
 7012                                        $imgmask = $this->
Image($tempfile_alpha, 
$x, 
$y, 
$w, 
$h, 
'PNG', 
'', 
'', $resize, 
$dpi, 
'', 
true, 
false);
 
 7014                                        return $this->
Image($tempfile_plain, 
$x, 
$y, 
$w, 
$h, $type, $link, $align, $resize, 
$dpi, $palign, 
false, $imgmask);
 
 7020                        $type = strtolower($type);
 
 7023                        } elseif ($type == 
'jpg') {
 
 7029                        $mtd = 
'_parse'.$type;
 
 7031                        $gdfunction = 
'imagecreatefrom'.$type;
 
 7033                        if ((method_exists(
'TCPDF_IMAGES', $mtd)) AND (!($resize AND (function_exists($gdfunction) OR extension_loaded(
'imagick'))))) {
 
 7036                                if (($ismask === 
false) AND ($imgmask === 
false) AND (strpos(
$file, 
'__tcpdf_'.$this->file_id.
'_imgmask_') === FALSE)
 
 7037                                        AND ((
$info === 
'pngalpha') OR (isset(
$info[
'trns']) AND !empty(
$info[
'trns'])))) {
 
 7038                                        return $this->
ImagePngAlpha(
$file, 
$x, 
$y, $pixw, $pixh, 
$w, 
$h, 
'PNG', $link, $align, $resize, 
$dpi, $palign, $filehash);
 
 7041                        if ((
$info === 
false) AND function_exists($gdfunction)) {
 
 7045                                        if (
$img !== 
false) {
 
 7047                                                        $imgr = imagecreatetruecolor($neww, $newh);
 
 7048                                                        if (($type == 
'gif') OR ($type == 
'png')) {
 
 7051                                                        imagecopyresampled($imgr, 
$img, 0, 0, 0, 0, $neww, $newh, $pixw, $pixh);
 
 7054                                                if (($type == 
'gif') OR ($type == 
'png')) {
 
 7060                                } 
catch(Exception $e) {
 
 7064                        if ((
$info === 
false) AND extension_loaded(
'imagick')) {
 
 7067                                        $img = 
new Imagick();
 
 7068                                        if ($type == 
'svg') {
 
 7069                                                if (
$file[0] === 
'@') {
 
 7071                                                        $svgimg = substr(
$file, 1);
 
 7076                                                if ($svgimg !== FALSE) {
 
 7079                                                        if (preg_match(
'/<svg([^>]*)>/si', $svgimg, $regs)) {
 
 7082                                                                if (preg_match(
'/[\s]+width[\s]*=[\s]*"([^"]*)"/si', $svgtag, $tmp)) {
 
 7084                                                                        $owu = sprintf(
'%F', ($ow * 
$dpi / 72)).$this->pdfunit;
 
 7085                                                                        $svgtag = preg_replace(
'/[\s]+width[\s]*=[\s]*"[^"]*"/si', 
' width="'.$owu.
'"', $svgtag, 1);
 
 7090                                                                if (preg_match(
'/[\s]+height[\s]*=[\s]*"([^"]*)"/si', $svgtag, $tmp)) {
 
 7092                                                                        $ohu = sprintf(
'%F', ($oh * 
$dpi / 72)).$this->pdfunit;
 
 7093                                                                        $svgtag = preg_replace(
'/[\s]+height[\s]*=[\s]*"[^"]*"/si', 
' height="'.$ohu.
'"', $svgtag, 1);
 
 7098                                                                if (!preg_match(
'/[\s]+viewBox[\s]*=[\s]*"[\s]*([0-9\.]+)[\s]+([0-9\.]+)[\s]+([0-9\.]+)[\s]+([0-9\.]+)[\s]*"/si', $svgtag, $tmp)) {
 
 7099                                                                        $vbw = ($ow * $this->imgscale * 
$this->k);
 
 7100                                                                        $vbh = ($oh * $this->imgscale * 
$this->k);
 
 7101                                                                        $vbox = sprintf(
' viewBox="0 0 %F %F" ', $vbw, $vbh);
 
 7102                                                                        $svgtag = $vbox.$svgtag;
 
 7104                                                                $svgimg = preg_replace(
'/<svg([^>]*)>/si', 
'<svg'.$svgtag.
'>', $svgimg, 1);
 
 7106                                                        $img->readImageBlob($svgimg);
 
 7112                                                $img->resizeImage($neww, $newh, 10, 1, 
false);
 
 7114                                        $img->setCompressionQuality($this->jpeg_quality);
 
 7115                                        $img->setImageFormat(
'jpeg');
 
 7117                                        $img->writeImage($tempname);
 
 7121                                } 
catch(Exception $e) {
 
 7125                        if (
$info === 
false) {
 
 7132                                $info[
'cs'] = 
'DeviceGray';
 
 7134                        if ($imgmask !== 
false) {
 
 7135                                $info[
'masked'] = $imgmask;
 
 7137                        if (!empty($exurl)) {
 
 7138                                $info[
'exurl'] = $exurl;
 
 7141                        $info[
'altimgs'] = $altimgs;
 
 7146                $this->img_rb_y = 
$y + 
$h;
 
 7149                        if ($palign == 
'L') {
 
 7151                        } elseif ($palign == 
'C') {
 
 7152                                $ximg = ($this->w + $this->lMargin - $this->rMargin - 
$w) / 2;
 
 7153                        } elseif ($palign == 
'R') {
 
 7154                                $ximg = $this->w - $this->rMargin - 
$w;
 
 7158                        $this->img_rb_x = $ximg;
 
 7160                        if ($palign == 
'L') {
 
 7162                        } elseif ($palign == 
'C') {
 
 7163                                $ximg = ($this->w + $this->lMargin - $this->rMargin - 
$w) / 2;
 
 7164                        } elseif ($palign == 
'R') {
 
 7165                                $ximg = $this->w - $this->rMargin - 
$w;
 
 7169                        $this->img_rb_x = $ximg + 
$w;
 
 7171                if ($ismask OR $hidden) {
 
 7178                        $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']));
 
 7203                                $this->y = 
$y + round(
$h/2);
 
 7213                                $this->
SetY($this->img_rb_y);
 
 7221                if ($this->inxobj) {
 
 7249        protected function ImagePngAlpha(
$file, 
$x, 
$y, $wpx, $hpx, 
$w, 
$h, $type, $link, $align, $resize, 
$dpi, $palign, $filehash=
'') {
 
 7251                if (empty($filehash)) {
 
 7252                        $filehash = md5(
$file);
 
 7255                $tempfile_plain = 
K_PATH_CACHE.
'__tcpdf_'.$this->file_id.
'_imgmask_plain_'.$filehash;
 
 7257                $tempfile_alpha = 
K_PATH_CACHE.
'__tcpdf_'.$this->file_id.
'_imgmask_alpha_'.$filehash;
 
 7261                if (($parsed === 
false) AND extension_loaded(
'imagick')) {
 
 7264                                $img = 
new Imagick();
 
 7269                                if (method_exists(
$img, 
'setImageAlphaChannel') AND defined(
'Imagick::ALPHACHANNEL_EXTRACT')) {
 
 7270                                        $img->setImageAlphaChannel(Imagick::ALPHACHANNEL_EXTRACT);
 
 7272                                        $img->separateImageChannel(8); 
 
 7273                                        $img->negateImage(
true);
 
 7275                                $img->setImageFormat(
'png');
 
 7276                                $img->writeImage($tempfile_alpha);
 
 7278                                if (method_exists($imga, 
'setImageMatte')) {
 
 7279                                        $imga->setImageMatte(
false);
 
 7281                                        $imga->separateImageChannel(39); 
 
 7283                                $imga->setImageFormat(
'png');
 
 7284                                $imga->writeImage($tempfile_plain);
 
 7286                        } 
catch (Exception $e) {
 
 7288                                $parse_error = 
'Imagick library error: '.$e->getMessage();
 
 7292                if (($parsed === 
false) AND function_exists(
'imagecreatefrompng')) {
 
 7296                                $imgalpha = imagecreate($wpx, $hpx);
 
 7298                                for ($c = 0; $c < 256; ++$c) {
 
 7299                                        ImageColorAllocate($imgalpha, $c, $c, $c);
 
 7302                                for ($xpx = 0; $xpx < $wpx; ++$xpx) {
 
 7303                                        for ($ypx = 0; $ypx < $hpx; ++$ypx) {
 
 7304                                                $color = imagecolorat(
$img, $xpx, $ypx);
 
 7307                                                imagesetpixel($imgalpha, $xpx, $ypx, 
$alpha);
 
 7310                                imagepng($imgalpha, $tempfile_alpha);
 
 7311                                imagedestroy($imgalpha);
 
 7313                                $imgplain = imagecreatetruecolor($wpx, $hpx);
 
 7314                                imagecopy($imgplain, 
$img, 0, 0, 0, 0, $wpx, $hpx);
 
 7315                                imagepng($imgplain, $tempfile_plain);
 
 7316                                imagedestroy($imgplain);
 
 7318                        } 
catch (Exception $e) {
 
 7320                                $parse_error = 
'GD library error: '.$e->getMessage();
 
 7323                if ($parsed === 
false) {
 
 7324                        if (empty($parse_error)) {
 
 7325                                $this->
Error(
'TCPDF requires the Imagick or GD extension to handle PNG images with alpha channel.');
 
 7327                                $this->
Error($parse_error);
 
 7331                $imgmask = $this->
Image($tempfile_alpha, 
$x, 
$y, 
$w, 
$h, 
'PNG', 
'', 
'', $resize, 
$dpi, 
'', 
true, 
false);
 
 7333                $this->
Image($tempfile_plain, 
$x, 
$y, 
$w, 
$h, $type, $link, $align, $resize, 
$dpi, $palign, 
false, $imgmask);
 
 7344                if (!isset($this->gdgammacache[
'#'.$c])) {
 
 7345                        $colors = imagecolorsforindex(
$img, $c);
 
 7347                        $this->gdgammacache[
'#'.$c] = (((127 - $colors[
'alpha']) / 127) * 255);
 
 7349                        $this->gdgammacache[
'#'.$c] = (pow(($this->gdgammacache[
'#'.$c] / 255), 2.2) * 255);
 
 7351                        if (count($this->gdgammacache) > 8) {
 
 7353                                array_shift($this->gdgammacache);
 
 7356                return $this->gdgammacache[
'#'.$c];
 
 7368        public function Ln(
$h=
'', $cell=
false) {
 
 7369                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'])) {
 
 7375                                $cellpadding = $this->cell_padding[
'R'];
 
 7377                                $cellpadding = $this->cell_padding[
'L'];
 
 7383                        $this->x = $this->w - $this->rMargin - $cellpadding;
 
 7385                        $this->x = $this->lMargin + $cellpadding;
 
 7387                if (is_string(
$h)) {
 
 7391                $this->newline = 
true;
 
 7405                        return ($this->w - $this->x);
 
 7444                if (!$rtloff AND $this->rtl) {
 
 7446                                $this->x = $this->w - 
$x;
 
 7454                                $this->x = $this->w + 
$x;
 
 7460                if ($this->x > $this->w) {
 
 7475        public function SetY(
$y, $resetx=
true, $rtloff=
false) {
 
 7479                        if (!$rtloff AND $this->rtl) {
 
 7488                        $this->y = $this->h + 
$y;
 
 7493                if ($this->y > $this->h) {
 
 7509                $this->
SetY(
$y, 
false, $rtloff);
 
 7510                $this->
SetX(
$x, $rtloff);
 
 7521                $this->x = floatval(
$x);
 
 7532                $this->y = floatval(
$y);
 
 7559        public function Output($name=
'doc.pdf', $dest=
'I') {
 
 7562                if ($this->state < 3) {
 
 7566                if (is_bool($dest)) {
 
 7567                        $dest = $dest ? 
'D' : 
'F';
 
 7569                $dest = strtoupper($dest);
 
 7570                if ($dest[0] != 
'F') {
 
 7571                        $name = preg_replace(
'/[\s]+/', 
'_', $name);
 
 7572                        $name = preg_replace(
'/[^a-zA-Z0-9_\.-]/', 
'', $name);
 
 7579                        $pdfdoc = substr($pdfdoc, 0, -1);
 
 7583                        $byte_range = array();
 
 7586                        $byte_range[2] = $byte_range[1] + $this->signature_max_length + 2;
 
 7587                        $byte_range[3] = strlen($pdfdoc) - $byte_range[2];
 
 7588                        $pdfdoc = substr($pdfdoc, 0, $byte_range[1]).substr($pdfdoc, $byte_range[2]);
 
 7590                        $byterange = sprintf(
'/ByteRange[0 %u %u %u]', $byte_range[1], $byte_range[2], $byte_range[3]);
 
 7591                        $byterange .= str_repeat(
' ', ($byterange_string_len - strlen($byterange)));
 
 7597                                $this->
Error(
'Unable to create temporary file: '.$tempdoc);
 
 7599                        $pdfdoc_length = strlen($pdfdoc);
 
 7600                        fwrite($f, $pdfdoc, $pdfdoc_length);
 
 7604                        if (empty($this->signature_data[
'extracerts'])) {
 
 7605                                openssl_pkcs7_sign($tempdoc, $tempsign, $this->signature_data[
'signcert'], array($this->signature_data[
'privkey'], $this->signature_data[
'password']), array(), PKCS7_BINARY | PKCS7_DETACHED);
 
 7607                                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']);
 
 7610                        $signature = file_get_contents($tempsign);
 
 7612                        $signature = substr($signature, $pdfdoc_length);
 
 7613                        $signature = substr($signature, (strpos($signature, 
"%%EOF\n\n------") + 13));
 
 7614                        $tmparr = explode(
"\n\n", $signature);
 
 7615                        $signature = $tmparr[1];
 
 7617                        $signature = base64_decode(trim($signature));
 
 7619                        $signature = $this->
applyTSA($signature);
 
 7621                        $signature = current(unpack(
'H*', $signature));
 
 7622                        $signature = str_pad($signature, $this->signature_max_length, 
'0');
 
 7624                        $this->buffer = substr($pdfdoc, 0, $byte_range[1]).
'<'.$signature.
'>'.substr($pdfdoc, $byte_range[1]);
 
 7625                        $this->bufferlen = strlen($this->buffer);
 
 7630                                if (ob_get_contents()) {
 
 7631                                        $this->
Error(
'Some data has already been output, can\'t send PDF file');
 
 7633                                if (php_sapi_name() != 
'cli') {
 
 7635                                        header(
'Content-Type: application/pdf');
 
 7636                                        if (headers_sent()) {
 
 7637                                                $this->
Error(
'Some data has already been output to browser, can\'t send PDF file');
 
 7639                                        header(
'Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1');
 
 7641                                        header(
'Pragma: public');
 
 7642                                        header(
'Expires: Sat, 26 Jul 1997 05:00:00 GMT'); 
 
 7643                                        header(
'Last-Modified: '.gmdate(
'D, d M Y H:i:s').
' GMT');
 
 7644                                        header(
'Content-Disposition: inline; filename="'.basename($name).
'"');
 
 7653                                if (ob_get_contents()) {
 
 7654                                        $this->
Error(
'Some data has already been output, can\'t send PDF file');
 
 7656                                header(
'Content-Description: File Transfer');
 
 7657                                if (headers_sent()) {
 
 7658                                        $this->
Error(
'Some data has already been output to browser, can\'t send PDF file');
 
 7660                                header(
'Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1');
 
 7662                                header(
'Pragma: public');
 
 7663                                header(
'Expires: Sat, 26 Jul 1997 05:00:00 GMT'); 
 
 7664                                header(
'Last-Modified: '.gmdate(
'D, d M Y H:i:s').
' GMT');
 
 7666                                if (strpos(php_sapi_name(), 
'cgi') === 
false) {
 
 7667                                        header(
'Content-Type: application/force-download');
 
 7668                                        header(
'Content-Type: application/octet-stream', 
false);
 
 7669                                        header(
'Content-Type: application/download', 
false);
 
 7670                                        header(
'Content-Type: application/pdf', 
false);
 
 7672                                        header(
'Content-Type: application/pdf');
 
 7675                                header(
'Content-Disposition: attachment; filename="'.basename($name).
'"');
 
 7676                                header(
'Content-Transfer-Encoding: binary');
 
 7686                                        $this->
Error(
'Unable to create output file: '.$name);
 
 7688                                fwrite($f, $this->
getBuffer(), $this->bufferlen);
 
 7690                                if ($dest == 
'FI') {
 
 7692                                        header(
'Content-Type: application/pdf');
 
 7693                                        header(
'Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1');
 
 7695                                        header(
'Pragma: public');
 
 7696                                        header(
'Expires: Sat, 26 Jul 1997 05:00:00 GMT'); 
 
 7697                                        header(
'Last-Modified: '.gmdate(
'D, d M Y H:i:s').
' GMT');
 
 7698                                        header(
'Content-Disposition: inline; filename="'.basename($name).
'"');
 
 7700                                } elseif ($dest == 
'FD') {
 
 7702                                        if (ob_get_contents()) {
 
 7703                                                $this->
Error(
'Some data has already been output, can\'t send PDF file');
 
 7705                                        header(
'Content-Description: File Transfer');
 
 7706                                        if (headers_sent()) {
 
 7707                                                $this->
Error(
'Some data has already been output to browser, can\'t send PDF file');
 
 7709                                        header(
'Cache-Control: private, must-revalidate, post-check=0, pre-check=0, max-age=1');
 
 7710                                        header(
'Pragma: public');
 
 7711                                        header(
'Expires: Sat, 26 Jul 1997 05:00:00 GMT'); 
 
 7712                                        header(
'Last-Modified: '.gmdate(
'D, d M Y H:i:s').
' GMT');
 
 7714                                        if (strpos(php_sapi_name(), 
'cgi') === 
false) {
 
 7715                                                header(
'Content-Type: application/force-download');
 
 7716                                                header(
'Content-Type: application/octet-stream', 
false);
 
 7717                                                header(
'Content-Type: application/download', 
false);
 
 7718                                                header(
'Content-Type: application/pdf', 
false);
 
 7720                                                header(
'Content-Type: application/pdf');
 
 7723                                        header(
'Content-Disposition: attachment; filename="'.basename($name).
'"');
 
 7724                                        header(
'Content-Transfer-Encoding: binary');
 
 7731                                $retval = 
'Content-Type: application/pdf;'.
"\r\n";
 
 7732                                $retval .= 
' name="'.$name.
'"'.
"\r\n";
 
 7733                                $retval .= 
'Content-Transfer-Encoding: base64'.
"\r\n";
 
 7734                                $retval .= 
'Content-Disposition: attachment;'.
"\r\n";
 
 7735                                $retval .= 
' filename="'.$name.
'"'.
"\r\n\r\n";
 
 7736                                $retval .= chunk_split(base64_encode($this->
getBuffer()), 76, 
"\r\n");
 
 7744                                $this->
Error(
'Incorrect output destination: '.$dest);
 
 7757        public function _destroy($destroyall=
false, $preserve_objcopy=
false) {
 
 7758                if ($destroyall AND !$preserve_objcopy) {
 
 7760                        $tmpfiles = glob(
K_PATH_CACHE.
'__tcpdf_'.$this->file_id.
'_*');
 
 7761                        if (!empty($tmpfiles)) {
 
 7762                                array_map(
'unlink', $tmpfiles);
 
 7767                        'internal_encoding',
 
 7774                        'signature_max_length',
 
 7779                foreach (array_keys(get_object_vars($this)) as $val) {
 
 7780                        if ($destroyall OR !in_array($val, $preserve)) {
 
 7781                                if ((!$preserve_objcopy OR ($val != 
'objcopy')) AND ($val != 
'file_id') AND isset($this->$val)) {
 
 7795                        $this->
Error(
'Don\'t alter the locale before including class file');
 
 7798                if (sprintf(
'%.1F', 1.0) != 
'1.0') {
 
 7799                        setlocale(LC_NUMERIC, 
'C');
 
 7812                $alias = array(
'u' => array(), 
'a' => array());
 
 7815                if ($this->isunicode) {
 
 7833                foreach($basic_alias as 
$k => $a) {
 
 7849                foreach ($aliases as $type => $alias) {
 
 7850                        foreach ($alias as $a) {
 
 7852                                $startnum = (strpos($a, 
':') + 1);
 
 7853                                $a = substr($a, 0, $startnum);
 
 7854                                if (($pos = strpos(
$page, $a)) !== 
false) {
 
 7856                                        $endnum = strpos(
$page, 
'}', $pos);
 
 7858                                        $aa = substr(
$page, $pos, ($endnum - $pos + 1));
 
 7860                                        $ratio = substr(
$page, ($pos + $startnum), ($endnum - $pos - $startnum));
 
 7861                                        $ratio = preg_replace(
'/[^0-9\.]/', 
'', $ratio);
 
 7862                                        $ratio = floatval($ratio);
 
 7864                                                $chrdiff = floor(($diff + 12) * $ratio);
 
 7865                                                $shift = str_repeat(
' ', $chrdiff);
 
 7868                                                $chrdiff = floor(($diff + 11) * $ratio);
 
 7869                                                $shift = str_repeat(
' ', $chrdiff);
 
 7884                $this->page_boxes = array();
 
 7885                foreach ($boxes as $box) {
 
 7887                                $this->page_boxes[] = $box;
 
 7909                for (
$n = 1; 
$n <= $num_pages; ++
$n) {
 
 7919                        if (!empty($this->pagegroups)) {
 
 7920                                if (isset($this->newpagegroup[
$n])) {
 
 7933                                $replace[] = array($ptgu, $ptg_num_chars, 9, $pnalias[2][
'u']);
 
 7934                                $replace[] = array($ptga, $ptg_num_chars, 7, $pnalias[2][
'a']);
 
 7935                                $replace[] = array($pngu, $png_num_chars, 9, $pnalias[3][
'u']);
 
 7936                                $replace[] = array($pnga, $png_num_chars, 7, $pnalias[3][
'a']);
 
 7941                        $replace[] = array($ptpu, $ptp_num_chars, 9, $pnalias[0][
'u']);
 
 7942                        $replace[] = array($ptpa, $ptp_num_chars, 7, $pnalias[0][
'a']);
 
 7943                        $replace[] = array($pnpu, $pnp_num_chars, 9, $pnalias[1][
'u']);
 
 7944                        $replace[] = array($pnpa, $pnp_num_chars, 7, $pnalias[1][
'a']);
 
 7949                        $temppage = str_replace($this->epsmarker, 
'', $temppage);
 
 7951                        $this->page_obj_id[
$n] = $this->
_newobj();
 
 7953                        $out .= 
' /Type /Page';
 
 7954                        $out .= 
' /Parent 1 0 R';
 
 7955                        if (empty($this->signature_data[
'approval']) OR ($this->signature_data[
'approval'] != 
'A')) {
 
 7956                                $out .= 
' /LastModified '.$this->_datestring(0, $this->doc_modification_timestamp);
 
 7958                        $out .= 
' /Resources 2 0 R';
 
 7959                        foreach ($this->page_boxes as $box) {
 
 7961                                $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']);
 
 7963                        if (isset($this->pagedim[
$n][
'BoxColorInfo']) AND !empty($this->pagedim[
$n][
'BoxColorInfo'])) {
 
 7964                                $out .= 
' /BoxColorInfo <<';
 
 7965                                foreach ($this->page_boxes as $box) {
 
 7966                                        if (isset($this->pagedim[
$n][
'BoxColorInfo'][$box])) {
 
 7967                                                $out .= 
' /'.$box.
' <<';
 
 7968                                                if (isset($this->pagedim[
$n][
'BoxColorInfo'][$box][
'C'])) {
 
 7969                                                        $color = $this->pagedim[
$n][
'BoxColorInfo'][$box][
'C'];
 
 7971                                                        $out .= sprintf(
' %F %F %F', ($color[0] / 255), ($color[1] / 255), ($color[2] / 255));
 
 7974                                                if (isset($this->pagedim[
$n][
'BoxColorInfo'][$box][
'W'])) {
 
 7975                                                        $out .= 
' /W '.($this->pagedim[
$n][
'BoxColorInfo'][$box][
'W'] * 
$this->k);
 
 7977                                                if (isset($this->pagedim[
$n][
'BoxColorInfo'][$box][
'S'])) {
 
 7978                                                        $out .= 
' /S /'.$this->pagedim[
$n][
'BoxColorInfo'][$box][
'S'];
 
 7980                                                if (isset($this->pagedim[
$n][
'BoxColorInfo'][$box][
'D'])) {
 
 7981                                                        $dashes = $this->pagedim[
$n][
'BoxColorInfo'][$box][
'D'];
 
 7983                                                        foreach ($dashes as $dash) {
 
 7984                                                                $out .= sprintf(
' %F', ($dash * $this->k));
 
 7993                        $out .= 
' /Contents '.($this->n + 1).
' 0 R';
 
 7994                        $out .= 
' /Rotate '.$this->pagedim[
$n][
'Rotate'];
 
 7995                        if (!$this->pdfa_mode) {
 
 7996                                $out .= 
' /Group << /Type /Group /S /Transparency /CS /DeviceRGB >>';
 
 7998                        if (isset($this->pagedim[
$n][
'trans']) AND !empty($this->pagedim[
$n][
'trans'])) {
 
 8000                                if (isset($this->pagedim[
$n][
'trans'][
'Dur'])) {
 
 8001                                        $out .= 
' /Dur '.$this->pagedim[
$n][
'trans'][
'Dur'];
 
 8003                                $out .= 
' /Trans <<';
 
 8004                                $out .= 
' /Type /Trans';
 
 8005                                if (isset($this->pagedim[
$n][
'trans'][
'S'])) {
 
 8006                                        $out .= 
' /S /'.$this->pagedim[
$n][
'trans'][
'S'];
 
 8008                                if (isset($this->pagedim[
$n][
'trans'][
'D'])) {
 
 8009                                        $out .= 
' /D '.$this->pagedim[
$n][
'trans'][
'D'];
 
 8011                                if (isset($this->pagedim[
$n][
'trans'][
'Dm'])) {
 
 8012                                        $out .= 
' /Dm /'.$this->pagedim[
$n][
'trans'][
'Dm'];
 
 8014                                if (isset($this->pagedim[
$n][
'trans'][
'M'])) {
 
 8015                                        $out .= 
' /M /'.$this->pagedim[
$n][
'trans'][
'M'];
 
 8017                                if (isset($this->pagedim[
$n][
'trans'][
'Di'])) {
 
 8018                                        $out .= 
' /Di '.$this->pagedim[
$n][
'trans'][
'Di'];
 
 8020                                if (isset($this->pagedim[
$n][
'trans'][
'SS'])) {
 
 8021                                        $out .= 
' /SS '.$this->pagedim[
$n][
'trans'][
'SS'];
 
 8023                                if (isset($this->pagedim[
$n][
'trans'][
'B'])) {
 
 8024                                        $out .= 
' /B '.$this->pagedim[
$n][
'trans'][
'B'];
 
 8029                        $out .= 
' /PZ '.$this->pagedim[
$n][
'PZ'];
 
 8031                        $out .= 
"\n".
'endobj';
 
 8037                        $this->
_out(
'<<'.$filter.
'/Length '.strlen($p).
'>> stream'.
"\n".$p.
"\n".
'endstream'.
"\n".
'endobj');
 
 8041                $out .= 
'<< /Type /Pages /Kids [';
 
 8042                foreach($this->page_obj_id as $page_obj) {
 
 8043                        $out .= 
' '.$page_obj.
' 0 R';
 
 8045                $out .= 
' ] /Count '.$num_pages.
' >>';
 
 8046                $out .= 
"\n".
'endobj';
 
 8059                if (!(isset($this->PageAnnots[
$n]) OR ($this->sign AND isset($this->signature_data[
'cert_type'])))) {
 
 8062                $out = 
' /Annots [';
 
 8063                if (isset($this->PageAnnots[
$n])) {
 
 8064                        foreach ($this->PageAnnots[
$n] as $key => $val) {
 
 8065                                if (!in_array($val[
'n'], $this->radio_groups)) {
 
 8066                                        $out .= 
' '.$val[
'n'].
' 0 R';
 
 8070                        if (isset($this->radiobutton_groups[
$n])) {
 
 8071                                foreach ($this->radiobutton_groups[
$n] as $key => 
$data) {
 
 8072                                        if (isset(
$data[
'n'])) {
 
 8073                                                $out .= 
' '.$data[
'n'].
' 0 R';
 
 8078                if ($this->sign AND (
$n == $this->signature_appearance[
'page']) AND isset($this->signature_data[
'cert_type'])) {
 
 8080                        $out .= 
' '.$this->sig_obj_id.
' 0 R';
 
 8082                if (!empty($this->empty_signature_appearance)) {
 
 8083                        foreach ($this->empty_signature_appearance as $esa) {
 
 8084                                if ($esa[
'page'] == 
$n) {
 
 8086                                        $out .= 
' '.$esa[
'objid'].
' 0 R';
 
 8105                        if (isset($this->PageAnnots[
$n])) {
 
 8107                                foreach ($this->PageAnnots[
$n] as $key => $pl) {
 
 8108                                        $annot_obj_id = $this->PageAnnots[
$n][$key][
'n'];
 
 8110                                        if (isset($this->radiobutton_groups[
$n][$pl[
'txt']]) AND is_array($this->radiobutton_groups[
$n][$pl[
'txt']])) {
 
 8111                                                $radio_button_obj_id = $this->radiobutton_groups[
$n][$pl[
'txt']][
'n'];
 
 8113                                                $annots .= 
' /Type /Annot';
 
 8114                                                $annots .= 
' /Subtype /Widget';
 
 8115                                                $annots .= 
' /Rect [0 0 0 0]';
 
 8116                                                if ($this->radiobutton_groups[
$n][$pl[
'txt']][
'#readonly#']) {
 
 8118                                                        $annots .= 
' /F 68';
 
 8119                                                        $annots .= 
' /Ff 49153';
 
 8122                                                        $annots .= 
' /Ff 49152';
 
 8124                                                $annots .= 
' /T '.$this->_datastring($pl[
'txt'], $radio_button_obj_id);
 
 8125                                                if (isset($pl[
'opt'][
'tu']) AND is_string($pl[
'opt'][
'tu'])) {
 
 8126                                                        $annots .= 
' /TU '.$this->_datastring($pl[
'opt'][
'tu'], $radio_button_obj_id);
 
 8128                                                $annots .= 
' /FT /Btn';
 
 8129                                                $annots .= 
' /Kids [';
 
 8131                                                foreach ($this->radiobutton_groups[
$n][$pl[
'txt']] as $key => 
$data) {
 
 8132                                                        if (isset(
$data[
'kid'])) {
 
 8133                                                                $annots .= 
' '.$data[
'kid'].
' 0 R';
 
 8134                                                                if (
$data[
'def'] !== 
'Off') {
 
 8135                                                                        $defval = 
$data[
'def'];
 
 8140                                                if (!empty($defval)) {
 
 8141                                                        $annots .= 
' /V /'.$defval;
 
 8144                                                $this->
_out($this->
_getobj($radio_button_obj_id).
"\n".$annots.
"\n".
'endobj');
 
 8145                                                $this->form_obj_id[] = $radio_button_obj_id;
 
 8147                                                $this->radiobutton_groups[
$n][$pl[
'txt']] = $radio_button_obj_id;
 
 8150                                        $pl[
'opt'] = array_change_key_case($pl[
'opt'], CASE_LOWER);
 
 8152                                        $b = $this->pagedim[
$n][
'h'] - (($pl[
'y'] + $pl[
'h']) * $this->k);
 
 8155                                        $rect = sprintf(
'%F %F %F %F', $a, $b, $a+$c, $b+
$d);
 
 8157                                        $annots = 
'<</Type /Annot';
 
 8158                                        $annots .= 
' /Subtype /'.$pl[
'opt'][
'subtype'];
 
 8159                                        $annots .= 
' /Rect ['.$rect.
']';
 
 8160                                        $ft = array(
'Btn', 
'Tx', 
'Ch', 
'Sig');
 
 8161                                        if (isset($pl[
'opt'][
'ft']) AND in_array($pl[
'opt'][
'ft'], $ft)) {
 
 8162                                                $annots .= 
' /FT /'.$pl[
'opt'][
'ft'];
 
 8165                                        $annots .= 
' /Contents '.$this->_textstring($pl[
'txt'], $annot_obj_id);
 
 8166                                        $annots .= 
' /P '.$this->page_obj_id[
$n].
' 0 R';
 
 8167                                        $annots .= 
' /NM '.$this->_datastring(sprintf(
'%04u-%04u', 
$n, $key), $annot_obj_id);
 
 8168                                        $annots .= 
' /M '.$this->_datestring($annot_obj_id, $this->doc_modification_timestamp);
 
 8169                                        if (isset($pl[
'opt'][
'f'])) {
 
 8171                                                if (is_array($pl[
'opt'][
'f'])) {
 
 8172                                                        foreach ($pl[
'opt'][
'f'] as $f) {
 
 8173                                                                switch (strtolower($f)) {
 
 8206                                                                        case 'togglenoview': {
 
 8210                                                                        case 'lockedcontents': {
 
 8220                                                        $fval = intval($pl[
'opt'][
'f']);
 
 8225                                        if ($this->pdfa_mode) {
 
 8229                                        $annots .= 
' /F '.intval($fval);
 
 8230                                        if (isset($pl[
'opt'][
'as']) AND is_string($pl[
'opt'][
'as'])) {
 
 8231                                                $annots .= 
' /AS /'.$pl[
'opt'][
'as'];
 
 8233                                        if (isset($pl[
'opt'][
'ap'])) {
 
 8235                                                $annots .= 
' /AP <<';
 
 8236                                                if (is_array($pl[
'opt'][
'ap'])) {
 
 8237                                                        foreach ($pl[
'opt'][
'ap'] as $apmode => $apdef) {
 
 8239                                                                $annots .= 
' /'.strtoupper($apmode);
 
 8240                                                                if (is_array($apdef)) {
 
 8242                                                                        foreach ($apdef as $apstate => $stream) {
 
 8245                                                                                $annots .= 
' /'.$apstate.
' '.$apsobjid.
' 0 R';
 
 8251                                                                        $annots .= 
' '.$apsobjid.
' 0 R';
 
 8255                                                        $annots .= $pl[
'opt'][
'ap'];
 
 8259                                        if (isset($pl[
'opt'][
'bs']) AND (is_array($pl[
'opt'][
'bs']))) {
 
 8260                                                $annots .= 
' /BS <<';
 
 8261                                                $annots .= 
' /Type /Border';
 
 8262                                                if (isset($pl[
'opt'][
'bs'][
'w'])) {
 
 8263                                                        $annots .= 
' /W '.intval($pl[
'opt'][
'bs'][
'w']);
 
 8265                                                $bstyles = array(
'S', 
'D', 
'B', 
'I', 
'U');
 
 8266                                                if (isset($pl[
'opt'][
'bs'][
's']) AND in_array($pl[
'opt'][
'bs'][
's'], $bstyles)) {
 
 8267                                                        $annots .= 
' /S /'.$pl[
'opt'][
'bs'][
's'];
 
 8269                                                if (isset($pl[
'opt'][
'bs'][
'd']) AND (is_array($pl[
'opt'][
'bs'][
'd']))) {
 
 8271                                                        foreach ($pl[
'opt'][
'bs'][
'd'] as $cord) {
 
 8272                                                                $annots .= 
' '.intval($cord);
 
 8278                                                $annots .= 
' /Border [';
 
 8279                                                if (isset($pl[
'opt'][
'border']) AND (count($pl[
'opt'][
'border']) >= 3)) {
 
 8280                                                        $annots .= intval($pl[
'opt'][
'border'][0]).
' ';
 
 8281                                                        $annots .= intval($pl[
'opt'][
'border'][1]).
' ';
 
 8282                                                        $annots .= intval($pl[
'opt'][
'border'][2]);
 
 8283                                                        if (isset($pl[
'opt'][
'border'][3]) AND is_array($pl[
'opt'][
'border'][3])) {
 
 8285                                                                foreach ($pl[
'opt'][
'border'][3] as $dash) {
 
 8286                                                                        $annots .= intval($dash).
' ';
 
 8295                                        if (isset($pl[
'opt'][
'be']) AND (is_array($pl[
'opt'][
'be']))) {
 
 8296                                                $annots .= 
' /BE <<';
 
 8297                                                $bstyles = array(
'S', 
'C');
 
 8298                                                if (isset($pl[
'opt'][
'be'][
's']) AND in_array($pl[
'opt'][
'be'][
's'], $bstyles)) {
 
 8299                                                        $annots .= 
' /S /'.$pl[
'opt'][
'bs'][
's'];
 
 8301                                                        $annots .= 
' /S /S';
 
 8303                                                if (isset($pl[
'opt'][
'be'][
'i']) AND ($pl[
'opt'][
'be'][
'i'] >= 0) AND ($pl[
'opt'][
'be'][
'i'] <= 2)) {
 
 8304                                                        $annots .= 
' /I '.sprintf(
' %F', $pl[
'opt'][
'be'][
'i']);
 
 8308                                        if (isset($pl[
'opt'][
'c']) AND (is_array($pl[
'opt'][
'c'])) AND !empty($pl[
'opt'][
'c'])) {
 
 8309                                                $annots .= 
' /C '.TCPDF_COLORS::getColorStringFromArray($pl[
'opt'][
'c']);
 
 8313                                        $markups = array(
'text', 
'freetext', 
'line', 
'square', 
'circle', 
'polygon', 
'polyline', 
'highlight', 
'underline', 
'squiggly', 
'strikeout', 
'stamp', 
'caret', 
'ink', 
'fileattachment', 
'sound');
 
 8314                                        if (in_array(strtolower($pl[
'opt'][
'subtype']), $markups)) {
 
 8316                                                if (isset($pl[
'opt'][
't']) AND is_string($pl[
'opt'][
't'])) {
 
 8317                                                        $annots .= 
' /T '.$this->_textstring($pl[
'opt'][
't'], $annot_obj_id);
 
 8320                                                if (isset($pl[
'opt'][
'ca'])) {
 
 8321                                                        $annots .= 
' /CA '.sprintf(
'%F', floatval($pl[
'opt'][
'ca']));
 
 8323                                                if (isset($pl[
'opt'][
'rc'])) {
 
 8324                                                        $annots .= 
' /RC '.$this->_textstring($pl[
'opt'][
'rc'], $annot_obj_id);
 
 8326                                                $annots .= 
' /CreationDate '.$this->_datestring($annot_obj_id, $this->doc_creation_timestamp);
 
 8328                                                if (isset($pl[
'opt'][
'subj'])) {
 
 8329                                                        $annots .= 
' /Subj '.$this->_textstring($pl[
'opt'][
'subj'], $annot_obj_id);
 
 8335                                        $lineendings = array(
'Square', 
'Circle', 
'Diamond', 
'OpenArrow', 
'ClosedArrow', 
'None', 
'Butt', 
'ROpenArrow', 
'RClosedArrow', 
'Slash');
 
 8337                                        switch (strtolower($pl[
'opt'][
'subtype'])) {
 
 8339                                                        if (isset($pl[
'opt'][
'open'])) {
 
 8340                                                                $annots .= 
' /Open '. (strtolower($pl[
'opt'][
'open']) == 
'true' ? 
'true' : 
'false');
 
 8342                                                        $iconsapp = array(
'Comment', 
'Help', 
'Insert', 
'Key', 
'NewParagraph', 
'Note', 
'Paragraph');
 
 8343                                                        if (isset($pl[
'opt'][
'name']) AND in_array($pl[
'opt'][
'name'], $iconsapp)) {
 
 8344                                                                $annots .= 
' /Name /'.$pl[
'opt'][
'name'];
 
 8346                                                                $annots .= 
' /Name /Note';
 
 8348                                                        $statemodels = array(
'Marked', 
'Review');
 
 8349                                                        if (isset($pl[
'opt'][
'statemodel']) AND in_array($pl[
'opt'][
'statemodel'], $statemodels)) {
 
 8350                                                                $annots .= 
' /StateModel /'.$pl[
'opt'][
'statemodel'];
 
 8352                                                                $pl[
'opt'][
'statemodel'] = 
'Marked';
 
 8353                                                                $annots .= 
' /StateModel /'.$pl[
'opt'][
'statemodel'];
 
 8355                                                        if ($pl[
'opt'][
'statemodel'] == 
'Marked') {
 
 8356                                                                $states = array(
'Accepted', 
'Unmarked');
 
 8358                                                                $states = array(
'Accepted', 
'Rejected', 
'Cancelled', 
'Completed', 
'None');
 
 8360                                                        if (isset($pl[
'opt'][
'state']) AND in_array($pl[
'opt'][
'state'], $states)) {
 
 8361                                                                $annots .= 
' /State /'.$pl[
'opt'][
'state'];
 
 8363                                                                if ($pl[
'opt'][
'statemodel'] == 
'Marked') {
 
 8364                                                                        $annots .= 
' /State /Unmarked';
 
 8366                                                                        $annots .= 
' /State /None';
 
 8372                                                        if (is_string($pl[
'txt'])) {
 
 8373                                                                if ($pl[
'txt'][0] == 
'#') {
 
 8375                                                                        $annots .= 
' /Dest /'.TCPDF_STATIC::encodeNameObject(substr($pl[
'txt'], 1));
 
 8376                                                                } elseif ($pl[
'txt'][0] == 
'%') {
 
 8378                                                                        $filename = basename(substr($pl[
'txt'], 1));
 
 8379                                                                        $annots .= 
' /A << /S /GoToE /D [0 /Fit] /NewWindow true /T << /R /C /P '.($n - 1).
' /A '.$this->embeddedfiles[
$filename][
'a'].
' >> >>';
 
 8380                                                                } elseif ($pl[
'txt'][0] == 
'*') {
 
 8382                                                                        $filename = basename(substr($pl[
'txt'], 1));
 
 8383                                                                        $jsa = 
'var D=event.target.doc;var MyData=D.dataObjects;for (var i in MyData) if (MyData[i].path=="'.$filename.
'") D.exportDataObject( { cName : MyData[i].name, nLaunch : 2});';
 
 8384                                                                        $annots .= 
' /A << /S /JavaScript /JS '.$this->_textstring($jsa, $annot_obj_id).
'>>';
 
 8386                                                                        $parsedUrl = parse_url($pl[
'txt']);
 
 8387                                                                        if (empty($parsedUrl[
'scheme']) AND (strtolower(substr($parsedUrl[
'path'], -4)) == 
'.pdf')) {
 
 8390                                                                                if (!empty($parsedUrl[
'fragment'])) {
 
 8392                                                                                        $tmp = explode(
'=', $parsedUrl[
'fragment']);
 
 8393                                                                                        $dest = 
'('.((count($tmp) == 2) ? $tmp[1] : $tmp[0]).
')';
 
 8395                                                                                $annots .= 
' /A <</S /GoToR /D '.$dest.
' /F '.$this->
_datastring($this->
unhtmlentities($parsedUrl[
'path']), $annot_obj_id).
' /NewWindow true>>';
 
 8398                                                                                $annots .= 
' /A <</S /URI /URI '.$this->_datastring($this->
unhtmlentities($pl[
'txt']), $annot_obj_id).
'>>';
 
 8401                                                        } elseif (isset($this->links[$pl[
'txt']])) {
 
 8403                                                                $l = $this->links[$pl[
'txt']];
 
 8404                                                                if (isset($this->page_obj_id[(
$l[
'p'])])) {
 
 8405                                                                        $annots .= sprintf(
' /Dest [%u 0 R /XYZ 0 %F null]', $this->page_obj_id[(
$l[
'p'])], ($this->pagedim[
$l[
'p']][
'h'] - (
$l[
'y'] * $this->k)));
 
 8408                                                        $hmodes = array(
'N', 
'I', 
'O', 
'P');
 
 8409                                                        if (isset($pl[
'opt'][
'h']) AND in_array($pl[
'opt'][
'h'], $hmodes)) {
 
 8410                                                                $annots .= 
' /H /'.$pl[
'opt'][
'h'];
 
 8412                                                                $annots .= 
' /H /I';
 
 8419                                                        if (isset($pl[
'opt'][
'da']) AND !empty($pl[
'opt'][
'da'])) {
 
 8420                                                                $annots .= 
' /DA ('.$pl[
'opt'][
'da'].
')';
 
 8422                                                        if (isset($pl[
'opt'][
'q']) AND ($pl[
'opt'][
'q'] >= 0) AND ($pl[
'opt'][
'q'] <= 2)) {
 
 8423                                                                $annots .= 
' /Q '.intval($pl[
'opt'][
'q']);
 
 8425                                                        if (isset($pl[
'opt'][
'rc'])) {
 
 8426                                                                $annots .= 
' /RC '.$this->_textstring($pl[
'opt'][
'rc'], $annot_obj_id);
 
 8428                                                        if (isset($pl[
'opt'][
'ds'])) {
 
 8429                                                                $annots .= 
' /DS '.$this->_textstring($pl[
'opt'][
'ds'], $annot_obj_id);
 
 8431                                                        if (isset($pl[
'opt'][
'cl']) AND is_array($pl[
'opt'][
'cl'])) {
 
 8432                                                                $annots .= 
' /CL [';
 
 8433                                                                foreach ($pl[
'opt'][
'cl'] as $cl) {
 
 8434                                                                        $annots .= sprintf(
'%F ', $cl * $this->k);
 
 8438                                                        $tfit = array(
'FreeText', 
'FreeTextCallout', 
'FreeTextTypeWriter');
 
 8439                                                        if (isset($pl[
'opt'][
'it']) AND in_array($pl[
'opt'][
'it'], $tfit)) {
 
 8440                                                                $annots .= 
' /IT /'.$pl[
'opt'][
'it'];
 
 8442                                                        if (isset($pl[
'opt'][
'rd']) AND is_array($pl[
'opt'][
'rd'])) {
 
 8446                                                                $b = $pl[
'opt'][
'rd'][3] * 
$this->k;
 
 8447                                                                $annots .= 
' /RD ['.sprintf(
'%F %F %F %F', 
$l, 
$r, 
$t, $b).
']';
 
 8449                                                        if (isset($pl[
'opt'][
'le']) AND in_array($pl[
'opt'][
'le'], $lineendings)) {
 
 8450                                                                $annots .= 
' /LE /'.$pl[
'opt'][
'le'];
 
 8493                                                case 'fileattachment': {
 
 8494                                                        if ($this->pdfa_mode) {
 
 8498                                                        if (!isset($pl[
'opt'][
'fs'])) {
 
 8502                                                        if (isset($this->embeddedfiles[
$filename][
'f'])) {
 
 8503                                                                $annots .= 
' /FS '.$this->embeddedfiles[
$filename][
'f'].
' 0 R';
 
 8504                                                                $iconsapp = array(
'Graph', 
'Paperclip', 
'PushPin', 
'Tag');
 
 8505                                                                if (isset($pl[
'opt'][
'name']) AND in_array($pl[
'opt'][
'name'], $iconsapp)) {
 
 8506                                                                        $annots .= 
' /Name /'.$pl[
'opt'][
'name'];
 
 8508                                                                        $annots .= 
' /Name /PushPin';
 
 8511                                                                $this->embeddedfiles[
$filename][
'a'] = $key;
 
 8516                                                        if (!isset($pl[
'opt'][
'fs'])) {
 
 8520                                                        if (isset($this->embeddedfiles[
$filename][
'f'])) {
 
 8523                                                                $annots .= 
' /Sound '.$this->embeddedfiles[
$filename][
'f'].
' 0 R';
 
 8524                                                                $iconsapp = array(
'Speaker', 
'Mic');
 
 8525                                                                if (isset($pl[
'opt'][
'name']) AND in_array($pl[
'opt'][
'name'], $iconsapp)) {
 
 8526                                                                        $annots .= 
' /Name /'.$pl[
'opt'][
'name'];
 
 8528                                                                        $annots .= 
' /Name /Speaker';
 
 8537                                                        $hmode = array(
'N', 
'I', 
'O', 
'P', 
'T');
 
 8538                                                        if (isset($pl[
'opt'][
'h']) AND in_array($pl[
'opt'][
'h'], $hmode)) {
 
 8539                                                                $annots .= 
' /H /'.$pl[
'opt'][
'h'];
 
 8541                                                        if (isset($pl[
'opt'][
'mk']) AND (is_array($pl[
'opt'][
'mk'])) AND !empty($pl[
'opt'][
'mk'])) {
 
 8542                                                                $annots .= 
' /MK <<';
 
 8543                                                                if (isset($pl[
'opt'][
'mk'][
'r'])) {
 
 8544                                                                        $annots .= 
' /R '.$pl[
'opt'][
'mk'][
'r'];
 
 8546                                                                if (isset($pl[
'opt'][
'mk'][
'bc']) AND (is_array($pl[
'opt'][
'mk'][
'bc']))) {
 
 8547                                                                        $annots .= 
' /BC '.TCPDF_COLORS::getColorStringFromArray($pl[
'opt'][
'mk'][
'bc']);
 
 8549                                                                if (isset($pl[
'opt'][
'mk'][
'bg']) AND (is_array($pl[
'opt'][
'mk'][
'bg']))) {
 
 8550                                                                        $annots .= 
' /BG '.TCPDF_COLORS::getColorStringFromArray($pl[
'opt'][
'mk'][
'bg']);
 
 8552                                                                if (isset($pl[
'opt'][
'mk'][
'ca'])) {
 
 8553                                                                        $annots .= 
' /CA '.$pl[
'opt'][
'mk'][
'ca'];
 
 8555                                                                if (isset($pl[
'opt'][
'mk'][
'rc'])) {
 
 8556                                                                        $annots .= 
' /RC '.$pl[
'opt'][
'mk'][
'rc'];
 
 8558                                                                if (isset($pl[
'opt'][
'mk'][
'ac'])) {
 
 8559                                                                        $annots .= 
' /AC '.$pl[
'opt'][
'mk'][
'ac'];
 
 8561                                                                if (isset($pl[
'opt'][
'mk'][
'i'])) {
 
 8563                                                                        if (
$info !== 
false) {
 
 8564                                                                                $annots .= 
' /I '.$info[
'n'].
' 0 R';
 
 8567                                                                if (isset($pl[
'opt'][
'mk'][
'ri'])) {
 
 8569                                                                        if (
$info !== 
false) {
 
 8570                                                                                $annots .= 
' /RI '.$info[
'n'].
' 0 R';
 
 8573                                                                if (isset($pl[
'opt'][
'mk'][
'ix'])) {
 
 8575                                                                        if (
$info !== 
false) {
 
 8576                                                                                $annots .= 
' /IX '.$info[
'n'].
' 0 R';
 
 8579                                                                if (isset($pl[
'opt'][
'mk'][
'if']) AND (is_array($pl[
'opt'][
'mk'][
'if'])) AND !empty($pl[
'opt'][
'mk'][
'if'])) {
 
 8580                                                                        $annots .= 
' /IF <<';
 
 8581                                                                        $if_sw = array(
'A', 
'B', 
'S', 
'N');
 
 8582                                                                        if (isset($pl[
'opt'][
'mk'][
'if'][
'sw']) AND in_array($pl[
'opt'][
'mk'][
'if'][
'sw'], $if_sw)) {
 
 8583                                                                                $annots .= 
' /SW /'.$pl[
'opt'][
'mk'][
'if'][
'sw'];
 
 8585                                                                        $if_s = array(
'A', 
'P');
 
 8586                                                                        if (isset($pl[
'opt'][
'mk'][
'if'][
's']) AND in_array($pl[
'opt'][
'mk'][
'if'][
's'], $if_s)) {
 
 8587                                                                                $annots .= 
' /S /'.$pl[
'opt'][
'mk'][
'if'][
's'];
 
 8589                                                                        if (isset($pl[
'opt'][
'mk'][
'if'][
'a']) AND (is_array($pl[
'opt'][
'mk'][
'if'][
'a'])) AND !empty($pl[
'opt'][
'mk'][
'if'][
'a'])) {
 
 8590                                                                                $annots .= sprintf(
' /A [%F %F]', $pl[
'opt'][
'mk'][
'if'][
'a'][0], $pl[
'opt'][
'mk'][
'if'][
'a'][1]);
 
 8592                                                                        if (isset($pl[
'opt'][
'mk'][
'if'][
'fb']) AND ($pl[
'opt'][
'mk'][
'if'][
'fb'])) {
 
 8593                                                                                $annots .= 
' /FB true';
 
 8597                                                                if (isset($pl[
'opt'][
'mk'][
'tp']) AND ($pl[
'opt'][
'mk'][
'tp'] >= 0) AND ($pl[
'opt'][
'mk'][
'tp'] <= 6)) {
 
 8598                                                                        $annots .= 
' /TP '.intval($pl[
'opt'][
'mk'][
'tp']);
 
 8603                                                        if (isset($this->radiobutton_groups[
$n][$pl[
'txt']])) {
 
 8605                                                                $annots .= 
' /Parent '.$this->radiobutton_groups[
$n][$pl[
'txt']].
' 0 R';
 
 8607                                                        if (isset($pl[
'opt'][
't']) AND is_string($pl[
'opt'][
't'])) {
 
 8608                                                                $annots .= 
' /T '.$this->_datastring($pl[
'opt'][
't'], $annot_obj_id);
 
 8610                                                        if (isset($pl[
'opt'][
'tu']) AND is_string($pl[
'opt'][
'tu'])) {
 
 8611                                                                $annots .= 
' /TU '.$this->_datastring($pl[
'opt'][
'tu'], $annot_obj_id);
 
 8613                                                        if (isset($pl[
'opt'][
'tm']) AND is_string($pl[
'opt'][
'tm'])) {
 
 8614                                                                $annots .= 
' /TM '.$this->_datastring($pl[
'opt'][
'tm'], $annot_obj_id);
 
 8616                                                        if (isset($pl[
'opt'][
'ff'])) {
 
 8617                                                                if (is_array($pl[
'opt'][
'ff'])) {
 
 8620                                                                        foreach($pl[
'opt'][
'ff'] as $val) {
 
 8621                                                                                $flag += 1 << ($val - 1);
 
 8624                                                                        $flag = intval($pl[
'opt'][
'ff']);
 
 8626                                                                $annots .= 
' /Ff '.$flag;
 
 8628                                                        if (isset($pl[
'opt'][
'maxlen'])) {
 
 8629                                                                $annots .= 
' /MaxLen '.intval($pl[
'opt'][
'maxlen']);
 
 8631                                                        if (isset($pl[
'opt'][
'v'])) {
 
 8633                                                                if (is_array($pl[
'opt'][
'v'])) {
 
 8634                                                                        foreach ($pl[
'opt'][
'v'] AS $optval) {
 
 8635                                                                                if (is_float($optval)) {
 
 8636                                                                                        $optval = sprintf(
'%F', $optval);
 
 8638                                                                                $annots .= 
' '.$optval;
 
 8641                                                                        $annots .= 
' '.$this->_textstring($pl[
'opt'][
'v'], $annot_obj_id);
 
 8644                                                        if (isset($pl[
'opt'][
'dv'])) {
 
 8646                                                                if (is_array($pl[
'opt'][
'dv'])) {
 
 8647                                                                        foreach ($pl[
'opt'][
'dv'] AS $optval) {
 
 8648                                                                                if (is_float($optval)) {
 
 8649                                                                                        $optval = sprintf(
'%F', $optval);
 
 8651                                                                                $annots .= 
' '.$optval;
 
 8654                                                                        $annots .= 
' '.$this->_textstring($pl[
'opt'][
'dv'], $annot_obj_id);
 
 8657                                                        if (isset($pl[
'opt'][
'rv'])) {
 
 8659                                                                if (is_array($pl[
'opt'][
'rv'])) {
 
 8660                                                                        foreach ($pl[
'opt'][
'rv'] AS $optval) {
 
 8661                                                                                if (is_float($optval)) {
 
 8662                                                                                        $optval = sprintf(
'%F', $optval);
 
 8664                                                                                $annots .= 
' '.$optval;
 
 8667                                                                        $annots .= 
' '.$this->_textstring($pl[
'opt'][
'rv'], $annot_obj_id);
 
 8670                                                        if (isset($pl[
'opt'][
'a']) AND !empty($pl[
'opt'][
'a'])) {
 
 8671                                                                $annots .= 
' /A << '.$pl[
'opt'][
'a'].
' >>';
 
 8673                                                        if (isset($pl[
'opt'][
'aa']) AND !empty($pl[
'opt'][
'aa'])) {
 
 8674                                                                $annots .= 
' /AA << '.$pl[
'opt'][
'aa'].
' >>';
 
 8676                                                        if (isset($pl[
'opt'][
'da']) AND !empty($pl[
'opt'][
'da'])) {
 
 8677                                                                $annots .= 
' /DA ('.$pl[
'opt'][
'da'].
')';
 
 8679                                                        if (isset($pl[
'opt'][
'q']) AND ($pl[
'opt'][
'q'] >= 0) AND ($pl[
'opt'][
'q'] <= 2)) {
 
 8680                                                                $annots .= 
' /Q '.intval($pl[
'opt'][
'q']);
 
 8682                                                        if (isset($pl[
'opt'][
'opt']) AND (is_array($pl[
'opt'][
'opt'])) AND !empty($pl[
'opt'][
'opt'])) {
 
 8683                                                                $annots .= 
' /Opt [';
 
 8684                                                                foreach($pl[
'opt'][
'opt'] AS $copt) {
 
 8685                                                                        if (is_array($copt)) {
 
 8686                                                                                $annots .= 
' ['.$this->_textstring($copt[0], $annot_obj_id).
' '.$this->
_textstring($copt[1], $annot_obj_id).
']';
 
 8688                                                                                $annots .= 
' '.$this->_textstring($copt, $annot_obj_id);
 
 8693                                                        if (isset($pl[
'opt'][
'ti'])) {
 
 8694                                                                $annots .= 
' /TI '.intval($pl[
'opt'][
'ti']);
 
 8696                                                        if (isset($pl[
'opt'][
'i']) AND (is_array($pl[
'opt'][
'i'])) AND !empty($pl[
'opt'][
'i'])) {
 
 8698                                                                foreach($pl[
'opt'][
'i'] AS $copt) {
 
 8699                                                                        $annots .= intval($copt).
' ';
 
 8708                                                case 'printermark': {
 
 8726                                        $this->
_out($this->
_getobj($annot_obj_id).
"\n".$annots.
"\n".
'endobj');
 
 8727                                        if ($formfield AND !isset($this->radiobutton_groups[
$n][$pl[
'txt']])) {
 
 8729                                                $this->form_obj_id[] = $annot_obj_id;
 
 8746                $stream = trim($stream);
 
 8748                $this->xobjects[
'AX'.$this->n] = array(
'n' => $this->n);
 
 8750                $out .= 
' /Type /XObject';
 
 8751                $out .= 
' /Subtype /Form';
 
 8752                $out .= 
' /FormType 1';
 
 8753                if ($this->compress) {
 
 8754                        $stream = gzcompress($stream);
 
 8755                        $out .= 
' /Filter /FlateDecode';
 
 8757                $rect = sprintf(
'%F %F', 
$w, 
$h);
 
 8758                $out .= 
' /BBox [0 0 '.$rect.
']';
 
 8759                $out .= 
' /Matrix [1 0 0 1 0 0]';
 
 8760                $out .= 
' /Resources 2 0 R';
 
 8762                $out .= 
' /Length '.strlen($stream);
 
 8764                $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
 8765                $out .= 
"\n".
'endobj';
 
 8777                foreach ($this->diffs as $diff) {
 
 8780                        $this->
_out(
'<< /Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.
'] >>'.
"\n".
'endobj');
 
 8784                foreach ($this->FontFiles as 
$file => 
$info) {
 
 8788                                $font = file_get_contents($fontfile);
 
 8789                                $compressed = (substr(
$file, -2) == 
'.z');
 
 8790                                if ((!$compressed) AND (isset(
$info[
'length2']))) {
 
 8791                                        $header = (ord($font[0]) == 128);
 
 8794                                                $font = substr($font, 6);
 
 8796                                        if (
$header AND (ord($font[
$info[
'length1']]) == 128)) {
 
 8798                                                $font = substr($font, 0, 
$info[
'length1']).substr($font, (
$info[
'length1'] + 6));
 
 8800                                } elseif (
$info[
'subset'] AND ((!$compressed) OR ($compressed AND function_exists(
'gzcompress')))) {
 
 8803                                                $font = gzuncompress($font);
 
 8806                                        $subsetchars = array(); 
 
 8807                                        foreach (
$info[
'fontkeys'] as $fontkey) {
 
 8809                                                $subsetchars += $fontinfo[
'subsetchars'];
 
 8814                                        $info[
'length1'] = strlen($font);
 
 8817                                                $font = gzcompress($font);
 
 8823                                $out = 
'<< /Length '.strlen($stream);
 
 8825                                        $out .= 
' /Filter /FlateDecode';
 
 8827                                $out .= 
' /Length1 '.$info[
'length1'];
 
 8828                                if (isset(
$info[
'length2'])) {
 
 8829                                        $out .= 
' /Length2 '.$info[
'length2'].
' /Length3 0';
 
 8832                                $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
 8833                                $out .= 
"\n".
'endobj';
 
 8838                foreach ($this->fontkeys as 
$k) {
 
 8841                        $type = $font[
'type'];
 
 8842                        $name = $font[
'name'];
 
 8843                        if ($type == 
'core') {
 
 8846                                $out .= 
'<</Type /Font';
 
 8847                                $out .= 
' /Subtype /Type1';
 
 8848                                $out .= 
' /BaseFont /'.$name;
 
 8849                                $out .= 
' /Name /F'.$font[
'i'];
 
 8850                                if ((strtolower($name) != 
'symbol') AND (strtolower($name) != 
'zapfdingbats')) {
 
 8851                                        $out .= 
' /Encoding /WinAnsiEncoding';
 
 8853                                if (
$k == 
'helvetica') {
 
 8855                                        $this->annotation_fonts[
$k] = $font[
'i'];
 
 8858                                $out .= 
"\n".
'endobj';
 
 8860                        } elseif (($type == 
'Type1') OR ($type == 
'TrueType')) {
 
 8863                                $out .= 
'<</Type /Font';
 
 8864                                $out .= 
' /Subtype /'.$type;
 
 8865                                $out .= 
' /BaseFont /'.$name;
 
 8866                                $out .= 
' /Name /F'.$font[
'i'];
 
 8867                                $out .= 
' /FirstChar 32 /LastChar 255';
 
 8868                                $out .= 
' /Widths '.($this->n + 1).
' 0 R';
 
 8869                                $out .= 
' /FontDescriptor '.($this->n + 2).
' 0 R';
 
 8871                                        if (isset($font[
'diff'])) {
 
 8872                                                $out .= 
' /Encoding '.($nf + $font[
'diff']).
' 0 R';
 
 8874                                                $out .= 
' /Encoding /WinAnsiEncoding';
 
 8878                                $out .= 
"\n".
'endobj';
 
 8883                                for ($i = 32; $i < 256; ++$i) {
 
 8884                                        if (isset($font[
'cw'][$i])) {
 
 8885                                                $s .= $font[
'cw'][$i].
' ';
 
 8887                                                $s .= $font[
'dw'].
' ';
 
 8891                                $s .= 
"\n".
'endobj';
 
 8895                                $s = 
'<</Type /FontDescriptor /FontName /'.$name;
 
 8896                                foreach ($font[
'desc'] as $fdk => $fdv) {
 
 8897                                        if (is_float($fdv)) {
 
 8898                                                $fdv = sprintf(
'%F', $fdv);
 
 8900                                        $s .= 
' /'.$fdk.
' '.$fdv.
'';
 
 8903                                        $s .= 
' /FontFile'.($type == 
'Type1' ? 
'' : 
'2').
' '.$this->FontFiles[$font[
'file']][
'n'].
' 0 R';
 
 8906                                $s .= 
"\n".
'endobj';
 
 8910                                $mtd = 
'_put'.strtolower($type);
 
 8911                                if (!method_exists($this, $mtd)) {
 
 8912                                        $this->
Error(
'Unsupported font type: '.$type);
 
 8929                if ($font[
'subset']) {
 
 8931                        $subtag = sprintf(
'%06u', $font[
'i']);
 
 8932                        $subtag = strtr($subtag, 
'0123456789', 
'ABCDEFGHIJ');
 
 8933                        $fontname .= $subtag.
'+';
 
 8935                $fontname .= $font[
'name'];
 
 8938                $out = $this->
_getobj($this->font_obj_ids[$font[
'fontkey']]).
"\n";
 
 8939                $out .= 
'<< /Type /Font';
 
 8940                $out .= 
' /Subtype /Type0';
 
 8941                $out .= 
' /BaseFont /'.$fontname;
 
 8942                $out .= 
' /Name /F'.$font[
'i'];
 
 8943                $out .= 
' /Encoding /'.$font[
'enc'];
 
 8944                $out .= 
' /ToUnicode '.($this->n + 1).
' 0 R';
 
 8945                $out .= 
' /DescendantFonts ['.($this->n + 2).
' 0 R]';
 
 8947                $out .= 
"\n".
'endobj';
 
 8956                $this->
_out(
'<<'.$filter.
'/Length '.strlen($stream).
'>> stream'.
"\n".$stream.
"\n".
'endstream'.
"\n".
'endobj');
 
 8960                $out = 
'<< /Type /Font';
 
 8961                $out .= 
' /Subtype /CIDFontType2';
 
 8962                $out .= 
' /BaseFont /'.$fontname;
 
 8964                $cidinfo = 
'/Registry '.$this->_datastring($font[
'cidinfo'][
'Registry'], $oid);
 
 8965                $cidinfo .= 
' /Ordering '.$this->_datastring($font[
'cidinfo'][
'Ordering'], $oid);
 
 8966                $cidinfo .= 
' /Supplement '.$font[
'cidinfo'][
'Supplement'];
 
 8967                $out .= 
' /CIDSystemInfo << '.$cidinfo.
' >>';
 
 8968                $out .= 
' /FontDescriptor '.($this->n + 1).
' 0 R';
 
 8969                $out .= 
' /DW '.$font[
'dw']; 
 
 8970                $out .= 
"\n".TCPDF_FONTS::_putfontwidths($font, 0);
 
 8972                        $out .= 
"\n".
'/CIDToGIDMap '.($this->n + 2).
' 0 R';
 
 8975                $out .= 
"\n".
'endobj';
 
 8980                $out = 
'<< /Type /FontDescriptor';
 
 8981                $out .= 
' /FontName /'.$fontname;
 
 8982                foreach ($font[
'desc'] as $key => $value) {
 
 8983                        if (is_float($value)) {
 
 8984                                $value = sprintf(
'%F', $value);
 
 8986                        $out .= 
' /'.$key.
' '.$value;
 
 8991                        $out .= 
' /FontFile2 '.$this->FontFiles[$font[
'file']][
'n'].
' 0 R';
 
 8992                        $fontdir = $this->FontFiles[$font[
'file']][
'fontdir'];
 
 8995                $out .= 
"\n".
'endobj';
 
 9002                        $ctgfile = strtolower($font[
'ctg']);
 
 9006                                $this->
Error(
'Font file not found: '.$ctgfile);
 
 9008                        $stream = $this->
_getrawstream(file_get_contents($fontfile));
 
 9009                        $out = 
'<< /Length '.strlen($stream).
'';
 
 9010                        if (substr($fontfile, -2) == 
'.z') { 
 
 9014                                $out .= 
' /Filter /FlateDecode';
 
 9017                        $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
 9018                        $out .= 
"\n".
'endobj';
 
 9033                if (!isset($font[
'cw'][1])) {
 
 9036                if (isset($font[
'cidinfo'][
'uni2cid'])) {
 
 9038                        $uni2cid = $font[
'cidinfo'][
'uni2cid'];
 
 9040                        foreach ($font[
'cw'] as $uni => $width) {
 
 9041                                if (isset($uni2cid[$uni])) {
 
 9042                                        $cw[($uni2cid[$uni] + $cidoffset)] = $width;
 
 9043                                } elseif ($uni < 256) {
 
 9047                        $font = array_merge($font, array(
'cw' => $cw));
 
 9049                $name = $font[
'name'];
 
 9050                $enc = $font[
'enc'];
 
 9052                        $longname = $name.
'-'.$enc;
 
 9056                $out = $this->
_getobj($this->font_obj_ids[$font[
'fontkey']]).
"\n";
 
 9057                $out .= 
'<</Type /Font';
 
 9058                $out .= 
' /Subtype /Type0';
 
 9059                $out .= 
' /BaseFont /'.$longname;
 
 9060                $out .= 
' /Name /F'.$font[
'i'];
 
 9062                        $out .= 
' /Encoding /'.$enc;
 
 9064                $out .= 
' /DescendantFonts ['.($this->n + 1).
' 0 R]';
 
 9066                $out .= 
"\n".
'endobj';
 
 9069                $out = 
'<</Type /Font';
 
 9070                $out .= 
' /Subtype /CIDFontType0';
 
 9071                $out .= 
' /BaseFont /'.$name;
 
 9072                $cidinfo = 
'/Registry '.$this->_datastring($font[
'cidinfo'][
'Registry'], $oid);
 
 9073                $cidinfo .= 
' /Ordering '.$this->_datastring($font[
'cidinfo'][
'Ordering'], $oid);
 
 9074                $cidinfo .= 
' /Supplement '.$font[
'cidinfo'][
'Supplement'];
 
 9075                $out .= 
' /CIDSystemInfo <<'.$cidinfo.
'>>';
 
 9076                $out .= 
' /FontDescriptor '.($this->n + 1).
' 0 R';
 
 9077                $out .= 
' /DW '.$font[
'dw'];
 
 9078                $out .= 
"\n".TCPDF_FONTS::_putfontwidths($font, $cidoffset);
 
 9080                $out .= 
"\n".
'endobj';
 
 9083                $s = 
'<</Type /FontDescriptor /FontName /'.$name;
 
 9084                foreach ($font[
'desc'] as 
$k => $v) {
 
 9085                        if (
$k != 
'Style') {
 
 9087                                        $v = sprintf(
'%F', $v);
 
 9089                                $s .= 
' /'.$k.
' '.$v.
'';
 
 9093                $s .= 
"\n".
'endobj';
 
 9103                foreach ($this->imagekeys as 
$file) {
 
 9106                        if ((!$this->pdfa_mode) AND isset(
$info[
'altimgs']) AND !empty(
$info[
'altimgs'])) {
 
 9109                                foreach (
$info[
'altimgs'] as $altimage) {
 
 9110                                        if (isset($this->xobjects[
'I'.$altimage[0]][
'n'])) {
 
 9111                                                $out .= 
' << /Image '.$this->xobjects[
'I'.$altimage[0]][
'n'].
' 0 R';
 
 9112                                                $out .= 
' /DefaultForPrinting';
 
 9113                                                if ($altimage[1] === 
true) {
 
 9122                                $out .= 
"\n".
'endobj';
 
 9127                        $this->xobjects[
'I'.$info[
'i']] = array(
'n' => $oid);
 
 9129                        $out = 
'<</Type /XObject';
 
 9130                        $out .= 
' /Subtype /Image';
 
 9131                        $out .= 
' /Width '.$info[
'w'];
 
 9132                        $out .= 
' /Height '.$info[
'h'];
 
 9133                        if (array_key_exists(
'masked', 
$info)) {
 
 9134                                $out .= 
' /SMask '.($this->n - 1).
' 0 R';
 
 9138                        if (isset(
$info[
'icc']) AND (
$info[
'icc'] !== 
false)) {
 
 9141                                $out .= 
' /ColorSpace [/ICCBased '.($this->n + 1).
' 0 R]';
 
 9142                        } elseif (
$info[
'cs'] == 
'Indexed') {
 
 9144                                $out .= 
' /ColorSpace [/Indexed /DeviceRGB '.((strlen(
$info[
'pal']) / 3) - 1).
' '.($this->n + 1).
' 0 R]';
 
 9147                                $out .= 
' /ColorSpace /'.$info[
'cs'];
 
 9149                        if (
$info[
'cs'] == 
'DeviceCMYK') {
 
 9150                                $out .= 
' /Decode [1 0 1 0 1 0 1 0]';
 
 9152                        $out .= 
' /BitsPerComponent '.$info[
'bpc'];
 
 9153                        if (isset($altoid) AND ($altoid > 0)) {
 
 9155                                $out .= 
' /Alternates '.$altoid.
' 0 R';
 
 9157                        if (isset(
$info[
'exurl']) AND !empty(
$info[
'exurl'])) {
 
 9159                                $out .= 
' /Length 0';
 
 9160                                $out .= 
' /F << /FS /URL /F '.$this->_datastring(
$info[
'exurl'], $oid).
' >>';
 
 9161                                if (isset(
$info[
'f'])) {
 
 9162                                        $out .= 
' /FFilter /'.$info[
'f'];
 
 9165                                $out .= 
' stream'.
"\n".
'endstream';
 
 9167                                if (isset(
$info[
'f'])) {
 
 9168                                        $out .= 
' /Filter /'.$info[
'f'];
 
 9170                                if (isset(
$info[
'parms'])) {
 
 9171                                        $out .= 
' '.$info[
'parms'];
 
 9173                                if (isset(
$info[
'trns']) AND is_array(
$info[
'trns'])) {
 
 9175                                        $count_info = count(
$info[
'trns']);
 
 9176                                        if (
$info[
'cs'] == 
'Indexed') {
 
 9177                                                $maxval =(pow(2, 
$info[
'bpc']) - 1);
 
 9178                                                for ($i = 0; $i < $count_info; ++$i) {
 
 9179                                                        if ((
$info[
'trns'][$i] != 0) AND (
$info[
'trns'][$i] != $maxval)) {
 
 9183                                                        } elseif (empty($trns) AND (
$info[
'trns'][$i] == 0)) {
 
 9185                                                                $trns .= $i.
' '.$i.
' ';
 
 9190                                                for ($i = 0; $i < $count_info; ++$i) {
 
 9191                                                        if (
$info[
'trns'][$i] == 0) {
 
 9192                                                                $trns .= 
$info[
'trns'][$i].
' '.
$info[
'trns'][$i].
' ';
 
 9197                                        if (!empty($trns)) {
 
 9198                                                $out .= 
' /Mask ['.$trns.
']';
 
 9202                                $out .= 
' /Length '.strlen($stream).
' >>';
 
 9203                                $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
 9205                        $out .= 
"\n".
'endobj';
 
 9212                                $this->
_out(
'<</N '.
$info[
'ch'].
' /Alternate /'.
$info[
'cs'].
' '.$filter.
'/Length '.strlen($icc).
'>> stream'.
"\n".$icc.
"\n".
'endstream'.
"\n".
'endobj');
 
 9213                        } elseif (
$info[
'cs'] == 
'Indexed') {
 
 9218                                $this->
_out(
'<<'.$filter.
'/Length '.strlen($pal).
'>> stream'.
"\n".$pal.
"\n".
'endstream'.
"\n".
'endobj');
 
 9231                foreach ($this->xobjects as $key => 
$data) {
 
 9232                        if (isset(
$data[
'outdata'])) {
 
 9233                                $stream = str_replace($this->epsmarker, 
'', trim(
$data[
'outdata']));
 
 9236                                $out .= 
' /Type /XObject';
 
 9237                                $out .= 
' /Subtype /Form';
 
 9238                                $out .= 
' /FormType 1';
 
 9239                                if ($this->compress) {
 
 9240                                        $stream = gzcompress($stream);
 
 9241                                        $out .= 
' /Filter /FlateDecode';
 
 9243                                $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));
 
 9244                                $out .= 
' /Matrix [1 0 0 1 0 0]';
 
 9245                                $out .= 
' /Resources <<';
 
 9246                                $out .= 
' /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]';
 
 9247                                if (!$this->pdfa_mode) {
 
 9249                                        if (isset(
$data[
'extgstates']) AND !empty(
$data[
'extgstates'])) {
 
 9250                                                $out .= 
' /ExtGState <<';
 
 9251                                                foreach (
$data[
'extgstates'] as 
$k => $extgstate) {
 
 9252                                                        if (isset($this->extgstates[
$k][
'name'])) {
 
 9253                                                                $out .= 
' /'.$this->extgstates[
$k][
'name'];
 
 9257                                                        $out .= 
' '.$this->extgstates[
$k][
'n'].
' 0 R';
 
 9261                                        if (isset(
$data[
'gradients']) AND !empty(
$data[
'gradients'])) {
 
 9264                                                foreach (
$data[
'gradients'] as $id => $grad) {
 
 9266                                                        $gp .= 
' /p'.$id.
' '.$this->gradients[$id][
'pattern'].
' 0 R';
 
 9268                                                        $gs .= 
' /Sh'.$id.
' '.$this->gradients[$id][
'id'].
' 0 R';
 
 9270                                                $out .= 
' /Pattern <<'.$gp.
' >>';
 
 9271                                                $out .= 
' /Shading <<'.$gs.
' >>';
 
 9275                                if (isset(
$data[
'spot_colors']) AND !empty(
$data[
'spot_colors'])) {
 
 9276                                        $out .= 
' /ColorSpace <<';
 
 9277                                        foreach (
$data[
'spot_colors'] as $name => $color) {
 
 9278                                                $out .= 
' /CS'.$color[
'i'].
' '.$this->spot_colors[$name][
'n'].
' 0 R';
 
 9283                                if (!empty(
$data[
'fonts'])) {
 
 9284                                        $out .= 
' /Font <<';
 
 9285                                        foreach (
$data[
'fonts'] as $fontkey => $fontid) {
 
 9286                                                $out .= 
' /F'.$fontid.
' '.$this->font_obj_ids[$fontkey].
' 0 R';
 
 9291                                if (!empty(
$data[
'images']) OR !empty(
$data[
'xobjects'])) {
 
 9292                                        $out .= 
' /XObject <<';
 
 9293                                        foreach (
$data[
'images'] as $imgid) {
 
 9294                                                $out .= 
' /I'.$imgid.
' '.$this->xobjects[
'I'.$imgid][
'n'].
' 0 R';
 
 9296                                        foreach (
$data[
'xobjects'] as $sub_id => $sub_objid) {
 
 9297                                                $out .= 
' /'.$sub_id.
' '.$sub_objid[
'n'].
' 0 R';
 
 9302                                if (isset(
$data[
'group']) AND (
$data[
'group'] !== 
false)) {
 
 9304                                        $out .= 
' /Group << /Type /Group /S /Transparency';
 
 9305                                        if (is_array(
$data[
'group'])) {
 
 9306                                                if (isset(
$data[
'group'][
'CS']) AND !empty(
$data[
'group'][
'CS'])) {
 
 9307                                                        $out .= 
' /CS /'.$data[
'group'][
'CS'];
 
 9309                                                if (isset(
$data[
'group'][
'I'])) {
 
 9310                                                        $out .= 
' /I /'.($data[
'group'][
'I']===
true?
'true':
'false');
 
 9312                                                if (isset(
$data[
'group'][
'K'])) {
 
 9313                                                        $out .= 
' /K /'.($data[
'group'][
'K']===
true?
'true':
'false');
 
 9319                                $out .= 
' /Length '.strlen($stream);
 
 9321                                $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
 9322                                $out .= 
"\n".
'endobj';
 
 9334                foreach ($this->spot_colors as $name => $color) {
 
 9336                        $this->spot_colors[$name][
'n'] = 
$this->n;
 
 9337                        $out = 
'[/Separation /'.str_replace(
' ', 
'#20', $name);
 
 9338                        $out .= 
' /DeviceCMYK <<';
 
 9339                        $out .= 
' /Range [0 1 0 1 0 1 0 1] /C0 [0 0 0 0]';
 
 9340                        $out .= 
' '.sprintf(
'/C1 [%F %F %F %F] ', ($color[
'C'] / 100), ($color[
'M'] / 100), ($color[
'Y'] / 100), ($color[
'K'] / 100));
 
 9341                        $out .= 
' /FunctionType 2 /Domain [0 1] /N 1>>]';
 
 9342                        $out .= 
"\n".
'endobj';
 
 9355                foreach ($this->xobjects as $id => $objid) {
 
 9356                        $out .= 
' /'.$id.
' '.$objid[
'n'].
' 0 R';
 
 9367                $out .= 
'<< /ProcSet [/PDF /Text /ImageB /ImageC /ImageI]';
 
 9368                $out .= 
' /Font <<';
 
 9369                foreach ($this->fontkeys as $fontkey) {
 
 9371                        $out .= 
' /F'.$font[
'i'].
' '.$font[
'n'].
' 0 R';
 
 9374                $out .= 
' /XObject <<';
 
 9378                if (!empty($this->pdflayers)) {
 
 9379                        $out .= 
' /Properties <<';
 
 9380                        foreach ($this->pdflayers as $layer) {
 
 9381                                $out .= 
' /'.$layer[
'layer'].
' '.$layer[
'objid'].
' 0 R';
 
 9385                if (!$this->pdfa_mode) {
 
 9387                        if (isset($this->extgstates) AND !empty($this->extgstates)) {
 
 9388                                $out .= 
' /ExtGState <<';
 
 9389                                foreach ($this->extgstates as 
$k => $extgstate) {
 
 9390                                        if (isset($extgstate[
'name'])) {
 
 9391                                                $out .= 
' /'.$extgstate[
'name'];
 
 9395                                        $out .= 
' '.$extgstate[
'n'].
' 0 R';
 
 9399                        if (isset($this->gradients) AND !empty($this->gradients)) {
 
 9402                                foreach ($this->gradients as $id => $grad) {
 
 9404                                        $gp .= 
' /p'.$id.
' '.$grad[
'pattern'].
' 0 R';
 
 9406                                        $gs .= 
' /Sh'.$id.
' '.$grad[
'id'].
' 0 R';
 
 9408                                $out .= 
' /Pattern <<'.$gp.
' >>';
 
 9409                                $out .= 
' /Shading <<'.$gs.
' >>';
 
 9413                if (isset($this->spot_colors) AND !empty($this->spot_colors)) {
 
 9414                        $out .= 
' /ColorSpace <<';
 
 9415                        foreach ($this->spot_colors as $color) {
 
 9416                                $out .= 
' /CS'.$color[
'i'].
' '.$color[
'n'].
' 0 R';
 
 9421                $out .= 
"\n".
'endobj';
 
 9457                if ($this->docinfounicode) {
 
 9458                        $this->isunicode = 
true;
 
 9462                        $out .= 
' /Title '.$this->_textstring($this->title, $oid);
 
 9466                        $out .= 
' /Author '.$this->_textstring($this->author, $oid);
 
 9470                        $out .= 
' /Subject '.$this->_textstring($this->subject, $oid);
 
 9474                        $out .= 
' /Keywords '.$this->_textstring($this->keywords, $oid);
 
 9478                        $out .= 
' /Creator '.$this->_textstring($this->creator, $oid);
 
 9481                $this->isunicode = $prev_isunicode;
 
 9485                $out .= 
' /CreationDate '.$this->_datestring(0, $this->doc_creation_timestamp);
 
 9487                $out .= 
' /ModDate '.$this->_datestring(0, $this->doc_modification_timestamp);
 
 9489                $out .= 
' /Trapped /False';
 
 9491                $out .= 
"\n".
'endobj';
 
 9504                $this->custom_xmp = $xmp;
 
 9517                $this->isunicode = 
true;
 
 9519                $this->encrypted = 
false;
 
 9521                $xmp = 
'<?xpacket begin="'.TCPDF_FONTS::unichr(0xfeff, $this->isunicode).
'" id="W5M0MpCehiHzreSzNTczkc9d"?>'.
"\n";
 
 9522                $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";
 
 9523                $xmp .= 
"\t".
'<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">'.
"\n";
 
 9524                $xmp .= 
"\t\t".
'<rdf:Description rdf:about="" xmlns:dc="http://purl.org/dc/elements/1.1/">'.
"\n";
 
 9525                $xmp .= 
"\t\t\t".
'<dc:format>application/pdf</dc:format>'.
"\n";
 
 9526                $xmp .= 
"\t\t\t".
'<dc:title>'.
"\n";
 
 9527                $xmp .= 
"\t\t\t\t".
'<rdf:Alt>'.
"\n";
 
 9529                $xmp .= 
"\t\t\t\t".
'</rdf:Alt>'.
"\n";
 
 9530                $xmp .= 
"\t\t\t".
'</dc:title>'.
"\n";
 
 9531                $xmp .= 
"\t\t\t".
'<dc:creator>'.
"\n";
 
 9532                $xmp .= 
"\t\t\t\t".
'<rdf:Seq>'.
"\n";
 
 9534                $xmp .= 
"\t\t\t\t".
'</rdf:Seq>'.
"\n";
 
 9535                $xmp .= 
"\t\t\t".
'</dc:creator>'.
"\n";
 
 9536                $xmp .= 
"\t\t\t".
'<dc:description>'.
"\n";
 
 9537                $xmp .= 
"\t\t\t\t".
'<rdf:Alt>'.
"\n";
 
 9539                $xmp .= 
"\t\t\t\t".
'</rdf:Alt>'.
"\n";
 
 9540                $xmp .= 
"\t\t\t".
'</dc:description>'.
"\n";
 
 9541                $xmp .= 
"\t\t\t".
'<dc:subject>'.
"\n";
 
 9542                $xmp .= 
"\t\t\t\t".
'<rdf:Bag>'.
"\n";
 
 9544                $xmp .= 
"\t\t\t\t".
'</rdf:Bag>'.
"\n";
 
 9545                $xmp .= 
"\t\t\t".
'</dc:subject>'.
"\n";
 
 9546                $xmp .= 
"\t\t".
'</rdf:Description>'.
"\n";
 
 9549                $doccreationdate = substr($dcdate, 0, 4).
'-'.substr($dcdate, 4, 2).
'-'.substr($dcdate, 6, 2);
 
 9550                $doccreationdate .= 
'T'.substr($dcdate, 8, 2).
':'.substr($dcdate, 10, 2).
':'.substr($dcdate, 12, 2);
 
 9551                $doccreationdate .= substr($dcdate, 14, 3).
':'.substr($dcdate, 18, 2);
 
 9555                $docmoddate = substr($dmdate, 0, 4).
'-'.substr($dmdate, 4, 2).
'-'.substr($dmdate, 6, 2);
 
 9556                $docmoddate .= 
'T'.substr($dmdate, 8, 2).
':'.substr($dmdate, 10, 2).
':'.substr($dmdate, 12, 2);
 
 9557                $docmoddate .= substr($dmdate, 14, 3).
':'.substr($dmdate, 18, 2);
 
 9559                $xmp .= 
"\t\t".
'<rdf:Description rdf:about="" xmlns:xmp="http://ns.adobe.com/xap/1.0/">'.
"\n";
 
 9560                $xmp .= 
"\t\t\t".
'<xmp:CreateDate>'.$doccreationdate.
'</xmp:CreateDate>'.
"\n";
 
 9561                $xmp .= 
"\t\t\t".
'<xmp:CreatorTool>'.$this->creator.
'</xmp:CreatorTool>'.
"\n";
 
 9562                $xmp .= 
"\t\t\t".
'<xmp:ModifyDate>'.$docmoddate.
'</xmp:ModifyDate>'.
"\n";
 
 9563                $xmp .= 
"\t\t\t".
'<xmp:MetadataDate>'.$doccreationdate.
'</xmp:MetadataDate>'.
"\n";
 
 9564                $xmp .= 
"\t\t".
'</rdf:Description>'.
"\n";
 
 9565                $xmp .= 
"\t\t".
'<rdf:Description rdf:about="" xmlns:pdf="http://ns.adobe.com/pdf/1.3/">'.
"\n";
 
 9568                $xmp .= 
"\t\t".
'</rdf:Description>'.
"\n";
 
 9569                $xmp .= 
"\t\t".
'<rdf:Description rdf:about="" xmlns:xmpMM="http://ns.adobe.com/xap/1.0/mm/">'.
"\n";
 
 9570                $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);
 
 9571                $xmp .= 
"\t\t\t".
'<xmpMM:DocumentID>'.$uuid.
'</xmpMM:DocumentID>'.
"\n";
 
 9572                $xmp .= 
"\t\t\t".
'<xmpMM:InstanceID>'.$uuid.
'</xmpMM:InstanceID>'.
"\n";
 
 9573                $xmp .= 
"\t\t".
'</rdf:Description>'.
"\n";
 
 9574                if ($this->pdfa_mode) {
 
 9575                        $xmp .= 
"\t\t".
'<rdf:Description rdf:about="" xmlns:pdfaid="http://www.aiim.org/pdfa/ns/id/">'.
"\n";
 
 9576                        $xmp .= 
"\t\t\t".
'<pdfaid:part>1</pdfaid:part>'.
"\n";
 
 9577                        $xmp .= 
"\t\t\t".
'<pdfaid:conformance>B</pdfaid:conformance>'.
"\n";
 
 9578                        $xmp .= 
"\t\t".
'</rdf:Description>'.
"\n";
 
 9581                $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";
 
 9582                $xmp .= 
"\t\t\t".
'<pdfaExtension:schemas>'.
"\n";
 
 9583                $xmp .= 
"\t\t\t\t".
'<rdf:Bag>'.
"\n";
 
 9584                $xmp .= 
"\t\t\t\t\t".
'<rdf:li rdf:parseType="Resource">'.
"\n";
 
 9585                $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:namespaceURI>http://ns.adobe.com/pdf/1.3/</pdfaSchema:namespaceURI>'.
"\n";
 
 9586                $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:prefix>pdf</pdfaSchema:prefix>'.
"\n";
 
 9587                $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:schema>Adobe PDF Schema</pdfaSchema:schema>'.
"\n";
 
 9588                $xmp .= 
"\t\t\t\t\t".
'</rdf:li>'.
"\n";
 
 9589                $xmp .= 
"\t\t\t\t\t".
'<rdf:li rdf:parseType="Resource">'.
"\n";
 
 9590                $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:namespaceURI>http://ns.adobe.com/xap/1.0/mm/</pdfaSchema:namespaceURI>'.
"\n";
 
 9591                $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:prefix>xmpMM</pdfaSchema:prefix>'.
"\n";
 
 9592                $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:schema>XMP Media Management Schema</pdfaSchema:schema>'.
"\n";
 
 9593                $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:property>'.
"\n";
 
 9594                $xmp .= 
"\t\t\t\t\t\t\t".
'<rdf:Seq>'.
"\n";
 
 9595                $xmp .= 
"\t\t\t\t\t\t\t\t".
'<rdf:li rdf:parseType="Resource">'.
"\n";
 
 9596                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:category>internal</pdfaProperty:category>'.
"\n";
 
 9597                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:description>UUID based identifier for specific incarnation of a document</pdfaProperty:description>'.
"\n";
 
 9598                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:name>InstanceID</pdfaProperty:name>'.
"\n";
 
 9599                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:valueType>URI</pdfaProperty:valueType>'.
"\n";
 
 9600                $xmp .= 
"\t\t\t\t\t\t\t\t".
'</rdf:li>'.
"\n";
 
 9601                $xmp .= 
"\t\t\t\t\t\t\t".
'</rdf:Seq>'.
"\n";
 
 9602                $xmp .= 
"\t\t\t\t\t\t".
'</pdfaSchema:property>'.
"\n";
 
 9603                $xmp .= 
"\t\t\t\t\t".
'</rdf:li>'.
"\n";
 
 9604                $xmp .= 
"\t\t\t\t\t".
'<rdf:li rdf:parseType="Resource">'.
"\n";
 
 9605                $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:namespaceURI>http://www.aiim.org/pdfa/ns/id/</pdfaSchema:namespaceURI>'.
"\n";
 
 9606                $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:prefix>pdfaid</pdfaSchema:prefix>'.
"\n";
 
 9607                $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:schema>PDF/A ID Schema</pdfaSchema:schema>'.
"\n";
 
 9608                $xmp .= 
"\t\t\t\t\t\t".
'<pdfaSchema:property>'.
"\n";
 
 9609                $xmp .= 
"\t\t\t\t\t\t\t".
'<rdf:Seq>'.
"\n";
 
 9610                $xmp .= 
"\t\t\t\t\t\t\t\t".
'<rdf:li rdf:parseType="Resource">'.
"\n";
 
 9611                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:category>internal</pdfaProperty:category>'.
"\n";
 
 9612                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:description>Part of PDF/A standard</pdfaProperty:description>'.
"\n";
 
 9613                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:name>part</pdfaProperty:name>'.
"\n";
 
 9614                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:valueType>Integer</pdfaProperty:valueType>'.
"\n";
 
 9615                $xmp .= 
"\t\t\t\t\t\t\t\t".
'</rdf:li>'.
"\n";
 
 9616                $xmp .= 
"\t\t\t\t\t\t\t\t".
'<rdf:li rdf:parseType="Resource">'.
"\n";
 
 9617                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:category>internal</pdfaProperty:category>'.
"\n";
 
 9618                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:description>Amendment of PDF/A standard</pdfaProperty:description>'.
"\n";
 
 9619                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:name>amd</pdfaProperty:name>'.
"\n";
 
 9620                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:valueType>Text</pdfaProperty:valueType>'.
"\n";
 
 9621                $xmp .= 
"\t\t\t\t\t\t\t\t".
'</rdf:li>'.
"\n";
 
 9622                $xmp .= 
"\t\t\t\t\t\t\t\t".
'<rdf:li rdf:parseType="Resource">'.
"\n";
 
 9623                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:category>internal</pdfaProperty:category>'.
"\n";
 
 9624                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:description>Conformance level of PDF/A standard</pdfaProperty:description>'.
"\n";
 
 9625                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:name>conformance</pdfaProperty:name>'.
"\n";
 
 9626                $xmp .= 
"\t\t\t\t\t\t\t\t\t".
'<pdfaProperty:valueType>Text</pdfaProperty:valueType>'.
"\n";
 
 9627                $xmp .= 
"\t\t\t\t\t\t\t\t".
'</rdf:li>'.
"\n";
 
 9628                $xmp .= 
"\t\t\t\t\t\t\t".
'</rdf:Seq>'.
"\n";
 
 9629                $xmp .= 
"\t\t\t\t\t\t".
'</pdfaSchema:property>'.
"\n";
 
 9630                $xmp .= 
"\t\t\t\t\t".
'</rdf:li>'.
"\n";
 
 9631                $xmp .= 
"\t\t\t\t".
'</rdf:Bag>'.
"\n";
 
 9632                $xmp .= 
"\t\t\t".
'</pdfaExtension:schemas>'.
"\n";
 
 9633                $xmp .= 
"\t\t".
'</rdf:Description>'.
"\n";
 
 9634                $xmp .= 
"\t".
'</rdf:RDF>'.
"\n";
 
 9636                $xmp .= 
'</x:xmpmeta>'.
"\n";
 
 9637                $xmp .= 
'<?xpacket end="w"?>';
 
 9638                $out = 
'<< /Type /Metadata /Subtype /XML /Length '.strlen($xmp).
' >> stream'.
"\n".$xmp.
"\n".
'endstream'.
"\n".
'endobj';
 
 9640                $this->isunicode = $prev_isunicode;
 
 9641                $this->encrypted = $prev_encrypted;
 
 9655                if ($this->pdfa_mode OR $this->force_srgb) {
 
 9657                        $icc = file_get_contents(dirname(__FILE__).
'/include/sRGB.icc');
 
 9659                        if ($this->compress) {
 
 9660                                $filter = 
' /Filter /FlateDecode';
 
 9661                                $icc = gzcompress($icc);
 
 9664                        $this->
_out(
'<</N 3 '.$filter.
'/Length '.strlen($icc).
'>> stream'.
"\n".$icc.
"\n".
'endstream'.
"\n".
'endobj');
 
 9668                $out = 
'<< /Type /Catalog';
 
 9669                $out .= 
' /Version /'.$this->PDFVersion;
 
 9671                $out .= 
' /Pages 1 0 R';
 
 9673                $out .= 
' /Names <<';
 
 9674                if ((!$this->pdfa_mode) AND !empty($this->n_js)) {
 
 9675                        $out .= 
' /JavaScript '.$this->n_js;
 
 9677                if (!empty($this->efnames)) {
 
 9678                        $out .= 
' /EmbeddedFiles <</Names [';
 
 9679                        foreach ($this->efnames AS $fn => $fref) {
 
 9680                                $out .= 
' '.$this->_datastring($fn).
' '.$fref;
 
 9685                if (!empty($this->dests)) {
 
 9686                        $out .= 
' /Dests '.($this->n_dests).
' 0 R';
 
 9690                        $out .= 
' /PageLayout /'.$this->LayoutMode;
 
 9693                        $out .= 
' /PageMode /'.$this->PageMode;
 
 9695                if (count($this->outlines) > 0) {
 
 9696                        $out .= 
' /Outlines '.$this->OutlineRoot.
' 0 R';
 
 9697                        $out .= 
' /PageMode /UseOutlines';
 
 9700                if ($this->ZoomMode == 
'fullpage') {
 
 9701                        $out .= 
' /OpenAction ['.$this->page_obj_id[1].
' 0 R /Fit]';
 
 9702                } elseif ($this->ZoomMode == 
'fullwidth') {
 
 9703                        $out .= 
' /OpenAction ['.$this->page_obj_id[1].
' 0 R /FitH null]';
 
 9704                } elseif ($this->ZoomMode == 
'real') {
 
 9705                        $out .= 
' /OpenAction ['.$this->page_obj_id[1].
' 0 R /XYZ null null 1]';
 
 9706                } elseif (!is_string($this->ZoomMode)) {
 
 9707                        $out .= sprintf(
' /OpenAction ['.$this->page_obj_id[1].
' 0 R /XYZ null null %F]', ($this->ZoomMode / 100));
 
 9711                $out .= 
' /Metadata '.$xmpobj.
' 0 R';
 
 9714                if (isset($this->l[
'a_meta_language'])) {
 
 9715                        $out .= 
' /Lang '.$this->_textstring($this->l[
'a_meta_language'], $oid);
 
 9719                if ($this->pdfa_mode OR $this->force_srgb) {
 
 9720                        $out .= 
' /OutputIntents [<<';
 
 9721                        $out .= 
' /Type /OutputIntent';
 
 9722                        $out .= 
' /S /GTS_PDFA1';
 
 9723                        $out .= 
' /OutputCondition '.$this->_textstring(
'sRGB IEC61966-2.1', $oid);
 
 9724                        $out .= 
' /OutputConditionIdentifier '.$this->_textstring(
'sRGB IEC61966-2.1', $oid);
 
 9725                        $out .= 
' /RegistryName '.$this->_textstring(
'http://www.color.org', $oid);
 
 9726                        $out .= 
' /Info '.$this->_textstring(
'sRGB IEC61966-2.1', $oid);
 
 9727                        $out .= 
' /DestOutputProfile '.$iccobj.
' 0 R';
 
 9731                if (!empty($this->pdflayers)) {
 
 9735                        foreach ($this->pdflayers as $layer) {
 
 9736                                $layer_obj_ref = 
' '.$layer[
'objid'].
' 0 R';
 
 9737                                $lyrobjs .= $layer_obj_ref;
 
 9738                                if ($layer[
'view'] === 
false) {
 
 9739                                        $lyrobjs_off .= $layer_obj_ref;
 
 9741                                if ($layer[
'lock']) {
 
 9742                                        $lyrobjs_lock .= $layer_obj_ref;
 
 9745                        $out .= 
' /OCProperties << /OCGs ['.$lyrobjs.
']';
 
 9747                        $out .= 
' /Name '.$this->_textstring(
'Layers', $oid);
 
 9748                        $out .= 
' /Creator '.$this->_textstring(
'TCPDF', $oid);
 
 9749                        $out .= 
' /BaseState /ON';
 
 9750                        $out .= 
' /OFF ['.$lyrobjs_off.
']';
 
 9751                        $out .= 
' /Locked ['.$lyrobjs_lock.
']';
 
 9752                        $out .= 
' /Intent /View';
 
 9754                        $out .= 
' << /Event /Print /OCGs ['.$lyrobjs.
'] /Category [/Print] >>';
 
 9755                        $out .= 
' << /Event /View /OCGs ['.$lyrobjs.
'] /Category [/View] >>';
 
 9757                        $out .= 
' /Order ['.$lyrobjs.
']';
 
 9758                        $out .= 
' /ListMode /AllPages';
 
 9765                if (!empty($this->form_obj_id)
 
 9766                        OR ($this->sign AND isset($this->signature_data[
'cert_type']))
 
 9767                        OR !empty($this->empty_signature_appearance)) {
 
 9768                        $out .= 
' /AcroForm <<';
 
 9770                        if ($this->sign AND isset($this->signature_data[
'cert_type'])) {
 
 9772                                $objrefs .= $this->sig_obj_id.
' 0 R';
 
 9774                        if (!empty($this->empty_signature_appearance)) {
 
 9775                                foreach ($this->empty_signature_appearance as $esa) {
 
 9777                                        $objrefs .= 
' '.$esa[
'objid'].
' 0 R';
 
 9780                        if (!empty($this->form_obj_id)) {
 
 9781                                foreach($this->form_obj_id as $objid) {
 
 9782                                        $objrefs .= 
' '.$objid.
' 0 R';
 
 9785                        $out .= 
' /Fields ['.$objrefs.
']';
 
 9787                        if (empty($this->signature_data[
'approval']) OR ($this->signature_data[
'approval'] != 
'A')) {
 
 9788                                $out .= 
' /NeedAppearances false';
 
 9790                        if ($this->sign AND isset($this->signature_data[
'cert_type'])) {
 
 9791                                if ($this->signature_data[
'cert_type'] > 0) {
 
 9792                                        $out .= 
' /SigFlags 3';
 
 9794                                        $out .= 
' /SigFlags 1';
 
 9798                        if (isset($this->annotation_fonts) AND !empty($this->annotation_fonts)) {
 
 9800                                $out .= 
' /Font <<';
 
 9801                                foreach ($this->annotation_fonts as $fontkey => $fontid) {
 
 9802                                        $out .= 
' /F'.$fontid.
' '.$this->font_obj_ids[$fontkey].
' 0 R';
 
 9807                        $out .= 
' /DA (/F'.$font[
'i'].
' 0 Tf 0 g)';
 
 9808                        $out .= 
' /Q '.(($this->rtl)?
'2':
'0');
 
 9812                        if ($this->sign AND isset($this->signature_data[
'cert_type']) 
 
 9813                                AND (empty($this->signature_data[
'approval']) OR ($this->signature_data[
'approval'] != 
'A'))) {
 
 9814                                if ($this->signature_data[
'cert_type'] > 0) {
 
 9815                                        $out .= 
' /Perms << /DocMDP '.($this->sig_obj_id + 1).
' 0 R >>';
 
 9817                                        $out .= 
' /Perms << /UR3 '.($this->sig_obj_id + 1).
' 0 R >>';
 
 9826                $out .= 
"\n".
'endobj';
 
 9840                $out = 
' /ViewerPreferences <<';
 
 9842                        $out .= 
' /Direction /R2L';
 
 9844                        $out .= 
' /Direction /L2R';
 
 9846                if (isset($vp[
'HideToolbar']) AND ($vp[
'HideToolbar'])) {
 
 9847                        $out .= 
' /HideToolbar true';
 
 9849                if (isset($vp[
'HideMenubar']) AND ($vp[
'HideMenubar'])) {
 
 9850                        $out .= 
' /HideMenubar true';
 
 9852                if (isset($vp[
'HideWindowUI']) AND ($vp[
'HideWindowUI'])) {
 
 9853                        $out .= 
' /HideWindowUI true';
 
 9855                if (isset($vp[
'FitWindow']) AND ($vp[
'FitWindow'])) {
 
 9856                        $out .= 
' /FitWindow true';
 
 9858                if (isset($vp[
'CenterWindow']) AND ($vp[
'CenterWindow'])) {
 
 9859                        $out .= 
' /CenterWindow true';
 
 9861                if (isset($vp[
'DisplayDocTitle']) AND ($vp[
'DisplayDocTitle'])) {
 
 9862                        $out .= 
' /DisplayDocTitle true';
 
 9864                if (isset($vp[
'NonFullScreenPageMode'])) {
 
 9865                        $out .= 
' /NonFullScreenPageMode /'.$vp[
'NonFullScreenPageMode'];
 
 9867                if (isset($vp[
'ViewArea'])) {
 
 9868                        $out .= 
' /ViewArea /'.$vp[
'ViewArea'];
 
 9870                if (isset($vp[
'ViewClip'])) {
 
 9871                        $out .= 
' /ViewClip /'.$vp[
'ViewClip'];
 
 9873                if (isset($vp[
'PrintArea'])) {
 
 9874                        $out .= 
' /PrintArea /'.$vp[
'PrintArea'];
 
 9876                if (isset($vp[
'PrintClip'])) {
 
 9877                        $out .= 
' /PrintClip /'.$vp[
'PrintClip'];
 
 9879                if (isset($vp[
'PrintScaling'])) {
 
 9880                        $out .= 
' /PrintScaling /'.$vp[
'PrintScaling'];
 
 9883                        $out .= 
' /Duplex /'.$vp[
'Duplex'];
 
 9885                if (isset($vp[
'PickTrayByPDFSize'])) {
 
 9886                        if ($vp[
'PickTrayByPDFSize']) {
 
 9887                                $out .= 
' /PickTrayByPDFSize true';
 
 9889                                $out .= 
' /PickTrayByPDFSize false';
 
 9892                if (isset($vp[
'PrintPageRange'])) {
 
 9893                        $PrintPageRangeNum = 
'';
 
 9894                        foreach ($vp[
'PrintPageRange'] as 
$k => $v) {
 
 9895                                $PrintPageRangeNum .= 
' '.($v - 1).
'';
 
 9897                        $out .= 
' /PrintPageRange ['.substr($PrintPageRangeNum,1).
']';
 
 9899                if (isset($vp[
'NumCopies'])) {
 
 9900                        $out .= 
' /NumCopies '.intval($vp[
'NumCopies']);
 
 9911                $this->
_out(
'%PDF-'.$this->PDFVersion);
 
 9912                $this->
_out(
'%'.chr(0xe2).chr(0xe3).chr(0xcf).chr(0xd3));
 
 9920                if (isset($this->CurrentFont[
'fontkey']) AND isset($this->CurrentFont[
'subsetchars'])) {
 
 9922                        $this->
setFontSubBuffer($this->CurrentFont[
'fontkey'], 
'subsetchars', $this->CurrentFont[
'subsetchars']);
 
 9929                if (!empty($this->empty_signature_appearance)) {
 
 9930                        foreach ($this->empty_signature_appearance as $key => $esa) {
 
 9933                                $out .= 
'<< /Type /Annot';
 
 9934                                $out .= 
' /Subtype /Widget';
 
 9935                                $out .= 
' /Rect ['.$esa[
'rect'].
']';
 
 9936                                $out .= 
' /P '.$this->page_obj_id[($esa[
'page'])].
' 0 R'; 
 
 9938                                $out .= 
' /FT /Sig';
 
 9939                                $signame = $esa[
'name'].sprintf(
' [%03d]', ($key + 1));
 
 9940                                $out .= 
' /T '.$this->_textstring($signame, $esa[
'objid']);
 
 9943                                $out .= 
"\n".
'endobj';
 
 9948                if ($this->sign AND isset($this->signature_data[
'cert_type'])) {
 
 9951                        $out .= 
'<< /Type /Annot';
 
 9952                        $out .= 
' /Subtype /Widget';
 
 9953                        $out .= 
' /Rect ['.$this->signature_appearance[
'rect'].
']';
 
 9954                        $out .= 
' /P '.$this->page_obj_id[($this->signature_appearance[
'page'])].
' 0 R'; 
 
 9956                        $out .= 
' /FT /Sig';
 
 9957                        $out .= 
' /T '.$this->_textstring($this->signature_appearance[
'name'], $this->sig_obj_id);
 
 9959                        $out .= 
' /V '.($this->sig_obj_id + 1).
' 0 R';
 
 9961                        $out .= 
"\n".
'endobj';
 
 9973                $this->
_out(
'xref');
 
 9974                $this->
_out(
'0 '.($this->n + 1));
 
 9975                $this->
_out(
'0000000000 65535 f ');
 
 9976                $freegen = ($this->n + 2);
 
 9978                        if (!isset($this->offsets[$i]) AND ($i > 1)) {
 
 9979                                $this->
_out(sprintf(
'0000000000 %05d f ', $freegen));
 
 9982                                $this->
_out(sprintf(
'%010d 00000 n ', $this->offsets[$i]));
 
 9986                $out = 
'trailer'.
"\n";
 
 9988                $out .= 
' /Size '.($this->n + 1);
 
 9989                $out .= 
' /Root '.$objid_catalog.
' 0 R';
 
 9990                $out .= 
' /Info '.$objid_info.
' 0 R';
 
 9991                if ($this->encrypted) {
 
 9992                        $out .= 
' /Encrypt '.$this->encryptdata[
'objid'].
' 0 R';
 
 9994                $out .= 
' /ID [ <'.$this->file_id.
'> <'.$this->file_id.
'> ]';
 
 9997                $this->
_out(
'startxref');
 
 9999                $this->
_out(
'%%EOF');
 
10018                        if (isset($this->CurOrientation)) {
 
10020                        } elseif ($this->fwPt > $this->fhPt) {
 
10022                                $orientation = 
'L';
 
10025                                $orientation = 
'P';
 
10029                        $this->pagedim[
$this->page] = $this->pagedim[($this->page - 1)];
 
10040                if (isset($this->newpagegroup[$this->page])) {
 
10042                        $this->currpagegroup = $this->newpagegroup[
$this->page];
 
10044                } elseif (isset($this->currpagegroup) AND ($this->currpagegroup > 0)) {
 
10076                if ($objid === 
'') {
 
10082                return $objid.
' 0 obj';
 
10107                return sprintf(
'%F %F %F %F re f', 
$x * $this->k, ((($this->h - 
$y) * $this->k) + $linew), 
$w * $this->k, $linew);
 
10132                return sprintf(
'%F %F %F %F re f', 
$x * $this->k, ((($this->h - 
$y) * $this->k) + $linew + ($this->FontSizePt / 3)), 
$w * $this->k, $linew);
 
10158                return sprintf(
'%F %F %F %F re f', 
$x * $this->k, (($this->h - 
$y + $this->FontAscent) * $this->k) - $linew, 
$w * $this->k, $linew);
 
10184                if (is_string($time)) {
 
10187                $this->doc_creation_timestamp = intval($time);
 
10197                if (is_string($time)) {
 
10200                $this->doc_modification_timestamp = intval($time);
 
10246                if ($this->isunicode) {
 
10275                if ($this->state == 2) {
 
10276                        if ($this->inxobj) {
 
10279                        } elseif ((!$this->InFooter) AND isset($this->footerlen[$this->page]) AND ($this->footerlen[$this->page] > 0)) {
 
10282                                $page = substr($pagebuff, 0, -$this->footerlen[$this->page]);
 
10283                                $footer = substr($pagebuff, -$this->footerlen[$this->page]);
 
10286                                $this->footerpos[
$this->page] += strlen($s.
"\n");
 
10291                } elseif ($this->state > 0) {
 
10304                $this->header_font = $font;
 
10324                $this->footer_font = $font;
 
10344                $this->l = $language;
 
10345                if (isset($this->l[
'a_meta_dir'])) {
 
10346                        $this->rtl = $this->l[
'a_meta_dir']==
'rtl' ? true : 
false;
 
10348                        $this->rtl = 
false;
 
10357                if ($this->state < 3) {
 
10376                if (isset(
$url[1]) AND (
$url[0] == 
'#') AND is_numeric(
$url[1])) {
 
10378                        $lnkdata = explode(
',', 
$url);
 
10379                        if (isset($lnkdata[0]) ) {
 
10380                                $page = substr($lnkdata[0], 1);
 
10381                                if (isset($lnkdata[1]) AND (strlen($lnkdata[1]) > 0)) {
 
10382                                        $lnky = floatval($lnkdata[1]);
 
10393                if (empty($color)) {
 
10399                        $this->
SetFont(
'', $this->FontStyle.$this->htmlLinkFontStyle);
 
10401                        $this->
SetFont(
'', $this->FontStyle.$style);
 
10403                $ret = $this->
Write($this->lasth, $name, 
$url, $fill, 
'', 
false, 0, $firstline, $firstblock, 0);
 
10405                $this->
SetFont(
'', $prevstyle);
 
10418                return (
$px / ($this->imgscale * $this->k));
 
10429                return @html_entity_decode($text_to_convert, ENT_QUOTES, $this->encoding);
 
10444                $objkey = $this->encryptdata[
'key'].pack(
'VXxx', 
$n);
 
10445                if ($this->encryptdata[
'mode'] == 2) { 
 
10447                        $objkey .= 
"\x73\x41\x6C\x54"; 
 
10450                $objkey = substr($objkey, 0, 16);
 
10464                if (!$this->encrypted) {
 
10467                switch ($this->encryptdata[
'mode']) {
 
10492                if (!$this->encrypted) {
 
10495                $this->encryptdata[
'objid'] = $this->
_newobj();
 
10497                if (!isset($this->encryptdata[
'Filter']) OR empty($this->encryptdata[
'Filter'])) {
 
10498                        $this->encryptdata[
'Filter'] = 
'Standard';
 
10500                $out .= 
' /Filter /'.$this->encryptdata[
'Filter'];
 
10501                if (isset($this->encryptdata[
'SubFilter']) AND !empty($this->encryptdata[
'SubFilter'])) {
 
10502                        $out .= 
' /SubFilter /'.$this->encryptdata[
'SubFilter'];
 
10504                if (!isset($this->encryptdata[
'V']) OR empty($this->encryptdata[
'V'])) {
 
10505                        $this->encryptdata[
'V'] = 1;
 
10508                $out .= 
' /V '.$this->encryptdata[
'V'];
 
10509                if (isset($this->encryptdata[
'Length']) AND !empty($this->encryptdata[
'Length'])) {
 
10511                        $out .= 
' /Length '.$this->encryptdata[
'Length'];
 
10513                        $out .= 
' /Length 40';
 
10515                if ($this->encryptdata[
'V'] >= 4) {
 
10516                        if (!isset($this->encryptdata[
'StmF']) OR empty($this->encryptdata[
'StmF'])) {
 
10517                                $this->encryptdata[
'StmF'] = 
'Identity';
 
10519                        if (!isset($this->encryptdata[
'StrF']) OR empty($this->encryptdata[
'StrF'])) {
 
10521                                $this->encryptdata[
'StrF'] = 
'Identity';
 
10524                        if (isset($this->encryptdata[
'CF']) AND !empty($this->encryptdata[
'CF'])) {
 
10526                                $out .= 
' /'.$this->encryptdata[
'StmF'].
' <<';
 
10527                                $out .= 
' /Type /CryptFilter';
 
10528                                if (isset($this->encryptdata[
'CF'][
'CFM']) AND !empty($this->encryptdata[
'CF'][
'CFM'])) {
 
10530                                        $out .= 
' /CFM /'.$this->encryptdata[
'CF'][
'CFM'];
 
10531                                        if ($this->encryptdata[
'pubkey']) {
 
10532                                                $out .= 
' /Recipients [';
 
10533                                                foreach ($this->encryptdata[
'Recipients'] as $rec) {
 
10534                                                        $out .= 
' <'.$rec.
'>';
 
10537                                                if (isset($this->encryptdata[
'CF'][
'EncryptMetadata']) AND (!$this->encryptdata[
'CF'][
'EncryptMetadata'])) {
 
10538                                                        $out .= 
' /EncryptMetadata false';
 
10540                                                        $out .= 
' /EncryptMetadata true';
 
10544                                        $out .= 
' /CFM /None';
 
10546                                if (isset($this->encryptdata[
'CF'][
'AuthEvent']) AND !empty($this->encryptdata[
'CF'][
'AuthEvent'])) {
 
10548                                        $out .= 
' /AuthEvent /'.$this->encryptdata[
'CF'][
'AuthEvent'];
 
10550                                        $out .= 
' /AuthEvent /DocOpen';
 
10552                                if (isset($this->encryptdata[
'CF'][
'Length']) AND !empty($this->encryptdata[
'CF'][
'Length'])) {
 
10554                                        $out .= 
' /Length '.$this->encryptdata[
'CF'][
'Length'];
 
10559                        $out .= 
' /StmF /'.$this->encryptdata[
'StmF'];
 
10561                        $out .= 
' /StrF /'.$this->encryptdata[
'StrF'];
 
10562                        if (isset($this->encryptdata[
'EFF']) AND !empty($this->encryptdata[
'EFF'])) {
 
10564                                $out .= 
' /EFF /'.$this->encryptdata[
''];
 
10568                if ($this->encryptdata[
'pubkey']) {
 
10569                        if (($this->encryptdata[
'V'] < 4) AND isset($this->encryptdata[
'Recipients']) AND !empty($this->encryptdata[
'Recipients'])) {
 
10570                                $out .= 
' /Recipients [';
 
10571                                foreach ($this->encryptdata[
'Recipients'] as $rec) {
 
10572                                        $out .= 
' <'.$rec.
'>';
 
10578                        if ($this->encryptdata[
'V'] == 5) { 
 
10580                                $out .= 
' /OE ('.TCPDF_STATIC::_escape($this->encryptdata[
'OE']).
')';
 
10581                                $out .= 
' /UE ('.TCPDF_STATIC::_escape($this->encryptdata[
'UE']).
')';
 
10582                                $out .= 
' /Perms ('.TCPDF_STATIC::_escape($this->encryptdata[
'perms']).
')';
 
10583                        } elseif ($this->encryptdata[
'V'] == 4) { 
 
10585                        } elseif ($this->encryptdata[
'V'] < 2) { 
 
10590                        $out .= 
' /O ('.TCPDF_STATIC::_escape($this->encryptdata[
'O']).
')';
 
10591                        $out .= 
' /U ('.TCPDF_STATIC::_escape($this->encryptdata[
'U']).
')';
 
10592                        $out .= 
' /P '.$this->encryptdata[
'P'];
 
10593                        if (isset($this->encryptdata[
'EncryptMetadata']) AND (!$this->encryptdata[
'EncryptMetadata'])) {
 
10594                                $out .= 
' /EncryptMetadata false';
 
10596                                $out .= 
' /EncryptMetadata true';
 
10600                $out .= 
"\n".
'endobj';
 
10612                if ($this->encryptdata[
'mode'] == 0) { 
 
10614                } elseif ($this->encryptdata[
'mode'] < 3) { 
 
10616                        $enc = 
TCPDF_STATIC::_RC4($this->encryptdata[
'key'], $tmp, $this->last_enc_key, $this->last_enc_key_c);
 
10617                        $len = strlen($tmp);
 
10618                        for ($i = 1; $i <= 19; ++$i) {
 
10620                                for ($j = 0; $j < $len; ++$j) {
 
10621                                        $ek .= chr(ord($this->encryptdata[
'key'][$j]) ^ $i);
 
10625                        $enc .= str_repeat(
"\x00", 16);
 
10626                        return substr($enc, 0, 32);
 
10627                } elseif ($this->encryptdata[
'mode'] == 3) { 
 
10630                        $this->encryptdata[
'UVS'] = substr($seed, 0, 8);
 
10632                        $this->encryptdata[
'UKS'] = substr($seed, 8, 16);
 
10633                        return hash(
'sha256', $this->encryptdata[
'user_password'].$this->encryptdata[
'UVS'], 
true).$this->encryptdata[
'UVS'].$this->encryptdata[
'UKS'];
 
10645                $hashkey = hash(
'sha256', $this->encryptdata[
'user_password'].$this->encryptdata[
'UKS'], 
true);
 
10657                if ($this->encryptdata[
'mode'] < 3) { 
 
10659                        if ($this->encryptdata[
'mode'] > 0) {
 
10660                                for ($i = 0; $i < 50; ++$i) {
 
10664                        $owner_key = substr($tmp, 0, ($this->encryptdata[
'Length'] / 8));
 
10665                        $enc = 
TCPDF_STATIC::_RC4($owner_key, $this->encryptdata[
'user_password'], $this->last_enc_key, $this->last_enc_key_c);
 
10666                        if ($this->encryptdata[
'mode'] > 0) {
 
10667                                $len = strlen($owner_key);
 
10668                                for ($i = 1; $i <= 19; ++$i) {
 
10670                                        for ($j = 0; $j < $len; ++$j) {
 
10671                                                $ek .= chr(ord($owner_key[$j]) ^ $i);
 
10677                } elseif ($this->encryptdata[
'mode'] == 3) { 
 
10680                        $this->encryptdata[
'OVS'] = substr($seed, 0, 8);
 
10682                        $this->encryptdata[
'OKS'] = substr($seed, 8, 16);
 
10683                        return hash(
'sha256', $this->encryptdata[
'owner_password'].$this->encryptdata[
'OVS'].$this->encryptdata[
'U'], 
true).$this->encryptdata[
'OVS'].$this->encryptdata[
'OKS'];
 
10695                $hashkey = hash(
'sha256', $this->encryptdata[
'owner_password'].$this->encryptdata[
'OKS'].$this->encryptdata[
'U'], 
true);
 
10710                foreach ($psw_array as $c) {
 
10713                return substr($psw, 0, 127);
 
10723                $keybytelen = ($this->encryptdata[
'Length'] / 8);
 
10724                if (!$this->encryptdata[
'pubkey']) { 
 
10725                        if ($this->encryptdata[
'mode'] == 3) { 
 
10729                                $this->encryptdata[
'user_password'] = $this->
_fixAES256Password($this->encryptdata[
'user_password']);
 
10730                                $this->encryptdata[
'owner_password'] = $this->
_fixAES256Password($this->encryptdata[
'owner_password']);
 
10732                                $this->encryptdata[
'U'] = $this->
_Uvalue();
 
10734                                $this->encryptdata[
'UE'] = $this->
_UEvalue();
 
10736                                $this->encryptdata[
'O'] = $this->
_Ovalue();
 
10738                                $this->encryptdata[
'OE'] = $this->
_OEvalue();
 
10740                                $this->encryptdata[
'P'] = $this->encryptdata[
'protection'];
 
10743                                $perms .= chr(255).chr(255).chr(255).chr(255); 
 
10744                                if (isset($this->encryptdata[
'CF'][
'EncryptMetadata']) AND (!$this->encryptdata[
'CF'][
'EncryptMetadata'])) { 
 
10757                                $this->encryptdata[
'O'] = $this->
_Ovalue();
 
10761                                $tmp = 
TCPDF_STATIC::_md5_16($this->encryptdata[
'user_password'].$this->encryptdata[
'O'].$permissions.$this->encryptdata[
'fileid']);
 
10762                                if ($this->encryptdata[
'mode'] > 0) {
 
10763                                        for ($i = 0; $i < 50; ++$i) {
 
10767                                $this->encryptdata[
'key'] = substr($tmp, 0, $keybytelen);
 
10769                                $this->encryptdata[
'U'] = $this->
_Uvalue();
 
10771                                $this->encryptdata[
'P'] = $this->encryptdata[
'protection'];
 
10776                        $recipient_bytes = 
'';
 
10777                        foreach ($this->encryptdata[
'pubkeys'] as $pubkey) {
 
10779                                if (isset($pubkey[
'p'])) {
 
10782                                        $pkprotection = $this->encryptdata[
'protection'];
 
10787                                $envelope = $seed.$pkpermissions;
 
10792                                        $this->
Error(
'Unable to create temporary key file: '.$tempkeyfile);
 
10794                                $envelope_length = strlen($envelope);
 
10795                                fwrite($f, $envelope, $envelope_length);
 
10798                                if (!openssl_pkcs7_encrypt($tempkeyfile, $tempencfile, $pubkey[
'c'], array(), PKCS7_BINARY | PKCS7_DETACHED)) {
 
10799                                        $this->
Error(
'Unable to encrypt the file: '.$tempkeyfile);
 
10802                                $signature = file_get_contents($tempencfile, 
false, 
null, $envelope_length);
 
10804                                $signature = substr($signature, strpos($signature, 
'Content-Disposition'));
 
10805                                $tmparr = explode(
"\n\n", $signature);
 
10806                                $signature = trim($tmparr[1]);
 
10809                                $signature = base64_decode($signature);
 
10811                                $hexsignature = current(unpack(
'H*', $signature));
 
10813                                $this->encryptdata[
'Recipients'][] = $hexsignature;
 
10815                                $recipient_bytes .= $signature;
 
10818                        if ($this->encryptdata[
'mode'] == 3) { 
 
10819                                $this->encryptdata[
'key'] = substr(hash(
'sha256', $seed.$recipient_bytes, 
true), 0, $keybytelen);
 
10821                                $this->encryptdata[
'key'] = substr(sha1($seed.$recipient_bytes, 
true), 0, $keybytelen);
 
10840        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) {
 
10841                if ($this->pdfa_mode) {
 
10846                if (($pubkeys !== 
null) AND (is_array($pubkeys))) {
 
10848                        $this->encryptdata[
'pubkeys'] = $pubkeys;
 
10853                        if (!function_exists(
'openssl_pkcs7_encrypt')) {
 
10854                                $this->
Error(
'Public-Key Security requires openssl library.');
 
10857                        $this->encryptdata[
'pubkey'] = 
true;
 
10858                        $this->encryptdata[
'Filter'] = 
'Adobe.PubSec';
 
10859                        $this->encryptdata[
'StmF'] = 
'DefaultCryptFilter';
 
10860                        $this->encryptdata[
'StrF'] = 
'DefaultCryptFilter';
 
10863                        $this->encryptdata[
'pubkey'] = 
false;
 
10864                        $this->encryptdata[
'Filter'] = 
'Standard';
 
10865                        $this->encryptdata[
'StmF'] = 
'StdCF';
 
10866                        $this->encryptdata[
'StrF'] = 
'StdCF';
 
10869                        if (!extension_loaded(
'openssl') && !extension_loaded(
'mcrypt')) {
 
10870                                $this->
Error(
'AES encryption requires openssl or mcrypt extension (http://www.php.net/manual/en/mcrypt.requirements.php).');
 
10872                        if (extension_loaded(
'openssl') && !in_array(
'aes-256-cbc', openssl_get_cipher_methods())) {
 
10873                                $this->
Error(
'AES encryption requires openssl/aes-256-cbc cypher.');
 
10875                        if (extension_loaded(
'mcrypt') && mcrypt_get_cipher_name(MCRYPT_RIJNDAEL_128) === 
false) {
 
10876                                $this->
Error(
'AES encryption requires MCRYPT_RIJNDAEL_128 cypher.');
 
10878                        if (($mode == 3) AND !function_exists(
'hash')) {
 
10880                                $this->
Error(
'AES 256 encryption requires HASH Message Digest Framework (http://www.php.net/manual/en/book.hash.php).');
 
10883                if ($owner_pass === 
null) {
 
10886                $this->encryptdata[
'user_password'] = $user_pass;
 
10887                $this->encryptdata[
'owner_password'] = $owner_pass;
 
10888                $this->encryptdata[
'mode'] = $mode;
 
10891                                $this->encryptdata[
'V'] = 1;
 
10892                                $this->encryptdata[
'Length'] = 40;
 
10893                                $this->encryptdata[
'CF'][
'CFM'] = 
'V2';
 
10897                                $this->encryptdata[
'V'] = 2;
 
10898                                $this->encryptdata[
'Length'] = 128;
 
10899                                $this->encryptdata[
'CF'][
'CFM'] = 
'V2';
 
10900                                if ($this->encryptdata[
'pubkey']) {
 
10901                                        $this->encryptdata[
'SubFilter'] = 
'adbe.pkcs7.s4';
 
10902                                        $this->encryptdata[
'Recipients'] = array();
 
10907                                $this->encryptdata[
'V'] = 4;
 
10908                                $this->encryptdata[
'Length'] = 128;
 
10909                                $this->encryptdata[
'CF'][
'CFM'] = 
'AESV2';
 
10910                                $this->encryptdata[
'CF'][
'Length'] = 128;
 
10911                                if ($this->encryptdata[
'pubkey']) {
 
10912                                        $this->encryptdata[
'SubFilter'] = 
'adbe.pkcs7.s5';
 
10913                                        $this->encryptdata[
'Recipients'] = array();
 
10918                                $this->encryptdata[
'V'] = 5;
 
10919                                $this->encryptdata[
'Length'] = 256;
 
10920                                $this->encryptdata[
'CF'][
'CFM'] = 
'AESV3';
 
10921                                $this->encryptdata[
'CF'][
'Length'] = 256;
 
10922                                if ($this->encryptdata[
'pubkey']) {
 
10923                                        $this->encryptdata[
'SubFilter'] = 
'adbe.pkcs7.s5';
 
10924                                        $this->encryptdata[
'Recipients'] = array();
 
10929                $this->encrypted = 
true;
 
10947                if ($this->state != 2) {
 
10951                if ($this->inxobj) {
 
10953                        $this->xobjects[
$this->xobjid][
'transfmrk'][] = strlen($this->xobjects[$this->xobjid][
'outdata']);
 
10970                if ($this->state != 2) {
 
10974                if (isset($this->transfmatrix[$this->transfmatrix_key])) {
 
10975                        array_pop($this->transfmatrix[$this->transfmatrix_key]);
 
10978                if ($this->inxobj) {
 
10980                        array_pop($this->xobjects[$this->xobjid][
'transfmrk']);
 
10982                        array_pop($this->transfmrk[$this->page]);
 
11041                if (($s_x == 0) OR ($s_y == 0)) {
 
11042                        $this->
Error(
'Please do not use values equal to zero for scaling');
 
11044                $y = ($this->h - 
$y) * $this->k;
 
11054                $tm[4] = 
$x * (1 - $s_x);
 
11055                $tm[5] = 
$y * (1 - $s_y);
 
11079                $this->
Scale(100, -100, 
'', 
$y);
 
11167                $y = ($this->h - 
$y) * $this->k;
 
11171                $tm[0] = cos(deg2rad(
$angle));
 
11172                $tm[1] = sin(deg2rad(
$angle));
 
11175                $tm[4] = 
$x + ($tm[1] * 
$y) - ($tm[0] * 
$x);
 
11176                $tm[5] = 
$y - ($tm[0] * 
$y) - ($tm[1] * 
$x);
 
11224                if (($angle_x <= -90) OR ($angle_x >= 90) OR ($angle_y <= -90) OR ($angle_y >= 90)) {
 
11225                        $this->
Error(
'Please use values between -90 and +90 degrees for Skewing.');
 
11228                $y = ($this->h - 
$y) * $this->k;
 
11232                $tm[1] = tan(deg2rad($angle_y));
 
11233                $tm[2] = tan(deg2rad($angle_x));
 
11235                $tm[4] = -$tm[2] * 
$y;
 
11236                $tm[5] = -$tm[1] * 
$x;
 
11249                if ($this->state != 2) {
 
11252                $this->
_out(sprintf(
'%F %F %F %F %F %F cm', $tm[0], $tm[1], $tm[2], $tm[3], $tm[4], $tm[5]));
 
11254                $this->transfmatrix[
$this->transfmatrix_key][] = array(
'a' => $tm[0], 
'b' => $tm[1], 
'c' => $tm[2], 
'd' => $tm[3], 
'e' => $tm[4], 
'f' => $tm[5]);
 
11256                if ($this->inxobj) {
 
11258                        if (end($this->xobjects[$this->xobjid][
'transfmrk']) !== 
false) {
 
11259                                $key = key($this->xobjects[$this->xobjid][
'transfmrk']);
 
11260                                $this->xobjects[
$this->xobjid][
'transfmrk'][$key] = strlen($this->xobjects[$this->xobjid][
'outdata']);
 
11262                } elseif (end($this->transfmrk[$this->page]) !== 
false) {
 
11263                        $key = key($this->transfmrk[$this->page]);
 
11282                $this->LineWidth = $width;
 
11283                $this->linestyleWidth = sprintf(
'%F w', ($width * $this->k));
 
11284                if ($this->state == 2) {
 
11285                        $this->
_out($this->linestyleWidth);
 
11325                if (!is_array(
$style)) {
 
11328                if (isset(
$style[
'width'])) {
 
11329                        $this->LineWidth = 
$style[
'width'];
 
11330                        $this->linestyleWidth = sprintf(
'%F w', (
$style[
'width'] * $this->k));
 
11331                        $s .= $this->linestyleWidth.
' ';
 
11333                if (isset(
$style[
'cap'])) {
 
11334                        $ca = array(
'butt' => 0, 
'round'=> 1, 
'square' => 2);
 
11335                        if (isset($ca[
$style[
'cap']])) {
 
11336                                $this->linestyleCap = $ca[
$style[
'cap']].
' J';
 
11337                                $s .= $this->linestyleCap.
' ';
 
11340                if (isset(
$style[
'join'])) {
 
11341                        $ja = array(
'miter' => 0, 
'round' => 1, 
'bevel' => 2);
 
11342                        if (isset($ja[
$style[
'join']])) {
 
11343                                $this->linestyleJoin = $ja[
$style[
'join']].
' j';
 
11344                                $s .= $this->linestyleJoin.
' ';
 
11347                if (isset(
$style[
'dash'])) {
 
11350                                if (preg_match(
'/^.+,/', 
$style[
'dash']) > 0) {
 
11356                                foreach (
$tab as $i => $v) {
 
11358                                                $dash_string .= 
' ';
 
11360                                        $dash_string .= sprintf(
'%F', $v);
 
11366                        $this->linestyleDash = sprintf(
'[%s] %F d', $dash_string, 
$style[
'phase']);
 
11367                        $s .= $this->linestyleDash.
' ';
 
11369                if (isset(
$style[
'color'])) {
 
11372                if (!
$ret AND ($this->state == 2)) {
 
11386                if ($this->state == 2) {
 
11387                        $this->
_out(sprintf(
'%F %F m', (
$x * $this->k), (($this->h - 
$y) * $this->k)));
 
11400                if ($this->state == 2) {
 
11401                        $this->
_out(sprintf(
'%F %F l', (
$x * $this->k), (($this->h - 
$y) * $this->k)));
 
11416                if ($this->state == 2) {
 
11417                        $this->
_out(sprintf(
'%F %F %F %F re %s', (
$x * $this->k), (($this->h - 
$y) * $this->k), (
$w * $this->k), (-
$h * $this->k), $op));
 
11434                if ($this->state == 2) {
 
11435                        $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)));
 
11450                if ($this->state == 2) {
 
11451                        $this->
_out(sprintf(
'%F %F %F %F v', ($x2 * $this->k), (($this->h - $y2) * $this->k), ($x3 * $this->k), (($this->h - $y3) * $this->k)));
 
11466                if ($this->state == 2) {
 
11467                        $this->
_out(sprintf(
'%F %F %F %F y', ($x1 * $this->k), (($this->h - $y1) * $this->k), ($x3 * $this->k), (($this->h - $y3) * $this->k)));
 
11483                if ($this->state != 2) {
 
11513                if ($this->state != 2) {
 
11519                if (!(strpos(
$style, 
'F') === 
false) AND !empty($fill_color)) {
 
11530                                $opnostroke = array(
'S' => 
'', 
'D' => 
'', 
's' => 
'', 
'd' => 
'', 
'B' => 
'F', 
'FD' => 
'F', 
'DF' => 
'F', 
'B*' => 
'F*', 
'F*D' => 
'F*', 
'DF*' => 
'F*', 
'b' => 
'f', 
'fd' => 
'f', 
'df' => 
'f', 
'b*' => 
'f*', 
'f*d' => 
'f*', 
'df*' => 
'f*' );
 
11531                                if (isset($opnostroke[
$style])) {
 
11541                        $border_style2 = array();
 
11543                                $length = strlen($line);
 
11544                                for ($i = 0; $i < $length; ++$i) {
 
11545                                        $border_style2[$line[$i]] = $value;
 
11583        public function Curve($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3, 
$style=
'', $line_style=array(), $fill_color=array()) {
 
11584                if ($this->state != 2) {
 
11587                if (!(
false === strpos(
$style, 
'F')) AND isset($fill_color)) {
 
11595                $this->
_outCurve($x1, $y1, $x2, $y2, $x3, $y3);
 
11613        public function Polycurve($x0, $y0, $segments, 
$style=
'', $line_style=array(), $fill_color=array()) {
 
11614                if ($this->state != 2) {
 
11617                if (!(
false === strpos(
$style, 
'F')) AND isset($fill_color)) {
 
11622                        $line_style = array();
 
11628                foreach ($segments as $segment) {
 
11629                        list($x1, $y1, $x2, $y2, $x3, $y3) = $segment;
 
11630                        $this->
_outCurve($x1, $y1, $x2, $y2, $x3, $y3);
 
11653        public function Ellipse($x0, $y0, $rx, $ry=
'', 
$angle=0, $astart=0, $afinish=360, 
$style=
'', $line_style=array(), $fill_color=array(), $nc=2) {
 
11654                if ($this->state != 2) {
 
11660                if (!(
false === strpos(
$style, 
'F')) AND isset($fill_color)) {
 
11665                        $line_style = array();
 
11670                $this->
_outellipticalarc($x0, $y0, $rx, $ry, 
$angle, $astart, $afinish, 
false, $nc, 
true, 
true, 
false);
 
11694        protected function _outellipticalarc(
$xc, 
$yc, $rx, $ry, $xang=0, $angs=0, $angf=360, $pie=
false, $nc=2, $startpoint=
true, $ccw=
true, $svg=
false) {
 
11695                if (($rx <= 0) OR ($ry < 0)) {
 
11702                $xmin = 2147483647;
 
11703                $ymin = 2147483647;
 
11710                $xang = deg2rad((
float) $xang);
 
11711                $angs = deg2rad((
float) $angs);
 
11712                $angf = deg2rad((
float) $angf);
 
11717                        $as = atan2((sin($angs) / $ry), (cos($angs) / $rx));
 
11718                        $af = atan2((sin($angf) / $ry), (cos($angf) / $rx));
 
11726                if ($ccw AND ($as > $af)) {
 
11729                } elseif (!$ccw AND ($as < $af)) {
 
11733                $total_angle = ($af - $as);
 
11738                $nc *= (2 * abs($total_angle) / M_PI);
 
11739                $nc = round($nc) + 1;
 
11741                $arcang = ($total_angle / $nc);
 
11744                $y0 = ($this->h - 
$yc);
 
11747                $alpha = sin($arcang) * ((sqrt(4 + (3 * pow(tan(($arcang) / 2), 2))) - 1) / 3);
 
11748                $cos_xang = cos($xang);
 
11749                $sin_xang = sin($xang);
 
11750                $cos_ang = cos($ang);
 
11751                $sin_ang = sin($ang);
 
11753                $px1 = $x0 + ($rx * $cos_xang * $cos_ang) - ($ry * $sin_xang * $sin_ang);
 
11754                $py1 = $y0 + ($rx * $sin_xang * $cos_ang) + ($ry * $cos_xang * $sin_ang);
 
11756                $qx1 = (
$alpha * ((-$rx * $cos_xang * $sin_ang) - ($ry * $sin_xang * $cos_ang)));
 
11757                $qy1 = (
$alpha * ((-$rx * $sin_xang * $sin_ang) + ($ry * $cos_xang * $cos_ang)));
 
11760                        $this->
_outLine($px1, $this->h - $py1);
 
11761                } elseif ($startpoint) {
 
11763                        $this->
_outPoint($px1, $this->h - $py1);
 
11766                for ($i = 1; $i <= $nc; ++$i) {
 
11768                        $ang = $as + ($i * $arcang);
 
11772                        $cos_ang = cos($ang);
 
11773                        $sin_ang = sin($ang);
 
11775                        $px2 = $x0 + ($rx * $cos_xang * $cos_ang) - ($ry * $sin_xang * $sin_ang);
 
11776                        $py2 = $y0 + ($rx * $sin_xang * $cos_ang) + ($ry * $cos_xang * $sin_ang);
 
11778                        $qx2 = (
$alpha * ((-$rx * $cos_xang * $sin_ang) - ($ry * $sin_xang * $cos_ang)));
 
11779                        $qy2 = (
$alpha * ((-$rx * $sin_xang * $sin_ang) + ($ry * $cos_xang * $cos_ang)));
 
11781                        $cx1 = ($px1 + $qx1);
 
11782                        $cy1 = ($this->h - ($py1 + $qy1));
 
11783                        $cx2 = ($px2 - $qx2);
 
11784                        $cy2 = ($this->h - ($py2 - $qy2));
 
11786                        $cy3 = ($this->h - $py2);
 
11787                        $this->
_outCurve($cx1, $cy1, $cx2, $cy2, $cx3, $cy3);
 
11789                        $xmin = min($xmin, $cx1, $cx2, $cx3);
 
11790                        $ymin = min($ymin, $cy1, $cy2, $cy3);
 
11791                        $xmax = max($xmax, $cx1, $cx2, $cx3);
 
11792                        $ymax = max($ymax, $cy1, $cy2, $cy3);
 
11802                        $xmin = min($xmin, 
$xc);
 
11803                        $ymin = min($ymin, 
$yc);
 
11804                        $xmax = max($xmax, 
$xc);
 
11805                        $ymax = max($ymax, 
$yc);
 
11807                return array($xmin, $ymin, $xmax, $ymax);
 
11825        public function Circle($x0, $y0, 
$r, $angstr=0, $angend=360, 
$style=
'', $line_style=array(), $fill_color=array(), $nc=2) {
 
11826                $this->
Ellipse($x0, $y0, 
$r, 
$r, 0, $angstr, $angend, 
$style, $line_style, $fill_color, $nc);
 
11844                $this->
Polygon($p, 
$style, $line_style, $fill_color, 
false);
 
11862        public function Polygon($p, 
$style=
'', $line_style=array(), $fill_color=array(), $closed=
true) {
 
11863                if ($this->state != 2) {
 
11870                        for ($i = 0; $i < 4; ++$i) {
 
11871                                $p[$nc + $i] = $p[$i];
 
11874                        if (isset($line_style[0])) {
 
11875                                $line_style[$np] = $line_style[0];
 
11879                if (!(
false === strpos(
$style, 
'F')) AND isset($fill_color)) {
 
11884                        $line_style = array();
 
11888                        if (isset($line_style[
'all'])) {
 
11896                                        for ($i = 2; $i < $nc; $i = $i + 2) {
 
11897                                                $this->
_outLine($p[$i], $p[$i + 1]);
 
11903                                for ($i = 2; $i < $nc; $i = $i + 2) {
 
11904                                        $line_num = ($i / 2) - 1;
 
11905                                        if (isset($line_style[$line_num])) {
 
11906                                                if ($line_style[$line_num] != 0) {
 
11907                                                        if (is_array($line_style[$line_num])) {
 
11910                                                                $this->
_outPoint($p[$i - 2], $p[$i - 1]);
 
11911                                                                $this->
_outLine($p[$i], $p[$i + 1]);
 
11915                                                                $this->
_outLine($p[$i], $p[$i + 1]);
 
11919                                                $this->
_outLine($p[$i], $p[$i + 1]);
 
11927                        for ($i = 2; $i < $nc; $i = $i + 2) {
 
11928                                $this->
_outLine($p[$i], $p[$i + 1]);
 
11963        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()) {
 
11967                if ($draw_circle) {
 
11968                        $this->
Circle($x0, $y0, 
$r, 0, 360, $circle_style, $circle_outLine_style, $circle_fill_color);
 
11971                for ($i = 0; $i < $ns; ++$i) {
 
11972                        $a = 
$angle + ($i * 360 / $ns);
 
11973                        $a_rad = deg2rad((
float) $a);
 
11974                        $p[] = $x0 + (
$r * sin($a_rad));
 
11975                        $p[] = $y0 + (
$r * cos($a_rad));
 
12011        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()) {
 
12015                if ($draw_circle) {
 
12016                        $this->
Circle($x0, $y0, 
$r, 0, 360, $circle_style, $circle_outLine_style, $circle_fill_color);
 
12019                $visited = array();
 
12020                for ($i = 0; $i < $nv; ++$i) {
 
12021                        $a = 
$angle + ($i * 360 / $nv);
 
12022                        $a_rad = deg2rad((
float) $a);
 
12023                        $p2[] = $x0 + (
$r * sin($a_rad));
 
12024                        $p2[] = $y0 + (
$r * cos($a_rad));
 
12025                        $visited[] = 
false;
 
12030                        $p[] = $p2[$i * 2];
 
12031                        $p[] = $p2[($i * 2) + 1];
 
12032                        $visited[$i] = 
true;
 
12035                } 
while (!$visited[$i]);
 
12073                if ($this->state != 2) {
 
12076                if (($round_corner == 
'0000') OR (($rx == $ry) AND ($rx == 0))) {
 
12082                if (!(
false === strpos(
$style, 
'F')) AND isset($fill_color)) {
 
12092                $MyArc = 4 / 3 * (sqrt(2) - 1);
 
12097                if ($round_corner[0]) {
 
12105                if ($round_corner[1]) {
 
12113                if ($round_corner[2]) {
 
12121                if ($round_corner[3]) {
 
12142        public function Arrow($x0, $y0, $x1, $y1, $head_style=0, $arm_size=5, $arm_angle=15) {
 
12145                $dir_angle = atan2(($y0 - $y1), ($x0 - $x1));
 
12146                if ($dir_angle < 0) {
 
12147                        $dir_angle += (2 * M_PI);
 
12149                $arm_angle = deg2rad($arm_angle);
 
12152                if ($head_style > 0) {
 
12158                $this->
Line($x0, $y0, $sx1, $sy1);
 
12160                $x2L = $x1 + ($arm_size * cos($dir_angle + $arm_angle));
 
12161                $y2L = $y1 + ($arm_size * sin($dir_angle + $arm_angle));
 
12163                $x2R = $x1 + ($arm_size * cos($dir_angle - $arm_angle));
 
12164                $y2R = $y1 + ($arm_size * sin($dir_angle - $arm_angle));
 
12167                switch ($head_style) {
 
12171                                $style = array(1, 1, 0);
 
12190                $this->
Polygon(array($x2L, $y2L, $x1, $y1, $x2R, $y2R), $mode, 
$style, array());
 
12215                } elseif (
$y < 0) {
 
12217                } elseif (
$y > $this->h) {
 
12222                } elseif (
$x < 0) {
 
12224                } elseif (
$x > $this->w) {
 
12233                if (empty(
$page)) {
 
12235                        if (empty(
$page)) {
 
12239                $this->dests[$name] = array(
'x' => 
$x, 
'y' => 
$y, 
'p' => 
$page, 
'f' => $fixed);
 
12261                if (empty($this->dests)) {
 
12264                $this->n_dests = $this->
_newobj();
 
12266                foreach($this->dests as $name => $o) {
 
12267                        $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)));
 
12270                $out .= 
"\n".
'endobj';
 
12307                if (isset($this->outlines[0])) {
 
12308                        $lastoutline = end($this->outlines);
 
12309                        $maxlevel = $lastoutline[
'l'] + 1;
 
12313                if ($level > $maxlevel) {
 
12314                        $level = $maxlevel;
 
12318                } elseif (
$y < 0) {
 
12320                } elseif (
$y > $this->h) {
 
12325                } elseif (
$x < 0) {
 
12327                } elseif (
$x > $this->w) {
 
12336                if (empty(
$page)) {
 
12338                        if (empty(
$page)) {
 
12342                $this->outlines[] = array(
't' => 
$txt, 
'l' => $level, 
'x' => 
$x, 
'y' => 
$y, 
'p' => 
$page, 
'f' => $fixed, 
's' => strtoupper(
$style), 
'c' => $color, 
'u' => $link);
 
12352                $outline_p = array();
 
12353                $outline_y = array();
 
12354                foreach ($this->outlines as $key => 
$row) {
 
12355                        $outline_p[$key] = 
$row[
'p'];
 
12356                        $outline_k[$key] = $key;
 
12359                array_multisort($outline_p, SORT_NUMERIC, SORT_ASC, $outline_k, SORT_NUMERIC, SORT_ASC, $this->outlines);
 
12369                $nb = count($this->outlines);
 
12377                foreach ($this->outlines as $i => $o) {
 
12379                                $parent = $lru[($o[
'l'] - 1)];
 
12381                                $this->outlines[$i][
'parent'] = $parent;
 
12382                                $this->outlines[$parent][
'last'] = $i;
 
12383                                if ($o[
'l'] > $level) {
 
12385                                        $this->outlines[$parent][
'first'] = $i;
 
12388                                $this->outlines[$i][
'parent'] = $nb;
 
12390                        if (($o[
'l'] <= $level) AND ($i > 0)) {
 
12392                                $prev = $lru[$o[
'l']];
 
12393                                $this->outlines[$prev][
'next'] = $i;
 
12394                                $this->outlines[$i][
'prev'] = $prev;
 
12396                        $lru[$o[
'l']] = $i;
 
12401                $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';
 
12402                foreach ($this->outlines as $i => $o) {
 
12405                        $title = preg_replace($nltags, 
"\n", $o[
't']);
 
12410                        $out = 
'<</Title '.$this->_textstring(
$title, $oid);
 
12411                        $out .= 
' /Parent '.($n + $o[
'parent']).
' 0 R';
 
12412                        if (isset($o[
'prev'])) {
 
12413                                $out .= 
' /Prev '.($n + $o[
'prev']).
' 0 R';
 
12415                        if (isset($o[
'next'])) {
 
12416                                $out .= 
' /Next '.($n + $o[
'next']).
' 0 R';
 
12418                        if (isset($o[
'first'])) {
 
12419                                $out .= 
' /First '.($n + $o[
'first']).
' 0 R';
 
12421                        if (isset($o[
'last'])) {
 
12422                                $out .= 
' /Last '.($n + $o[
'last']).
' 0 R';
 
12424                        if (isset($o[
'u']) AND !empty($o[
'u'])) {
 
12426                                if (is_string($o[
'u'])) {
 
12427                                        if ($o[
'u'][0] == 
'#') {
 
12429                                                $out .= 
' /Dest /'.TCPDF_STATIC::encodeNameObject(substr($o[
'u'], 1));
 
12430                                        } elseif ($o[
'u'][0] == 
'%') {
 
12432                                                $filename = basename(substr($o[
'u'], 1));
 
12433                                                $out .= 
' /A <</S /GoToE /D [0 /Fit] /NewWindow true /T << /R /C /P '.($o[
'p'] - 1).
' /A '.$this->embeddedfiles[
$filename][
'a'].
' >> >>';
 
12434                                        } elseif ($o[
'u'][0] == 
'*') {
 
12436                                                $filename = basename(substr($o[
'u'], 1));
 
12437                                                $jsa = 
'var D=event.target.doc;var MyData=D.dataObjects;for (var i in MyData) if (MyData[i].path=="'.$filename.
'") D.exportDataObject( { cName : MyData[i].name, nLaunch : 2});';
 
12438                                                $out .= 
' /A <</S /JavaScript /JS '.$this->_textstring($jsa, $oid).
'>>';
 
12441                                                $out .= 
' /A <</S /URI /URI '.$this->_datastring($this->
unhtmlentities($o[
'u']), $oid).
'>>';
 
12443                                } elseif (isset($this->links[$o[
'u']])) {
 
12445                                        $l = $this->links[$o[
'u']];
 
12446                                        if (isset($this->page_obj_id[(
$l[
'p'])])) {
 
12447                                                $out .= sprintf(
' /Dest [%u 0 R /XYZ 0 %F null]', $this->page_obj_id[(
$l[
'p'])], ($this->pagedim[
$l[
'p']][
'h'] - (
$l[
'y'] * $this->k)));
 
12450                        } elseif (isset($this->page_obj_id[($o[
'p'])])) {
 
12452                                $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)));
 
12456                        if (!empty($o[
's'])) {
 
12458                                if (strpos($o[
's'], 
'B') !== 
false) {
 
12462                                if (strpos($o[
's'], 
'I') !== 
false) {
 
12468                        if (isset($o[
'c']) AND is_array($o[
'c']) AND (count($o[
'c']) == 3)) {
 
12469                                $color = array_values($o[
'c']);
 
12470                                $out .= sprintf(
' /C [%F %F %F]', ($color[0] / 255), ($color[1] / 255), ($color[2] / 255));
 
12473                                $out .= 
' /C [0.0 0.0 0.0]';
 
12475                        $out .= 
' /Count 0'; 
 
12477                        $out .= 
"\n".
'endobj';
 
12481                $this->OutlineRoot = $this->
_newobj();
 
12482                $this->
_out(
'<< /Type /Outlines /First '.
$n.
' 0 R /Last '.(
$n + $lru[0]).
' 0 R >>'.
"\n".
'endobj');
 
12495                $this->javascript .= $script;
 
12508                if ($this->pdfa_mode) {
 
12513                $this->js_objects[
$this->n] = array(
'n' => $this->n, 
'js' => $script, 
'onload' => $onload);
 
12524                if ($this->pdfa_mode OR (empty($this->javascript) AND empty($this->js_objects))) {
 
12527                if (strpos($this->javascript, 
'this.addField') > 0) {
 
12528                        if (!$this->ur[
'enabled']) {
 
12533                        $jsa = sprintf(
"ftcpdfdocsaved=this.addField('%s','%s',%d,[%F,%F,%F,%F]);", 
'tcpdfdocsaved', 
'text', 0, 0, 1, 0, 1);
 
12534                        $jsb = 
"getField('tcpdfdocsaved').value='saved';";
 
12535                        $this->javascript = $jsa.
"\n".$this->javascript.
"\n".$jsb;
 
12538                $this->n_js = 
'<< /Names [';
 
12539                if (!empty($this->javascript)) {
 
12540                        $this->n_js .= 
' (EmbeddedJS) '.($this->n + 1).
' 0 R';
 
12542                if (!empty($this->js_objects)) {
 
12543                        foreach ($this->js_objects as $key => $val) {
 
12544                                if ($val[
'onload']) {
 
12545                                        $this->n_js .= 
' (JS'.$key.
') '.$key.
' 0 R';
 
12549                $this->n_js .= 
' ] >>';
 
12551                if (!empty($this->javascript)) {
 
12553                        $out = 
'<< /S /JavaScript';
 
12554                        $out .= 
' /JS '.$this->_textstring($this->javascript, $obj_id);
 
12556                        $out .= 
"\n".
'endobj';
 
12560                if (!empty($this->js_objects)) {
 
12561                        foreach ($this->js_objects as $key => $val) {
 
12562                                $out = $this->
_getobj($key).
"\n".
' << /S /JavaScript /JS '.$this->_textstring($val[
'js'], $key).
' >>'.
"\n".
'endobj';
 
12586                $this->javascript .= 
"if (getField('tcpdfdocsaved').value != 'saved') {";
 
12588                $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";
 
12589                $this->javascript .= 
'f'.$name.
'.textSize='.$this->FontSizePt.
";\n";
 
12590                while (list($key, $val) = each($prop)) {
 
12591                        if (strcmp(substr($key, -5), 
'Color') == 0) {
 
12594                                $val = 
"'".$val.
"'";
 
12596                        $this->javascript .= 
'f'.$name.
'.'.$key.
'='.$val.
";\n";
 
12603                $this->javascript .= 
'}';
 
12618                $this->default_form_prop = $prop;
 
12664                $this->annotation_fonts[$this->CurrentFont[
'fontkey']] = $this->CurrentFont[
'i'];
 
12665                $fontstyle = sprintf(
'/F%d %F Tf %s', $this->CurrentFont[
'i'], $this->FontSizePt, $this->TextColor);
 
12666                $popt[
'da'] = $fontstyle;
 
12668                $popt[
'ap'] = array();
 
12669                $popt[
'ap'][
'n'] = 
'/Tx BMC q '.$fontstyle.
' ';
 
12671                if (isset($prop[
'value']) AND !empty($prop[
'value'])) {
 
12672                        $text = $prop[
'value'];
 
12673                } elseif (isset($opt[
'v']) AND !empty($opt[
'v'])) {
 
12678                if (isset($popt[
'q'])) {
 
12679                        switch ($popt[
'q']) {
 
12698                $this->
MultiCell(
$w, 
$h, 
$text, 0, $align, 
false, 0, 0, 0, 
true, 0, 
false, 
true, 0, 
'T', 
false);
 
12701                $popt[
'ap'][
'n'] .= $this->xobjects[$tmpid][
'outdata'];
 
12702                unset($this->xobjects[$tmpid]);
 
12703                $popt[
'ap'][
'n'] .= 
'Q EMC';
 
12705                $opt = array_merge($popt, $opt);
 
12709                $opt[
'Subtype'] = 
'Widget';
 
12724                unset($opt[
'mk'][
'ca']);
 
12725                unset($opt[
'mk'][
'rc']);
 
12726                unset($opt[
'mk'][
'ac']);
 
12727                unset($opt[
'mk'][
'i']);
 
12728                unset($opt[
'mk'][
'ri']);
 
12729                unset($opt[
'mk'][
'ix']);
 
12730                unset($opt[
'mk'][
'if']);
 
12735                unset($opt[
'mk'][
'tp']);
 
12767        public function RadioButton($name, 
$w, $prop=array(), $opt=array(), $onvalue=
'On', $checked=
false, 
$x=
'', 
$y=
'', 
$js=
false) {
 
12784                        $defval = $onvalue;
 
12789                $font = 
'zapfdingbats';
 
12790                if ($this->pdfa_mode) {
 
12792                        $font = 
'pdfa'.$font;
 
12797                if (!isset($this->radiobutton_groups[$this->page])) {
 
12798                        $this->radiobutton_groups[
$this->page] = array();
 
12800                if (!isset($this->radiobutton_groups[$this->page][$name])) {
 
12801                        $this->radiobutton_groups[
$this->page][$name] = array();
 
12806                $kid = ($this->n + 1);
 
12808                $this->radiobutton_groups[
$this->page][$name][] = array(
'kid' => $kid, 
'def' => $defval);
 
12811                $prop[
'NoToggleToOff'] = 
'true';
 
12812                $prop[
'Radio'] = 
'true';
 
12813                $prop[
'borderStyle'] = 
'inset';
 
12817                $this->annotation_fonts[$tmpfont[
'fontkey']] = $tmpfont[
'i'];
 
12818                $fontstyle = sprintf(
'/F%d %F Tf %s', $tmpfont[
'i'], $this->FontSizePt, $this->TextColor);
 
12819                $popt[
'da'] = $fontstyle;
 
12821                $popt[
'ap'] = array();
 
12822                $popt[
'ap'][
'n'] = array();
 
12824                $fy = ((
$w - ((($tmpfont[
'desc'][
'Ascent'] - $tmpfont[
'desc'][
'Descent']) * $this->FontSizePt / 1000) / 
$this->k)) * 
$this->k);
 
12825                $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, $fx, $fy);
 
12826                $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, $fx, $fy);
 
12827                if (!isset($popt[
'mk'])) {
 
12828                        $popt[
'mk'] = array();
 
12830                $popt[
'mk'][
'ca'] = 
'(l)';
 
12832                $opt = array_merge($popt, $opt);
 
12834                $opt[
'Subtype'] = 
'Widget';
 
12835                $opt[
'ft'] = 
'Btn';
 
12837                        $opt[
'v'] = array(
'/'.$onvalue);
 
12838                        $opt[
'as'] = $onvalue;
 
12840                        $opt[
'as'] = 
'Off';
 
12843                if (!isset($this->radiobutton_groups[$this->page][$name][
'#readonly#'])) {
 
12844                        $this->radiobutton_groups[
$this->page][$name][
'#readonly#'] = 
false;
 
12846                $this->radiobutton_groups[
$this->page][$name][
'#readonly#'] |= ($opt[
'f'] & 64);
 
12882                        foreach ($values as $value) {
 
12883                                if (is_array($value)) {
 
12884                                        $s .= 
',[\''.addslashes($value[1]).
'\',\
''.addslashes($value[0]).
'\']
'; 
12886                                        $s .= ',[\
''.addslashes($value).
'\',\
''.addslashes($value).
'\']
'; 
12889                        $this->javascript .= 'f
'.$name.'.setItems(
'.substr($s, 1).');
'."\n"; 
12892                // get default style 
12893                $prop = array_merge($this->getFormDefaultProp(), $prop); 
12894                // get annotation data 
12895                $popt = TCPDF_STATIC::getAnnotOptFromJSProp($prop, $this->spot_colors, $this->rtl); 
12896                // set additional default values 
12897                $this->annotation_fonts[$this->CurrentFont['fontkey
']] = $this->CurrentFont['i
']; 
12898                $fontstyle = sprintf('/F%d %F Tf %s
', $this->CurrentFont['i
'], $this->FontSizePt, $this->TextColor); 
12899                $popt['da
'] = $fontstyle; 
12900                // build appearance stream 
12901                $popt['ap
'] = array(); 
12902                $popt['ap
']['n
'] = '/Tx BMC q 
'.$fontstyle.' '; 
12904                foreach($values as $item) { 
12905                        if (is_array($item)) { 
12906                                $text .= $item[1]."\n"; 
12908                                $text .= $item."\n"; 
12911                $tmpid = $this->startTemplate($w, $h, false); 
12912                $this->MultiCell($w, $h, $text, 0, '', false, 0, 0, 0, true, 0, false, true, 0, 'T
', false); 
12913                $this->endTemplate(); 
12915                $popt['ap
']['n
'] .= $this->xobjects[$tmpid]['outdata
']; 
12916                unset($this->xobjects[$tmpid]); 
12917                $popt['ap
']['n
'] .= 'Q EMC
'; 
12919                $opt = array_merge($popt, $opt); 
12920                // set remaining annotation data 
12921                $opt['Subtype
'] = 'Widget
'; 
12924                $opt['opt
'] = $values; 
12925                unset($opt['mk
']['ca
']); 
12926                unset($opt['mk
']['rc
']); 
12927                unset($opt['mk
']['ac
']); 
12928                unset($opt['mk
']['i
']); 
12929                unset($opt['mk
']['ri
']); 
12930                unset($opt['mk
']['ix
']); 
12931                unset($opt['mk
']['if']); 
12932                unset($opt['mk
']['tp
']); 
12933                $this->Annotation($x, $y, $w, $h, $name, $opt, 0); 
12956        public function ComboBox($name, $w, $h, $values, $prop=array(), $opt=array(), $x='', $y='', $js=false) { 
12963                // check page for no-write regions and adapt page margins if necessary 
12964                list($x, $y) = $this->checkPageRegions($h, $x, $y); 
12966                        $this->_addfield('combobox
', $name, $x, $y, $w, $h, $prop); 
12968                        foreach ($values as $value) { 
12969                                if (is_array($value)) { 
12970                                        $s .= ',[\
''.addslashes($value[1]).
'\',\
''.addslashes($value[0]).
'\']
'; 
12972                                        $s .= ',[\
''.addslashes($value).
'\',\
''.addslashes($value).
'\']
'; 
12975                        $this->javascript .= 'f
'.$name.'.setItems(
'.substr($s, 1).');
'."\n"; 
12978                // get default style 
12979                $prop = array_merge($this->getFormDefaultProp(), $prop); 
12980                $prop['Combo
'] = true; 
12981                // get annotation data 
12982                $popt = TCPDF_STATIC::getAnnotOptFromJSProp($prop, $this->spot_colors, $this->rtl); 
12983                // set additional default options 
12984                $this->annotation_fonts[$this->CurrentFont['fontkey
']] = $this->CurrentFont['i
']; 
12985                $fontstyle = sprintf('/F%d %F Tf %s
', $this->CurrentFont['i
'], $this->FontSizePt, $this->TextColor); 
12986                $popt['da
'] = $fontstyle; 
12987                // build appearance stream 
12988                $popt['ap
'] = array(); 
12989                $popt['ap
']['n
'] = '/Tx BMC q 
'.$fontstyle.' '; 
12991                foreach($values as $item) { 
12992                        if (is_array($item)) { 
12993                                $text .= $item[1]."\n"; 
12995                                $text .= $item."\n"; 
12998                $tmpid = $this->startTemplate($w, $h, false); 
12999                $this->MultiCell($w, $h, $text, 0, '', false, 0, 0, 0, true, 0, false, true, 0, 'T
', false); 
13000                $this->endTemplate(); 
13002                $popt['ap
']['n
'] .= $this->xobjects[$tmpid]['outdata
']; 
13003                unset($this->xobjects[$tmpid]); 
13004                $popt['ap
']['n
'] .= 'Q EMC
'; 
13006                $opt = array_merge($popt, $opt); 
13007                // set remaining annotation data 
13008                $opt['Subtype
'] = 'Widget
'; 
13011                $opt['opt
'] = $values; 
13012                unset($opt['mk
']['ca
']); 
13013                unset($opt['mk
']['rc
']); 
13014                unset($opt['mk
']['ac
']); 
13015                unset($opt['mk
']['i
']); 
13016                unset($opt['mk
']['ri
']); 
13017                unset($opt['mk
']['ix
']); 
13018                unset($opt['mk
']['if']); 
13019                unset($opt['mk
']['tp
']); 
13020                $this->Annotation($x, $y, $w, $h, $name, $opt, 0); 
13043        public function CheckBox($name, $w, $checked=false, $prop=array(), $opt=array(), $onvalue='Yes
', $x='', $y='', $js=false) { 
13050                // check page for no-write regions and adapt page margins if necessary 
13051                list($x, $y) = $this->checkPageRegions($w, $x, $y); 
13053                        $this->_addfield('checkbox
', $name, $x, $y, $w, $w, $prop); 
13056                if (!isset($prop['value
'])) { 
13057                        $prop['value
'] = array('Yes
'); 
13059                // get default style 
13060                $prop = array_merge($this->getFormDefaultProp(), $prop); 
13061                $prop['borderStyle
'] = 'inset
'; 
13062                // get annotation data 
13063                $popt = TCPDF_STATIC::getAnnotOptFromJSProp($prop, $this->spot_colors, $this->rtl); 
13064                // set additional default options 
13065                $font = 'zapfdingbats
'; 
13066                if ($this->pdfa_mode) { 
13067                        // all fonts must be embedded 
13068                        $font = 'pdfa
'.$font; 
13070                $this->AddFont($font); 
13071                $tmpfont = $this->getFontBuffer($font); 
13072                $this->annotation_fonts[$tmpfont['fontkey
']] = $tmpfont['i
']; 
13073                $fontstyle = sprintf('/F%d %F Tf %s
', $tmpfont['i
'], $this->FontSizePt, $this->TextColor); 
13074                $popt['da
'] = $fontstyle; 
13075                // build appearance stream 
13076                $popt['ap
'] = array(); 
13077                $popt['ap
']['n
'] = array(); 
13078                $fx = ((($w - $this->getAbsFontMeasure($tmpfont['cw
'][110])) / 2) * $this->k); 
13079                $fy = (($w - ((($tmpfont['desc
']['Ascent
'] - $tmpfont['desc
']['Descent
']) * $this->FontSizePt / 1000) / $this->k)) * $this->k); 
13080                $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, $fx, $fy);
 
13081                $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, $fx, $fy);
 
13083                $opt = array_merge($popt, $opt);
 
13085                $opt['Subtype'] = 'Widget';
 
13086                $opt['ft'] = 'Btn';
 
13091                $opt[
'opt'] = array($onvalue);
 
13093                        $opt[
'v'] = array(
'/Yes');
 
13094                        $opt[
'as'] = 
'Yes';
 
13096                        $opt[
'v'] = array(
'/Off');
 
13097                        $opt[
'as'] = 
'Off';
 
13123        public function Button($name, 
$w, 
$h, $caption, $action, $prop=array(), $opt=array(), 
$x=
'', 
$y=
'', 
$js=
false) {
 
13133                        $this->
_addfield(
'button', $name, $this->x, $this->y, 
$w, 
$h, $prop);
 
13134                        $this->javascript .= 
'f'.$name.
".buttonSetCaption('".addslashes($caption).
"');\n";
 
13135                        $this->javascript .= 
'f'.$name.
".setAction('MouseUp','".addslashes($action).
"');\n";
 
13136                        $this->javascript .= 
'f'.$name.
".highlight='push';\n";
 
13137                        $this->javascript .= 
'f'.$name.
".print=false;\n";
 
13142                $prop[
'Pushbutton'] = 
'true';
 
13143                $prop[
'highlight'] = 
'push';
 
13144                $prop[
'display'] = 
'display.noPrint';
 
13147                $this->annotation_fonts[$this->CurrentFont[
'fontkey']] = $this->CurrentFont[
'i'];
 
13148                $fontstyle = sprintf(
'/F%d %F Tf %s', $this->CurrentFont[
'i'], $this->FontSizePt, $this->TextColor);
 
13149                $popt[
'da'] = $fontstyle;
 
13151                $popt[
'ap'] = array();
 
13152                $popt[
'ap'][
'n'] = 
'/Tx BMC q '.$fontstyle.
' ';
 
13156                        'L' => array(
'width' => $bw, 
'cap' => 
'square', 
'join' => 
'miter', 
'dash' => 0, 
'color' => array(231)),
 
13157                        'R' => array(
'width' => $bw, 
'cap' => 
'square', 
'join' => 
'miter', 
'dash' => 0, 
'color' => array(51)),
 
13158                        'T' => array(
'width' => $bw, 
'cap' => 
'square', 
'join' => 
'miter', 
'dash' => 0, 
'color' => array(231)),
 
13159                        'B' => array(
'width' => $bw, 
'cap' => 
'square', 
'join' => 
'miter', 
'dash' => 0, 
'color' => array(51)));
 
13161                $this->
Cell(
$w, 
$h, $caption, 
$border, 0, 
'C', 
true, 
'', 1, 
false, 
'T', 
'M');
 
13164                $popt[
'ap'][
'n'] .= $this->xobjects[$tmpid][
'outdata'];
 
13165                unset($this->xobjects[$tmpid]);
 
13166                $popt[
'ap'][
'n'] .= 
'Q EMC';
 
13168                if (!isset($popt[
'mk'])) {
 
13169                        $popt[
'mk'] = array();
 
13171                $ann_obj_id = ($this->n + 1);
 
13172                if (!empty($action) AND !is_array($action)) {
 
13173                        $ann_obj_id = ($this->n + 2);
 
13175                $popt[
'mk'][
'ca'] = $this->
_textstring($caption, $ann_obj_id);
 
13176                $popt[
'mk'][
'rc'] = $this->
_textstring($caption, $ann_obj_id);
 
13177                $popt[
'mk'][
'ac'] = $this->
_textstring($caption, $ann_obj_id);
 
13179                $opt = array_merge($popt, $opt);
 
13181                $opt[
'Subtype'] = 
'Widget';
 
13182                $opt[
'ft'] = 
'Btn';
 
13183                $opt[
't'] = $caption;
 
13185                if (!empty($action)) {
 
13186                        if (is_array($action)) {
 
13188                                $opt[
'aa'] = 
'/D <<';
 
13189                                $bmode = array(
'SubmitForm', 
'ResetForm', 
'ImportData');
 
13190                                foreach ($action AS $key => $val) {
 
13191                                        if (($key == 
'S') AND in_array($val, $bmode)) {
 
13192                                                $opt[
'aa'] .= 
' /S /'.$val;
 
13193                                        } elseif (($key == 
'F') AND (!empty($val))) {
 
13194                                                $opt[
'aa'] .= 
' /F '.$this->_datastring($val, $ann_obj_id);
 
13195                                        } elseif (($key == 
'Fields') AND is_array($val) AND !empty($val)) {
 
13196                                                $opt[
'aa'] .= 
' /Fields [';
 
13197                                                foreach ($val AS $field) {
 
13198                                                        $opt[
'aa'] .= 
' '.$this->_textstring($field, $ann_obj_id);
 
13201                                        } elseif (($key == 
'Flags')) {
 
13203                                                if (is_array($val)) {
 
13204                                                        foreach ($val AS $flag) {
 
13206                                                                        case 'Include/Exclude': {
 
13210                                                                        case 'IncludeNoValueFields': {
 
13214                                                                        case 'ExportFormat': {
 
13218                                                                        case 'GetMethod': {
 
13222                                                                        case 'SubmitCoordinates': {
 
13230                                                                        case 'IncludeAppendSaves': {
 
13234                                                                        case 'IncludeAnnotations': {
 
13238                                                                        case 'SubmitPDF': {
 
13242                                                                        case 'CanonicalFormat': {
 
13246                                                                        case 'ExclNonUserAnnots': {
 
13254                                                                        case 'EmbedForm': {
 
13261                                                        $ff = intval($val);
 
13263                                                $opt[
'aa'] .= 
' /Flags '.$ff;
 
13266                                $opt[
'aa'] .= 
' >>';
 
13270                                $opt[
'aa'] = 
'/D '.$js_obj_id.
' 0 R';
 
13291                if ((!$this->sign) OR (!isset($this->signature_data[
'cert_type']))) {
 
13294                $sigobjid = ($this->sig_obj_id + 1);
 
13296                $out .= 
'<< /Type /Sig';
 
13297                $out .= 
' /Filter /Adobe.PPKLite';
 
13298                $out .= 
' /SubFilter /adbe.pkcs7.detached';
 
13299                $out .= 
' '.TCPDF_STATIC::$byterange_string;
 
13300                $out .= 
' /Contents<'.str_repeat(
'0', $this->signature_max_length).
'>';
 
13301                if (empty($this->signature_data[
'approval']) OR ($this->signature_data[
'approval'] != 
'A')) {
 
13302                        $out .= 
' /Reference ['; 
 
13303                        $out .= 
' << /Type /SigRef';
 
13304                        if ($this->signature_data[
'cert_type'] > 0) {
 
13305                                $out .= 
' /TransformMethod /DocMDP';
 
13306                                $out .= 
' /TransformParams <<';
 
13307                                $out .= 
' /Type /TransformParams';
 
13308                                $out .= 
' /P '.$this->signature_data[
'cert_type'];
 
13309                                $out .= 
' /V /1.2';
 
13311                                $out .= 
' /TransformMethod /UR3';
 
13312                                $out .= 
' /TransformParams <<';
 
13313                                $out .= 
' /Type /TransformParams';
 
13314                                $out .= 
' /V /2.2';
 
13316                                        $out .= 
' /Document['.$this->ur[
'document'].
']';
 
13319                                        $out .= 
' /Form['.$this->ur[
'form'].
']';
 
13322                                        $out .= 
' /Signature['.$this->ur[
'signature'].
']';
 
13325                                        $out .= 
' /Annots['.$this->ur[
'annots'].
']';
 
13328                                        $out .= 
' /EF['.$this->ur[
'ef'].
']';
 
13331                                        $out .= 
' /FormEX['.$this->ur[
'formex'].
']';
 
13344                        $out .= 
' /Name '.$this->_textstring($this->signature_data[
'info'][
'Name'], $sigobjid);
 
13346                if (isset($this->signature_data[
'info'][
'Location']) AND !
TCPDF_STATIC::empty_string($this->signature_data[
'info'][
'Location'])) {
 
13347                        $out .= 
' /Location '.$this->_textstring($this->signature_data[
'info'][
'Location'], $sigobjid);
 
13349                if (isset($this->signature_data[
'info'][
'Reason']) AND !
TCPDF_STATIC::empty_string($this->signature_data[
'info'][
'Reason'])) {
 
13350                        $out .= 
' /Reason '.$this->_textstring($this->signature_data[
'info'][
'Reason'], $sigobjid);
 
13352                if (isset($this->signature_data[
'info'][
'ContactInfo']) AND !
TCPDF_STATIC::empty_string($this->signature_data[
'info'][
'ContactInfo'])) {
 
13353                        $out .= 
' /ContactInfo '.$this->_textstring($this->signature_data[
'info'][
'ContactInfo'], $sigobjid);
 
13355                $out .= 
' /M '.$this->_datestring($sigobjid, $this->doc_modification_timestamp);
 
13357                $out .= 
"\n".
'endobj';
 
13380                        $document=
'/FullSave',
 
13381                        $annots=
'/Create/Delete/Modify/Copy/Import/Export',
 
13382                        $form=
'/Add/Delete/FillIn/Import/Export/SubmitStandalone/SpawnTemplate',
 
13383                        $signature=
'/Modify',
 
13384                        $ef=
'/Create/Delete/Modify/Import',
 
13386                $this->ur[
'enabled'] = $enable;
 
13387                $this->ur[
'document'] = $document;
 
13388                $this->ur[
'annots'] = $annots;
 
13389                $this->ur[
'form'] = $form;
 
13390                $this->ur[
'signature'] = $signature;
 
13391                $this->ur[
'ef'] = $ef;
 
13392                $this->ur[
'formex'] = $formex;
 
13393                if (!$this->sign) {
 
13415        public function setSignature($signing_cert=
'', $private_key=
'', $private_key_password=
'', $extracerts=
'', $cert_type=2, 
$info=array(), $approval=
'') {
 
13420                $this->sign = 
true;
 
13424                $this->signature_data = array();
 
13425                if (strlen($signing_cert) == 0) {
 
13426                        $this->
Error(
'Please provide a certificate file and password!');
 
13428                if (strlen($private_key) == 0) {
 
13429                        $private_key = $signing_cert;
 
13431                $this->signature_data[
'signcert'] = $signing_cert;
 
13432                $this->signature_data[
'privkey'] = $private_key;
 
13433                $this->signature_data[
'password'] = $private_key_password;
 
13434                $this->signature_data[
'extracerts'] = $extracerts;
 
13435                $this->signature_data[
'cert_type'] = $cert_type;
 
13436                $this->signature_data[
'info'] = 
$info;
 
13437                $this->signature_data[
'approval'] = $approval;
 
13488                if ((
$page < 1) OR (
$page > $this->numpages)) {
 
13491                        $sigapp[
'page'] = intval(
$page);
 
13493                if (empty($name)) {
 
13494                        $sigapp[
'name'] = 
'Signature';
 
13496                        $sigapp[
'name'] = $name;
 
13499                $b = $this->pagedim[($sigapp[
'page'])][
'h'] - ((
$y + 
$h) * 
$this->k);
 
13502                $sigapp[
'rect'] = sprintf(
'%F %F %F %F', $a, $b, ($a + $c), ($b + 
$d));
 
13518        public function setTimeStamp($tsa_host=
'', $tsa_username=
'', $tsa_password=
'', $tsa_cert=
'') {
 
13519                $this->tsa_data = array();
 
13520                if (!function_exists(
'curl_init')) {
 
13521                        $this->
Error(
'Please enable cURL PHP extension!');
 
13523                if (strlen($tsa_host) == 0) {
 
13524                        $this->
Error(
'Please specify the host of Time Stamping Authority (TSA)!');
 
13526                $this->tsa_data[
'tsa_host'] = $tsa_host;
 
13527                if (is_file($tsa_username)) {
 
13528                        $this->tsa_data[
'tsa_auth'] = $tsa_username;
 
13530                        $this->tsa_data[
'tsa_username'] = $tsa_username;
 
13532                $this->tsa_data[
'tsa_password'] = $tsa_password;
 
13533                $this->tsa_data[
'tsa_cert'] = $tsa_cert;
 
13534                $this->tsa_timestamp = 
true;
 
13547                if (!$this->tsa_timestamp) {
 
13562                if (empty(
$page)) {
 
13563                        $page = $this->page + 1;
 
13575                $this->starting_page_number = max(0, intval($num));
 
13588                $rep = str_repeat(
' ', $this->
GetNumChars($ref));
 
13595                $sdiff = sprintf(
'%F', $wdiff);
 
13598                        $alias = 
'{'.$alias;
 
13613                        return '{'.TCPDF_STATIC::$alias_tot_pages.
'}';
 
13628                        return '{'.TCPDF_STATIC::$alias_num_page.
'}';
 
13643                        return '{'.TCPDF_STATIC::$alias_group_tot_pages.
'}';
 
13658                        return '{'.TCPDF_STATIC::$alias_group_num_page.
'}';
 
13699                if (empty($this->pdflayers)) {
 
13702                foreach ($this->pdflayers as $key => $layer) {
 
13703                         $this->pdflayers[$key][
'objid'] = $this->
_newobj();
 
13704                         $out = 
'<< /Type /OCG';
 
13705                         $out .= 
' /Name '.$this->_textstring($layer[
'name'], $this->pdflayers[$key][
'objid']);
 
13706                         $out .= 
' /Usage <<';
 
13707                         if (isset($layer[
'print']) AND ($layer[
'print'] !== NULL)) {
 
13708                                $out .= 
' /Print <</PrintState /'.($layer[
'print']?
'ON':
'OFF').
'>>';
 
13710                         $out .= 
' /View <</ViewState /'.($layer[
'view']?
'ON':
'OFF').
'>>';
 
13712                         $out .= 
"\n".
'endobj';
 
13726        public function startLayer($name=
'', $print=
true, $view=
true, $lock=
true) {
 
13727                if ($this->state != 2) {
 
13730                $layer = sprintf(
'LYR%03d', (count($this->pdflayers) + 1));
 
13731                if (empty($name)) {
 
13734                        $name = preg_replace(
'/[^a-zA-Z0-9_\-]/', 
'', $name);
 
13736                $this->pdflayers[] = array(
'layer' => $layer, 
'name' => $name, 
'print' => $print, 
'view' => $view, 
'lock' => $lock);
 
13737                $this->openMarkedContent = 
true;
 
13738                $this->
_out(
'/OC /'.$layer.
' BDC');
 
13747                if ($this->state != 2) {
 
13750                if ($this->openMarkedContent) {
 
13752                        $this->
_out(
'EMC');
 
13753                        $this->openMarkedContent = 
false;
 
13766                if ($this->state != 2) {
 
13785                                $this->
Error(
'Incorrect visibility: '.$v);
 
13799                if ($this->pdfa_mode) {
 
13804                foreach ($this->extgstates as $i => $ext) {
 
13805                        if ($ext[
'parms'] == $parms) {
 
13806                                if ($this->inxobj) {
 
13814                $n = (count($this->extgstates) + 1);
 
13815                $this->extgstates[
$n] = array(
'parms' => $parms);
 
13816                if ($this->inxobj) {
 
13830                if ($this->pdfa_mode OR ($this->state != 2)) {
 
13834                $this->
_out(sprintf(
'/GS%d gs', $gs));
 
13843                foreach ($this->extgstates as $i => $ext) {
 
13844                        $this->extgstates[$i][
'n'] = $this->
_newobj();
 
13845                        $out = 
'<< /Type /ExtGState';
 
13846                        foreach ($ext[
'parms'] as 
$k => $v) {
 
13847                                if (is_float($v)) {
 
13848                                        $v = sprintf(
'%F', $v);
 
13849                                } elseif ($v === 
true) {
 
13851                                } elseif ($v === 
false) {
 
13854                                $out .= 
' /'.$k.
' '.$v;
 
13857                        $out .= 
"\n".
'endobj';
 
13872                if ($this->state != 2) {
 
13875                $stroking = $stroking ? true : 
false;
 
13878                        $nonstroking = $stroking;
 
13880                        $nonstroking = $nonstroking ? true : 
false;
 
13882                if (($mode != 0) AND ($mode != 1)) {
 
13885                $this->overprint = array(
'OP' => $stroking, 
'op' => $nonstroking, 
'OPM' => $mode);
 
13910        public function setAlpha($stroking=1, $bm=
'Normal', $nonstroking=
'', $ais=
false) {
 
13911                if ($this->pdfa_mode) {
 
13915                $stroking = floatval($stroking);
 
13918                        $nonstroking = $stroking;
 
13920                        $nonstroking = floatval($nonstroking);
 
13922                if ($bm[0] == 
'/') {
 
13924                        $bm = substr($bm, 1);
 
13926                if (!in_array($bm, array(
'Normal', 
'Multiply', 
'Screen', 
'Overlay', 
'Darken', 
'Lighten', 
'ColorDodge', 
'ColorBurn', 
'HardLight', 
'SoftLight', 
'Difference', 
'Exclusion', 
'Hue', 
'Saturation', 
'Color', 
'Luminosity'))) {
 
13929                $ais = $ais ? true : 
false;
 
13930                $this->alpha = array(
'CA' => $stroking, 
'ca' => $nonstroking, 
'BM' => 
'/'.$bm, 
'AIS' => $ais);
 
13953                if (($quality < 1) OR ($quality > 100)) {
 
13956                $this->jpeg_quality = intval($quality);
 
13966                $this->default_table_columns = intval($cols);
 
13976                $this->cell_height_ratio = 
$h;
 
13995                if ($this->pdfa_mode) {
 
13997                        $this->PDFVersion = 
'1.4';
 
13999                        $this->PDFVersion = $version;
 
14029        public function colorRegistrationBar(
$x, 
$y, 
$w, 
$h, $transition=
true, $vertical=
false, $colors=
'A,R,G,B,C,M,Y,K') {
 
14030                if (strpos($colors, 
'ALLSPOT') !== 
false) {
 
14033                        foreach ($this->spot_colors as $spot_color_name => $v) {
 
14038                                $colors = str_replace(
'ALLSPOT', 
$spot_colors, $colors);
 
14040                                $colors = str_replace(
'ALLSPOT', 
'NONE', $colors);
 
14043                $bars = explode(
',', $colors);
 
14044                $numbars = count($bars); 
 
14045                if ($numbars <= 0) {
 
14051                        $wb = 
$w / $numbars; 
 
14058                        $hb = 
$h / $numbars; 
 
14064                foreach ($bars as $col) {
 
14068                                        $col_a = array(255);
 
14074                                        $col_b = array(255);
 
14078                                        $col_a = array(255,255,255);
 
14079                                        $col_b = array(255,0,0);
 
14083                                        $col_a = array(255,255,255);
 
14084                                        $col_b = array(0,255,0);
 
14088                                        $col_a = array(255,255,255);
 
14089                                        $col_b = array(0,0,255);
 
14093                                        $col_a = array(0,0,0,0);
 
14094                                        $col_b = array(100,0,0,0);
 
14098                                        $col_a = array(0,0,0,0);
 
14099                                        $col_b = array(0,100,0,0);
 
14103                                        $col_a = array(0,0,0,0);
 
14104                                        $col_b = array(0,0,100,0);
 
14108                                        $col_a = array(0,0,0,0);
 
14109                                        $col_b = array(0,0,0,100);
 
14113                                        $col_a = array(255,255,255);
 
14114                                        $col_b = array(0,0,0);
 
14118                                        $col_a = array(0,0,0,0);
 
14119                                        $col_b = array(100,100,100,100);
 
14123                                        $col_a = array(0,0,0,0,
'None');
 
14124                                        $col_b = array(100,100,100,100,
'All');
 
14128                                        $col_a = array(0,0,0,0,
'None');
 
14129                                        $col_b = array(0,0,0,0,
'None');
 
14133                                        $col_a = array(0,0,0,0,
'None');
 
14135                                        if ($col_b === 
false) {
 
14137                                                $col_b = array(100,100,100,100,
'All');
 
14142                        if ($col != 
'NONE') {
 
14149                                        $this->
Rect($xb, $yb, $wb, $hb, 
'F', array());
 
14169        public function cropMark(
$x, 
$y, 
$w, 
$h, $type=
'T,R,B,L', $color=array(100,100,100,100,
'All')) {
 
14170                $this->
SetLineStyle(array(
'width' => (0.5 / $this->k), 
'cap' => 
'butt', 
'join' => 
'miter', 
'dash' => 0, 
'color' => $color));
 
14171                $type = strtoupper($type);
 
14172                $type = preg_replace(
'/[^A-Z\-\,]*/', 
'', $type);
 
14174                $type = str_replace(
'-', 
',', $type);
 
14175                $type = str_replace(
'TL', 
'T,L', $type);
 
14176                $type = str_replace(
'TR', 
'T,R', $type);
 
14177                $type = str_replace(
'BL', 
'F,L', $type);
 
14178                $type = str_replace(
'BR', 
'F,R', $type);
 
14179                $type = str_replace(
'A', 
'T,L', $type);
 
14180                $type = str_replace(
'B', 
'T,R', $type);
 
14181                $type = str_replace(
'T,RO', 
'BO', $type);
 
14182                $type = str_replace(
'C', 
'F,L', $type);
 
14183                $type = str_replace(
'D', 
'F,R', $type);
 
14184                $crops = explode(
',', strtoupper($type));
 
14186                $crops = array_unique($crops);
 
14189                foreach ($crops as $crop) {
 
14224                        $this->
Line($x1, $y1, $x2, $y2);
 
14240        public function registrationMark(
$x, 
$y, 
$r, $double=
false, $cola=array(100,100,100,100,
'All'), $colb=array(0,0,0,0,
'None')) {
 
14241                $line_style = array(
'width' => max((0.5 / $this->k),(
$r / 30)), 
'cap' => 
'butt', 
'join' => 
'miter', 
'dash' => 0, 
'color' => $cola);
 
14245                $this->
Circle(
$x, 
$y, 
$r, 0, 360, 
'C', $line_style, array(), 8);
 
14254                        $this->
Circle(
$x, 
$y, $ri, 0, 360, 
'C', $line_style, array(), 8);
 
14269                $lw = max((0.5 / $this->k),(
$r / 8));
 
14287                $line_style = array(
'width' => $lw, 
'cap' => 
'butt', 
'join' => 
'miter', 
'dash' => 0, 
'color' => array(100,100,100,100,
'All'));
 
14290                $this->
Circle(
$x, 
$y, 
$r, 0, 360, 
'C', $line_style, array(), 8);
 
14313                $this->
Gradient(2, 
$coords, array(array(
'color' => $col1, 
'offset' => 0, 
'exponent' => 1), array(
'color' => $col2, 
'offset' => 1, 
'exponent' => 1)), array(), 
false);
 
14329        public function RadialGradient(
$x, 
$y, 
$w, 
$h, $col1=array(), $col2=array(), 
$coords=array(0.5,0.5,0.5,0.5,1)) {
 
14331                $this->
Gradient(3, 
$coords, array(array(
'color' => $col1, 
'offset' => 0, 
'exponent' => 1), array(
'color' => $col2, 
'offset' => 1, 
'exponent' => 1)), array(), 
false);
 
14352        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) {
 
14353                if ($this->pdfa_mode OR ($this->state != 2)) {
 
14357                $n = count($this->gradients) + 1;
 
14358                $this->gradients[
$n] = array();
 
14359                $this->gradients[
$n][
'type'] = 6; 
 
14360                $this->gradients[
$n][
'coords'] = array();
 
14361                $this->gradients[
$n][
'antialias'] = $antialias;
 
14362                $this->gradients[
$n][
'colors'] = array();
 
14363                $this->gradients[
$n][
'transparency'] = 
false;
 
14365                if (!isset(
$coords[0][
'f'])) {
 
14367                        if (!isset($col1[1])) {
 
14368                                $col1[1] = $col1[2] = $col1[0];
 
14370                        if (!isset($col2[1])) {
 
14371                                $col2[1] = $col2[2] = $col2[0];
 
14373                        if (!isset($col3[1])) {
 
14374                                $col3[1] = $col3[2] = $col3[0];
 
14376                        if (!isset($col4[1])) {
 
14377                                $col4[1] = $col4[2] = $col4[0];
 
14399                $this->gradients[
$n][
'stream'] = 
'';
 
14401                for ($i=0; $i < $count_patch; ++$i) {
 
14404                        for ($j=0; $j < $count_points; ++$j) {
 
14413                                $this->gradients[
$n][
'stream'] .= chr(floor(
$patch_array[$i][
'points'][$j] / 256));
 
14414                                $this->gradients[
$n][
'stream'] .= chr(floor(
$patch_array[$i][
'points'][$j] % 256));
 
14417                        for ($j=0; $j < $count_cols; ++$j) {
 
14419                                $this->gradients[
$n][
'stream'] .= chr(
$patch_array[$i][
'colors'][$j][
'r']);
 
14420                                $this->gradients[
$n][
'stream'] .= chr(
$patch_array[$i][
'colors'][$j][
'g']);
 
14421                                $this->gradients[
$n][
'stream'] .= chr(
$patch_array[$i][
'colors'][$j][
'b']);
 
14425                $this->
_out(
'/Sh'.
$n.
' sh');
 
14428                if ($this->inxobj) {
 
14445                if ($this->state != 2) {
 
14449                        $x = $this->w - 
$x - 
$w;
 
14454                $s .= sprintf(
' %F %F %F %F re W n', 
$x*$this->k, ($this->h-
$y)*$this->k, 
$w*$this->k, -
$h*$this->k);
 
14456                $s .= sprintf(
' %F 0 0 %F %F %F cm', 
$w*$this->k, 
$h*$this->k, 
$x*$this->k, ($this->h-(
$y+
$h))*$this->k);
 
14472                if ($this->pdfa_mode OR ($this->state != 2)) {
 
14475                $n = count($this->gradients) + 1;
 
14476                $this->gradients[
$n] = array();
 
14477                $this->gradients[
$n][
'type'] = $type;
 
14478                $this->gradients[
$n][
'coords'] = 
$coords;
 
14479                $this->gradients[
$n][
'antialias'] = $antialias;
 
14480                $this->gradients[
$n][
'colors'] = array();
 
14481                $this->gradients[
$n][
'transparency'] = 
false;
 
14483                $numcolspace = count($stops[0][
'color']);
 
14484                $bcolor = array_values($background);
 
14485                switch($numcolspace) {
 
14488                                $this->gradients[
$n][
'colspace'] = 
'DeviceCMYK';
 
14489                                if (!empty($background)) {
 
14490                                        $this->gradients[
$n][
'background'] = sprintf(
'%F %F %F %F', $bcolor[0]/100, $bcolor[1]/100, $bcolor[2]/100, $bcolor[3]/100);
 
14495                                $this->gradients[
$n][
'colspace'] = 
'DeviceRGB';
 
14496                                if (!empty($background)) {
 
14497                                        $this->gradients[
$n][
'background'] = sprintf(
'%F %F %F', $bcolor[0]/255, $bcolor[1]/255, $bcolor[2]/255);
 
14502                                $this->gradients[
$n][
'colspace'] = 
'DeviceGray';
 
14503                                if (!empty($background)) {
 
14504                                        $this->gradients[
$n][
'background'] = sprintf(
'%F', $bcolor[0]/255);
 
14509                $num_stops = count($stops);
 
14510                $last_stop_id = $num_stops - 1;
 
14511                foreach ($stops as $key => $stop) {
 
14512                        $this->gradients[
$n][
'colors'][$key] = array();
 
14514                        if (isset($stop[
'offset'])) {
 
14515                                $this->gradients[
$n][
'colors'][$key][
'offset'] = $stop[
'offset'];
 
14518                                        $this->gradients[
$n][
'colors'][$key][
'offset'] = 0;
 
14519                                } elseif ($key == $last_stop_id) {
 
14520                                        $this->gradients[
$n][
'colors'][$key][
'offset'] = 1;
 
14522                                        $offsetstep = (1 - $this->gradients[
$n][
'colors'][($key - 1)][
'offset']) / ($num_stops - $key);
 
14523                                        $this->gradients[
$n][
'colors'][$key][
'offset'] = $this->gradients[
$n][
'colors'][($key - 1)][
'offset'] + $offsetstep;
 
14526                        if (isset($stop[
'opacity'])) {
 
14527                                $this->gradients[
$n][
'colors'][$key][
'opacity'] = $stop[
'opacity'];
 
14528                                if ((!$this->pdfa_mode) AND ($stop[
'opacity'] < 1)) {
 
14529                                        $this->gradients[
$n][
'transparency'] = 
true;
 
14532                                $this->gradients[
$n][
'colors'][$key][
'opacity'] = 1;
 
14535                        if (isset($stop[
'exponent'])) {
 
14536                                $this->gradients[
$n][
'colors'][$key][
'exponent'] = $stop[
'exponent'];
 
14538                                $this->gradients[
$n][
'colors'][$key][
'exponent'] = 1;
 
14541                        $color = array_values($stop[
'color']);
 
14542                        switch($numcolspace) {
 
14545                                        $this->gradients[
$n][
'colors'][$key][
'color'] = sprintf(
'%F %F %F %F', $color[0]/100, $color[1]/100, $color[2]/100, $color[3]/100);
 
14549                                        $this->gradients[
$n][
'colors'][$key][
'color'] = sprintf(
'%F %F %F', $color[0]/255, $color[1]/255, $color[2]/255);
 
14553                                        $this->gradients[
$n][
'colors'][$key][
'color'] = sprintf(
'%F', $color[0]/255);
 
14558                if ($this->gradients[
$n][
'transparency']) {
 
14560                        $this->
_out(
'/TGS'.$n.
' gs');
 
14563                $this->
_out(
'/Sh'.$n.
' sh');
 
14566                if ($this->inxobj) {
 
14579                if ($this->pdfa_mode) {
 
14582                $idt = count($this->gradients); 
 
14583                foreach ($this->gradients as $id => $grad) {
 
14584                        if (($grad[
'type'] == 2) OR ($grad[
'type'] == 3)) {
 
14587                                $out .= 
' /FunctionType 3';
 
14588                                $out .= 
' /Domain [0 1]';
 
14593                                $num_cols = count($grad[
'colors']);
 
14594                                $lastcols = $num_cols - 1;
 
14595                                for ($i = 1; $i < $num_cols; ++$i) {
 
14596                                        $functions .= ($fc + $i).
' 0 R ';
 
14597                                        if ($i < $lastcols) {
 
14598                                                $bounds .= sprintf(
'%F ', $grad[
'colors'][$i][
'offset']);
 
14602                                $out .= 
' /Functions ['.trim($functions).
']';
 
14603                                $out .= 
' /Bounds ['.trim($bounds).
']';
 
14604                                $out .= 
' /Encode ['.trim($encode).
']';
 
14606                                $out .= 
"\n".
'endobj';
 
14608                                for ($i = 1; $i < $num_cols; ++$i) {
 
14611                                        $out .= 
' /FunctionType 2';
 
14612                                        $out .= 
' /Domain [0 1]';
 
14613                                        $out .= 
' /C0 ['.$grad[
'colors'][($i - 1)][
'color'].
']';
 
14614                                        $out .= 
' /C1 ['.$grad[
'colors'][$i][
'color'].
']';
 
14615                                        $out .= 
' /N '.$grad[
'colors'][$i][
'exponent'];
 
14617                                        $out .= 
"\n".
'endobj';
 
14621                                if ($grad[
'transparency']) {
 
14624                                        $out .= 
' /FunctionType 3';
 
14625                                        $out .= 
' /Domain [0 1]';
 
14628                                        $num_cols = count($grad[
'colors']);
 
14629                                        for ($i = 1; $i < $num_cols; ++$i) {
 
14630                                                $functions .= ($ft + $i).
' 0 R ';
 
14632                                        $out .= 
' /Functions ['.trim($functions).
']';
 
14633                                        $out .= 
' /Bounds ['.trim($bounds).
']';
 
14634                                        $out .= 
' /Encode ['.trim($encode).
']';
 
14636                                        $out .= 
"\n".
'endobj';
 
14638                                        for ($i = 1; $i < $num_cols; ++$i) {
 
14641                                                $out .= 
' /FunctionType 2';
 
14642                                                $out .= 
' /Domain [0 1]';
 
14643                                                $out .= 
' /C0 ['.$grad[
'colors'][($i - 1)][
'opacity'].
']';
 
14644                                                $out .= 
' /C1 ['.$grad[
'colors'][$i][
'opacity'].
']';
 
14645                                                $out .= 
' /N '.$grad[
'colors'][$i][
'exponent'];
 
14647                                                $out .= 
"\n".
'endobj';
 
14654                        $out = 
'<< /ShadingType '.$grad[
'type'];
 
14655                        if (isset($grad[
'colspace'])) {
 
14656                                $out .= 
' /ColorSpace /'.$grad[
'colspace'];
 
14658                                $out .= 
' /ColorSpace /DeviceRGB';
 
14660                        if (isset($grad[
'background']) AND !empty($grad[
'background'])) {
 
14661                                $out .= 
' /Background ['.$grad[
'background'].
']';
 
14663                        if (isset($grad[
'antialias']) AND ($grad[
'antialias'] === 
true)) {
 
14664                                $out .= 
' /AntiAlias true';
 
14666                        if ($grad[
'type'] == 2) {
 
14667                                $out .= 
' '.sprintf(
'/Coords [%F %F %F %F]', $grad[
'coords'][0], $grad[
'coords'][1], $grad[
'coords'][2], $grad[
'coords'][3]);
 
14668                                $out .= 
' /Domain [0 1]';
 
14669                                $out .= 
' /Function '.$fc.
' 0 R';
 
14670                                $out .= 
' /Extend [true true]';
 
14672                        } elseif ($grad[
'type'] == 3) {
 
14675                                $out .= 
' '.sprintf(
'/Coords [%F %F 0 %F %F %F]', $grad[
'coords'][0], $grad[
'coords'][1], $grad[
'coords'][2], $grad[
'coords'][3], $grad[
'coords'][4]);
 
14676                                $out .= 
' /Domain [0 1]';
 
14677                                $out .= 
' /Function '.$fc.
' 0 R';
 
14678                                $out .= 
' /Extend [true true]';
 
14680                        } elseif ($grad[
'type'] == 6) {
 
14681                                $out .= 
' /BitsPerCoordinate 16';
 
14682                                $out .= 
' /BitsPerComponent 8';
 
14683                                $out .= 
' /Decode[0 1 0 1 0 1 0 1 0 1]';
 
14684                                $out .= 
' /BitsPerFlag 8';
 
14686                                $out .= 
' /Length '.strlen($stream);
 
14688                                $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
14690                        $out .= 
"\n".
'endobj';
 
14692                        if ($grad[
'transparency']) {
 
14693                                $shading_transparency = preg_replace(
'/\/ColorSpace \/[^\s]+/si', 
'/ColorSpace /DeviceGray', 
$out);
 
14694                                $shading_transparency = preg_replace(
'/\/Function [0-9]+ /si', 
'/Function '.$ft.
' ', $shading_transparency);
 
14696                        $this->gradients[$id][
'id'] = 
$this->n;
 
14699                        $out = 
'<< /Type /Pattern /PatternType 2';
 
14700                        $out .= 
' /Shading '.$this->gradients[$id][
'id'].
' 0 R';
 
14702                        $out .= 
"\n".
'endobj';
 
14704                        $this->gradients[$id][
'pattern'] = 
$this->n;
 
14706                        if ($grad[
'transparency']) {
 
14708                                $idgs = $id + $idt;
 
14710                                $this->
_out($shading_transparency);
 
14711                                $this->gradients[$idgs][
'id'] = 
$this->n;
 
14713                                $out = 
'<< /Type /Pattern /PatternType 2';
 
14714                                $out .= 
' /Shading '.$this->gradients[$idgs][
'id'].
' 0 R';
 
14716                                $out .= 
"\n".
'endobj';
 
14718                                $this->gradients[$idgs][
'pattern'] = 
$this->n;
 
14721                                $this->xobjects[
'LX'.$oid] = array(
'n' => $oid);
 
14723                                $stream = 
'q /a0 gs /Pattern cs /p'.$idgs.
' scn 0 0 '.$this->wPt.
' '.$this->hPt.
' re f Q';
 
14724                                if ($this->compress) {
 
14725                                        $filter = 
' /Filter /FlateDecode';
 
14726                                        $stream = gzcompress($stream);
 
14729                                $out = 
'<< /Type /XObject /Subtype /Form /FormType 1'.$filter;
 
14730                                $out .= 
' /Length '.strlen($stream);
 
14731                                $rect = sprintf(
'%F %F', $this->wPt, $this->hPt);
 
14732                                $out .= 
' /BBox [0 0 '.$rect.
']';
 
14733                                $out .= 
' /Group << /Type /Group /S /Transparency /CS /DeviceGray >>';
 
14734                                $out .= 
' /Resources <<';
 
14735                                $out .= 
' /ExtGState << /a0 << /ca 1 /CA 1 >> >>';
 
14736                                $out .= 
' /Pattern << /p'.$idgs.
' '.$this->gradients[$idgs][
'pattern'].
' 0 R >>';
 
14739                                $out .= 
' stream'.
"\n".$stream.
"\n".
'endstream';
 
14740                                $out .= 
"\n".
'endobj';
 
14744                                $out = 
'<< /Type /Mask /S /Luminosity /G '.($this->n - 1).
' 0 R >>'.
"\n".
'endobj';
 
14748                                $out = 
'<< /Type /ExtGState /SMask '.($this->n - 1).
' 0 R /AIS false >>'.
"\n".
'endobj';
 
14750                                $this->extgstates[] = array(
'n' => $this->n, 
'name' => 
'TGS'.$id);
 
14792                if ($this->state != 2) {
 
14800                        $line_style = array();
 
14804                        $b = (360 - $a + $o);
 
14805                        $a = (360 - 
$d + $o);
 
14835        public function ImageEps(
$file, 
$x=
'', 
$y=
'', 
$w=0, 
$h=0, $link=
'', $useBoundingBox=
true, $align=
'', $palign=
'', 
$border=0, $fitonpage=
false, $fixoutvals=
false) {
 
14836                if ($this->state != 2) {
 
14839                if ($this->rasterize_vector_images AND (
$w > 0) AND (
$h > 0)) {
 
14841                        return $this->
Image(
$file, 
$x, 
$y, 
$w, 
$h, 
'EPS', $link, $align, 
true, 300, $palign, 
false, 
false, 
$border, 
false, 
false, $fitonpage);
 
14852                if (
$file[0] === 
'@') { 
 
14857                if (
$data === FALSE) {
 
14862                preg_match(
"/%%Creator:([^\r\n]+)/", 
$data, $regs); # find Creator
 
14863                if (count($regs) > 1) {
 
14864                        $version_str = trim($regs[1]); # e.g. 
"Adobe Illustrator(R) 8.0" 
14865                        if (strpos($version_str, 
'Adobe Illustrator') !== 
false) {
 
14866                                $versexp = explode(
' ', $version_str);
 
14867                                $version = (float)array_pop($versexp);
 
14868                                if ($version >= 9) {
 
14869                                        $this->
Error(
'This version of Adobe Illustrator file is not supported: '.
$file);
 
14874                $start = strpos(
$data, 
'%!PS-Adobe');
 
14879                preg_match(
"/%%BoundingBox:([^\r\n]+)/", 
$data, $regs);
 
14880                if (count($regs) > 1) {
 
14881                        list($x1, $y1, $x2, $y2) = explode(
' ', trim($regs[1]));
 
14883                        $this->
Error(
'No BoundingBox found in EPS/AI file: '.
$file);
 
14885                $start = strpos(
$data, 
'%%EndSetup');
 
14886                if ($start === 
false) {
 
14887                        $start = strpos(
$data, 
'%%EndProlog');
 
14889                if ($start === 
false) {
 
14890                        $start = strpos(
$data, 
'%%BoundingBox');
 
14893                $end = strpos(
$data, 
'%%PageTrailer');
 
14894                if ($end===
false) {
 
14895                        $end = strpos(
$data, 
'showpage');
 
14901                if ((
$w <= 0) AND (
$h <= 0)) {
 
14902                        $w = ($x2 - $x1) / 
$k;
 
14903                        $h = ($y2 - $y1) / 
$k;
 
14904                } elseif (
$w <= 0) {
 
14905                        $w = ($x2-$x1) / 
$k * (
$h / (($y2 - $y1) / 
$k));
 
14906                } elseif (
$h <= 0) {
 
14907                        $h = ($y2 - $y1) / 
$k * (
$w / (($x2 - $x1) / 
$k));
 
14911                if ($this->rasterize_vector_images) {
 
14913                        return $this->
Image(
$file, 
$x, 
$y, 
$w, 
$h, 
'EPS', $link, $align, 
true, 300, $palign, 
false, 
false, 
$border, 
false, 
false, $fitonpage);
 
14916                $scale_x = 
$w / (($x2 - $x1) / 
$k);
 
14917                $scale_y = 
$h / (($y2 - $y1) / 
$k);
 
14919                $this->img_rb_y = 
$y + 
$h;
 
14922                        if ($palign == 
'L') {
 
14924                        } elseif ($palign == 
'C') {
 
14925                                $ximg = ($this->w + $this->lMargin - $this->rMargin - 
$w) / 2;
 
14926                        } elseif ($palign == 
'R') {
 
14927                                $ximg = $this->w - $this->rMargin - 
$w;
 
14931                        $this->img_rb_x = $ximg;
 
14933                        if ($palign == 
'L') {
 
14935                        } elseif ($palign == 
'C') {
 
14936                                $ximg = ($this->w + $this->lMargin - $this->rMargin - 
$w) / 2;
 
14937                        } elseif ($palign == 
'R') {
 
14938                                $ximg = $this->w - $this->rMargin - 
$w;
 
14942                        $this->img_rb_x = $ximg + 
$w;
 
14944                if ($useBoundingBox) {
 
14945                        $dx = $ximg * 
$k - $x1;
 
14946                        $dy = 
$y * 
$k - $y1;
 
14952                $this->
_out(
'q'.$this->epsmarker);
 
14954                $this->
_out(sprintf(
'%F %F %F %F %F %F cm', 1, 0, 0, 1, $dx, $dy + ($this->hPt - (2 * 
$y * 
$k) - ($y2 - $y1))));
 
14956                if (isset($scale_x)) {
 
14957                        $this->
_out(sprintf(
'%F %F %F %F %F %F cm', $scale_x, 0, 0, $scale_y, $x1 * (1 - $scale_x), $y2 * (1 - $scale_y)));
 
14960                $lines = preg_split(
'/[\r\n]+/si', 
$data, -1, PREG_SPLIT_NO_EMPTY);
 
14962                $cnt = count($lines);
 
14963                for ($i=0; $i < $cnt; ++$i) {
 
14964                        $line = $lines[$i];
 
14965                        if (($line == 
'') OR ($line[0] == 
'%')) {
 
14968                        $len = strlen($line);
 
14971                        if (strcasecmp(
'x', substr(trim($line), -1)) == 0) {
 
14972                                if (preg_match(
'/\([^\)]*\)/', $line, $matches) > 0) {
 
14974                                        $color_name = $matches[0];
 
14976                                        $line = str_replace(
' '.$color_name, 
'', $line);
 
14978                                        $color_name = substr($color_name, 1, -1);
 
14981                        $chunks = explode(
' ', $line);
 
14982                        $cmd = trim(array_pop($chunks));
 
14984                        if ((
$cmd == 
'Xa') OR (
$cmd == 
'XA')) {
 
14985                                $b = array_pop($chunks);
 
14986                                $g = array_pop($chunks);
 
14987                                $r = array_pop($chunks);
 
14988                                $this->
_out(
''.
$r.
' '.$g.
' '.$b.
' '.(
$cmd==
'Xa'?
'rg':
'RG')); 
 
14999                                                foreach ($chunks as $key => $val) {
 
15000                                                        if ((($key % 2) == 0) AND (($val < $x1) OR ($val > $x2))) {
 
15002                                                        } elseif ((($key % 2) != 0) AND (($val < $y1) OR ($val > $y2))) {
 
15030                                        $this->
_out($line);
 
15034                                        if (empty($color_name)) {
 
15036                                                list($col_c, $col_m, $col_y, $col_k) = $chunks;
 
15037                                                $this->
_out(
''.$col_c.
' '.$col_m.
' '.$col_y.
' '.$col_k.
' k');
 
15040                                                list($col_c, $col_m, $col_y, $col_k, $col_t) = $chunks;
 
15041                                                $this->
AddSpotColor($color_name, ($col_c * 100), ($col_m * 100), ($col_y * 100), ($col_k * 100));
 
15042                                                $color_cmd = sprintf(
'/CS%d cs %F scn', $this->spot_colors[$color_name][
'i'], (1 - $col_t));
 
15043                                                $this->
_out($color_cmd);
 
15048                                        if (empty($color_name)) {
 
15050                                                list($col_c, $col_m, $col_y, $col_k) = $chunks;
 
15051                                                $this->
_out(
''.$col_c.
' '.$col_m.
' '.$col_y.
' '.$col_k.
' K');
 
15054                                                list($col_c, $col_m, $col_y, $col_k, $col_t) = $chunks;
 
15055                                                $this->
AddSpotColor($color_name, ($col_c * 100), ($col_m * 100), ($col_y * 100), ($col_k * 100));
 
15056                                                $color_cmd = sprintf(
'/CS%d CS %F SCN', $this->spot_colors[$color_name][
'i'], (1 - $col_t));
 
15057                                                $this->
_out($color_cmd);
 
15069                                        $line[($len - 1)] = strtolower(
$cmd);
 
15070                                        $this->
_out($line);
 
15082                                                $max = min(($i + 5), $cnt);
 
15083                                                for ($j = ($i + 1); $j < $max; ++$j) {
 
15084                                                        $isU = ($isU OR (($lines[$j] == 
'U') OR ($lines[$j] == 
'*U')));
 
15105                $this->
_out($this->epsmarker.
'Q');
 
15129                                $this->y = 
$y + round(
$h/2);
 
15139                                $this->
SetY($this->img_rb_y);
 
15155                $this->barcode = $bc;
 
15202                require_once(dirname(__FILE__).
'/tcpdf_barcodes_1d.php');
 
15208                if (($arrcode === 
false) OR empty($arrcode) OR ($arrcode[
'maxw'] <= 0)) {
 
15209                        $this->
Error(
'Error in 1D barcode string');
 
15211                if ($arrcode[
'maxh'] <= 0) {
 
15212                        $arrcode[
'maxh'] = 1;
 
15215                if (!isset(
$style[
'position'])) {
 
15216                        $style[
'position'] = 
'';
 
15217                } elseif (
$style[
'position'] == 
'S') {
 
15219                        $style[
'position'] = 
'';
 
15220                        $style[
'stretch'] = 
true;
 
15222                if (!isset(
$style[
'fitwidth'])) {
 
15223                        if (!isset(
$style[
'stretch'])) {
 
15224                                $style[
'fitwidth'] = 
true;
 
15226                                $style[
'fitwidth'] = 
false;
 
15229                if (
$style[
'fitwidth']) {
 
15231                        $style[
'stretch'] = 
false;
 
15233                if (!isset(
$style[
'stretch'])) {
 
15234                        if ((
$w === 
'') OR (
$w <= 0)) {
 
15235                                $style[
'stretch'] = 
false;
 
15237                                $style[
'stretch'] = 
true;
 
15240                if (!isset(
$style[
'fgcolor'])) {
 
15241                        $style[
'fgcolor'] = array(0,0,0); 
 
15243                if (!isset(
$style[
'bgcolor'])) {
 
15244                        $style[
'bgcolor'] = 
false; 
 
15246                if (!isset(
$style[
'border'])) {
 
15247                        $style[
'border'] = 
false;
 
15250                if (!isset(
$style[
'text'])) {
 
15254                        if (isset(
$style[
'fontsize'])) {
 
15255                                $fontsize = 
$style[
'fontsize'];
 
15259                if (!isset(
$style[
'stretchtext'])) {
 
15260                        $style[
'stretchtext'] = 4;
 
15270                if ((
$w === 
'') OR (
$w <= 0)) {
 
15274                                $w = $this->w - $this->rMargin - 
$x;
 
15278                if (!isset(
$style[
'padding'])) {
 
15280                } elseif (
$style[
'padding'] === 
'auto') {
 
15281                        $padding = 10 * (
$w / ($arrcode[
'maxw'] + 20));
 
15283                        $padding = floatval(
$style[
'padding']);
 
15286                if (!isset(
$style[
'hpadding'])) {
 
15287                        $hpadding = $padding;
 
15288                } elseif (
$style[
'hpadding'] === 
'auto') {
 
15289                        $hpadding = 10 * (
$w / ($arrcode[
'maxw'] + 20));
 
15291                        $hpadding = floatval(
$style[
'hpadding']);
 
15294                if (!isset(
$style[
'vpadding'])) {
 
15295                        $vpadding = $padding;
 
15296                } elseif (
$style[
'vpadding'] === 
'auto') {
 
15297                        $vpadding = ($hpadding / 2);
 
15299                        $vpadding = floatval(
$style[
'vpadding']);
 
15302                $max_xres = (
$w - (2 * $hpadding)) / $arrcode[
'maxw'];
 
15303                if (
$style[
'stretch']) {
 
15309                        if ($xres > $max_xres) {
 
15313                        if ((isset(
$style[
'padding']) AND (
$style[
'padding'] === 
'auto'))
 
15314                                OR (isset(
$style[
'hpadding']) AND (
$style[
'hpadding'] === 
'auto'))) {
 
15315                                $hpadding = 10 * $xres;
 
15316                                if (isset(
$style[
'vpadding']) AND (
$style[
'vpadding'] === 
'auto')) {
 
15317                                        $vpadding = ($hpadding / 2);
 
15321                if (
$style[
'fitwidth']) {
 
15323                        $w = (($arrcode[
'maxw'] * $xres) + (2 * $hpadding));
 
15324                        if (isset(
$style[
'cellfitalign'])) {
 
15325                                switch (
$style[
'cellfitalign']) {
 
15328                                                        $x -= ($wold - 
$w);
 
15334                                                        $x += ($wold - 
$w);
 
15340                                                        $x -= (($wold - 
$w) / 2);
 
15342                                                        $x += (($wold - 
$w) / 2);
 
15354                if ((
$h === 
'') OR (
$h <= 0)) {
 
15356                        $h = (($arrcode[
'maxw'] * $xres) / 3) + (2 * $vpadding) + $text_height;
 
15358                $barh = 
$h - $text_height - (2 * $vpadding);
 
15361                        if ($text_height > 
$h) {
 
15362                                $fontsize = ((
$h * 
$this->k) / (4 * $this->cell_height_ratio));
 
15366                        if ($vpadding > 0) {
 
15367                                $vpadding = ((
$h - $text_height) / 4);
 
15369                        $barh = 
$h - $text_height - (2 * $vpadding);
 
15374                $this->img_rb_y = 
$y + 
$h;
 
15377                        if (
$style[
'position'] == 
'L') {
 
15379                        } elseif (
$style[
'position'] == 
'C') {
 
15380                                $xpos = ($this->w + $this->lMargin - $this->rMargin - 
$w) / 2;
 
15381                        } elseif (
$style[
'position'] == 
'R') {
 
15382                                $xpos = $this->w - $this->rMargin - 
$w;
 
15386                        $this->img_rb_x = $xpos;
 
15388                        if (
$style[
'position'] == 
'L') {
 
15390                        } elseif (
$style[
'position'] == 
'C') {
 
15391                                $xpos = ($this->w + $this->lMargin - $this->rMargin - 
$w) / 2;
 
15392                        } elseif (
$style[
'position'] == 
'R') {
 
15393                                $xpos = $this->w - $this->rMargin - 
$w;
 
15397                        $this->img_rb_x = $xpos + 
$w;
 
15399                $xpos_rect = $xpos;
 
15400                if (!isset(
$style[
'align'])) {
 
15403                switch (
$style[
'align']) {
 
15405                                $xpos = $xpos_rect + $hpadding;
 
15409                                $xpos = $xpos_rect + (
$w - ($arrcode[
'maxw'] * $xres)) - $hpadding;
 
15414                                $xpos = $xpos_rect + ((
$w - ($arrcode[
'maxw'] * $xres)) / 2);
 
15418                $xpos_text = $xpos;
 
15421                $this->rtl = 
false;
 
15423                if (
$style[
'bgcolor']) {
 
15425                } elseif (
$style[
'border']) {
 
15432                foreach ($arrcode[
'bcode'] as 
$k => $v) {
 
15433                        $bw = ($v[
'w'] * $xres);
 
15436                                $ypos = 
$y + $vpadding + ($v[
'p'] * $barh / $arrcode[
'maxh']);
 
15437                                $this->
Rect($xpos, $ypos, $bw, ($v[
'h'] * $barh / $arrcode[
'maxh']), 
'F', array(), 
$style[
'fgcolor']);
 
15444                                $label = 
$style[
'label'];
 
15448                        $txtwidth = ($arrcode[
'maxw'] * $xres);
 
15450                                $style[
'stretchtext'] = 2;
 
15453                        $this->x = $xpos_text;
 
15454                        $this->y = 
$y + $vpadding + $barh;
 
15457                        $this->
Cell($txtwidth, 
'', $label, 0, 0, 
'C', 
false, 
'', 
$style[
'stretchtext'], 
false, 
'T', 
'T');
 
15458                        $this->cell_padding = $cellpadding;
 
15461                $this->rtl = $tempRTL;
 
15472                                $this->y = 
$y + round(
$h / 2);
 
15482                                $this->
SetY($this->img_rb_y);
 
15521                require_once(dirname(__FILE__).
'/tcpdf_barcodes_2d.php');
 
15527                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)) {
 
15528                        $this->
Error(
'Error in 2D barcode string');
 
15531                if (!isset(
$style[
'position'])) {
 
15532                        $style[
'position'] = 
'';
 
15534                if (!isset(
$style[
'fgcolor'])) {
 
15535                        $style[
'fgcolor'] = array(0,0,0); 
 
15537                if (!isset(
$style[
'bgcolor'])) {
 
15538                        $style[
'bgcolor'] = 
false; 
 
15540                if (!isset(
$style[
'border'])) {
 
15541                        $style[
'border'] = 
false;
 
15544                if (!isset(
$style[
'padding'])) {
 
15546                } elseif (
$style[
'padding'] === 
'auto') {
 
15549                if (!isset(
$style[
'hpadding'])) {
 
15551                } elseif (
$style[
'hpadding'] === 
'auto') {
 
15554                if (!isset(
$style[
'vpadding'])) {
 
15556                } elseif (
$style[
'vpadding'] === 
'auto') {
 
15559                $hpad = (2 * 
$style[
'hpadding']);
 
15560                $vpad = (2 * 
$style[
'vpadding']);
 
15562                if (!isset(
$style[
'module_width'])) {
 
15563                        $style[
'module_width'] = 1; 
 
15565                if (!isset(
$style[
'module_height'])) {
 
15566                        $style[
'module_height'] = 1; 
 
15577                $rows = $arrcode[
'num_rows'];
 
15578                $cols = $arrcode[
'num_cols'];
 
15579                if (($rows <= 0) || ($cols <= 0)){
 
15580                        $this->
Error(
'Error in 2D barcode string');
 
15583                $mw = 
$style[
'module_width'];
 
15584                $mh = 
$style[
'module_height'];
 
15585                if (($mw <= 0) OR ($mh <= 0)) {
 
15586                        $this->
Error(
'Error in 2D barcode string');
 
15592                        $maxw = $this->w - $this->rMargin - 
$x;
 
15595                $ratioHW = ((($rows * $mh) + $hpad) / (($cols * $mw) + $vpad));
 
15596                $ratioWH = ((($cols * $mw) + $vpad) / (($rows * $mh) + $hpad));
 
15598                        if (($maxw * $ratioHW) > $maxh) {
 
15599                                $maxw = $maxh * $ratioWH;
 
15601                        if (($maxh * $ratioWH) > $maxw) {
 
15602                                $maxh = $maxw * $ratioHW;
 
15613                if (((
$w === 
'') OR (
$w <= 0)) AND ((
$h === 
'') OR (
$h <= 0))) {
 
15614                        $w = ($cols + $hpad) * ($mw / $this->k);
 
15615                        $h = ($rows + $vpad) * ($mh / $this->k);
 
15616                } elseif ((
$w === 
'') OR (
$w <= 0)) {
 
15617                        $w = 
$h * $ratioWH;
 
15618                } elseif ((
$h === 
'') OR (
$h <= 0)) {
 
15619                        $h = 
$w * $ratioHW;
 
15622                $bw = (
$w * $cols) / ($cols + $hpad);
 
15623                $bh = (
$h * $rows) / ($rows + $vpad);
 
15628                        if (($cw / $ch) > ($mw / $mh)) {
 
15630                                $cw = $ch * $mw / $mh;
 
15632                                $style[
'hpadding'] = (
$w - $bw) / (2 * $cw);
 
15635                                $ch = $cw * $mh / $mw;
 
15637                                $style[
'vpadding'] = (
$h - $bh) / (2 * $ch);
 
15643                $this->img_rb_y = 
$y + 
$h;
 
15646                        if (
$style[
'position'] == 
'L') {
 
15648                        } elseif (
$style[
'position'] == 
'C') {
 
15649                                $xpos = ($this->w + $this->lMargin - $this->rMargin - 
$w) / 2;
 
15650                        } elseif (
$style[
'position'] == 
'R') {
 
15651                                $xpos = $this->w - $this->rMargin - 
$w;
 
15655                        $this->img_rb_x = $xpos;
 
15657                        if (
$style[
'position'] == 
'L') {
 
15659                        } elseif (
$style[
'position'] == 
'C') {
 
15660                                $xpos = ($this->w + $this->lMargin - $this->rMargin - 
$w) / 2;
 
15661                        } elseif (
$style[
'position'] == 
'R') {
 
15662                                $xpos = $this->w - $this->rMargin - 
$w;
 
15666                        $this->img_rb_x = $xpos + 
$w;
 
15668                $xstart = $xpos + (
$style[
'hpadding'] * $cw);
 
15669                $ystart = 
$y + (
$style[
'vpadding'] * $ch);
 
15672                $this->rtl = 
false;
 
15674                if (
$style[
'bgcolor']) {
 
15676                } elseif (
$style[
'border']) {
 
15683                for (
$r = 0; 
$r < $rows; ++
$r) {
 
15686                        for ($c = 0; $c < $cols; ++$c) {
 
15687                                if ($arrcode[
'bcode'][
$r][$c] == 1) {
 
15689                                        $this->
Rect($xr, $ystart, $cw, $ch, 
'F', array(), 
$style[
'fgcolor']);
 
15696                $this->rtl = $tempRTL;
 
15707                                $this->y = 
$y + round(
$h/2);
 
15717                                $this->
SetY($this->img_rb_y);
 
15748                        'left' => $this->lMargin,
 
15749                        'right' => $this->rMargin,
 
15750                        'top' => $this->tMargin,
 
15751                        'bottom' => $this->bMargin,
 
15752                        'header' => $this->header_margin,
 
15753                        'footer' => $this->footer_margin,
 
15754                        'cell' => $this->cell_padding,
 
15755                        'padding_left' => $this->cell_padding[
'L'],
 
15756                        'padding_top' => $this->cell_padding[
'T'],
 
15757                        'padding_right' => $this->cell_padding[
'R'],
 
15758                        'padding_bottom' => $this->cell_padding[
'B']
 
15775                        'left' => $this->original_lMargin,
 
15776                        'right' => $this->original_rMargin
 
15845                if ($width == 
'thin') {
 
15847                } elseif ($width == 
'medium') {
 
15849                } elseif ($width == 
'thick') {
 
15865                switch (strtolower(
$style)) {
 
15901                $bprop = preg_split(
'/[\s]+/', trim($cssborder));
 
15903                switch (count($bprop)) {
 
15905                                $width = $bprop[0];
 
15907                                $color = $bprop[2];
 
15913                                $color = $bprop[1];
 
15952                $padding = preg_split(
'/[\s]+/', trim($csspadding));
 
15954                switch (count($padding)) {
 
16006                $margin = preg_split(
'/[\s]+/', trim($cssmargin));
 
16008                switch (count($margin)) {
 
16060                $space = preg_split(
'/[\s]+/', trim($cssbspace));
 
16061                $border_spacing = array(); 
 
16062                switch (count(
$space)) {
 
16064                                $border_spacing[
'H'] = 
$space[0];
 
16065                                $border_spacing[
'V'] = 
$space[1];
 
16069                                $border_spacing[
'H'] = 
$space[0];
 
16070                                $border_spacing[
'V'] = 
$space[0];
 
16074                                return array(
'H' => 0, 
'V' => 0);
 
16080                $border_spacing[
'H'] = $this->
getHTMLUnitToUnits($border_spacing[
'H'], $width, 
'px', 
false);
 
16081                $border_spacing[
'V'] = $this->
getHTMLUnitToUnits($border_spacing[
'V'], $width, 
'px', 
false);
 
16082                return $border_spacing;
 
16095                $spacing = trim($spacing);
 
16096                switch ($spacing) {
 
16102                                if ($parent == 
'normal') {
 
16126                $stretch = trim($stretch);
 
16127                switch ($stretch) {
 
16128                        case 'ultra-condensed': {
 
16132                        case 'extra-condensed': {
 
16136                        case 'condensed': {
 
16140                        case 'semi-condensed': {
 
16148                        case 'semi-expanded': {
 
16156                        case 'extra-expanded': {
 
16160                        case 'ultra-expanded': {
 
16165                                $val = ($parent + 10);
 
16169                                $val = ($parent - 10);
 
16173                                if ($parent == 
'normal') {
 
16201                                $size = ($refsize - 4);
 
16205                                $size = ($refsize - 3);
 
16209                                $size = ($refsize - 2);
 
16217                                $size = ($refsize + 2);
 
16221                                $size = ($refsize + 4);
 
16225                                $size = ($refsize + 6);
 
16229                                $size = ($parent_size - 3);
 
16233                                $size = ($parent_size + 3);
 
16254                $matches = array();
 
16255                if (preg_match_all(
'/<cssarray>([^<]*)<\/cssarray>/isU', 
$html, $matches) > 0) {
 
16256                        if (isset($matches[1][0])) {
 
16257                                $css = array_merge($css, json_decode($this->
unhtmlentities($matches[1][0]), 
true));
 
16259                        $html = preg_replace(
'/<cssarray>(.*?)<\/cssarray>/isU', 
'', 
$html);
 
16262                $matches = array();
 
16263                if (preg_match_all(
'/<link([^>]*)>/isU', 
$html, $matches) > 0) {
 
16264                        foreach ($matches[1] as $key => $link) {
 
16266                                if (preg_match(
'/type[\s]*=[\s]*"text\/css"/', $link, $type)) {
 
16268                                        preg_match(
'/media[\s]*=[\s]*"([^"]*)"/', $link, $type);
 
16271                                        if (empty($type) OR (isset($type[1]) AND (($type[1] == 
'all') OR ($type[1] == 
'print')))) {
 
16273                                                if (preg_match(
'/href[\s]*=[\s]*"([^"]*)"/', $link, $type) > 0) {
 
16276                                                        if (($cssdata !== FALSE) AND (strlen($cssdata) > 0)) {
 
16285                $matches = array();
 
16286                if (preg_match_all(
'/<style([^>]*)>([^<]*)<\/style>/isU', 
$html, $matches) > 0) {
 
16287                        foreach ($matches[1] as $key => $media) {
 
16289                                preg_match(
'/media[\s]*=[\s]*"([^"]*)"/', $media, $type);
 
16292                                if (empty($type) OR (isset($type[1]) AND (($type[1] == 
'all') OR ($type[1] == 
'print')))) {
 
16293                                        $cssdata = $matches[2][$key];
 
16299                $csstagarray = 
'<cssarray>'.htmlentities(json_encode($css)).
'</cssarray>';
 
16301                $html = preg_replace(
'/<head([^>]*)>(.*?)<\/head>/siU', 
'', 
$html);
 
16302                $html = preg_replace(
'/<style([^>]*)>([^<]*)<\/style>/isU', 
'', 
$html);
 
16304                $blocktags = array(
'blockquote',
'br',
'dd',
'dl',
'div',
'dt',
'h1',
'h2',
'h3',
'h4',
'h5',
'h6',
'hr',
'li',
'ol',
'p',
'pre',
'ul',
'tcpdf',
'table',
'tr',
'td');
 
16306                $selfclosingtags = array(
'area',
'base',
'basefont',
'br',
'hr',
'input',
'img',
'link',
'meta');
 
16308                $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>');
 
16310                $html = preg_replace(
'/<pre/', 
'<xre', 
$html); 
 
16311                $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);
 
16312                $html = preg_replace(
'@(\r\n|\r)@', 
"\n", 
$html);
 
16313                $repTable = array(
"\t" => 
' ', 
"\0" => 
' ', 
"\x0B" => 
' ', 
"\\" => 
"\\\\");
 
16316                while (($offset < strlen(
$html)) AND ($pos = strpos(
$html, 
'</pre>', $offset)) !== 
false) {
 
16317                        $html_a = substr(
$html, 0, $offset);
 
16318                        $html_b = substr(
$html, $offset, ($pos - $offset + 6));
 
16319                        while (preg_match(
"'<xre([^>]*)>(.*?)\n(.*?)</pre>'si", $html_b)) {
 
16321                                $html_b = preg_replace(
"'<xre([^>]*)>(.*?)\n(.*?)</pre>'si", 
"<xre\\1>\\2<br />\\3</pre>", $html_b);
 
16323                        while (preg_match(
"'<xre([^>]*)>(.*?)".$this->re_space[
'p'].
"(.*?)</pre>'".$this->re_space[
'm'], $html_b)) {
 
16325                                $html_b = preg_replace(
"'<xre([^>]*)>(.*?)".$this->re_space[
'p'].
"(.*?)</pre>'".$this->re_space[
'm'], 
"<xre\\1>\\2 \\3</pre>", $html_b);
 
16327                        $html = $html_a.$html_b.substr(
$html, $pos + 6);
 
16328                        $offset = strlen($html_a.$html_b);
 
16331                while (($offset < strlen(
$html)) AND ($pos = strpos(
$html, 
'</textarea>', $offset)) !== 
false) {
 
16332                        $html_a = substr(
$html, 0, $offset);
 
16333                        $html_b = substr(
$html, $offset, ($pos - $offset + 11));
 
16334                        while (preg_match(
"'<textarea([^>]*)>(.*?)\n(.*?)</textarea>'si", $html_b)) {
 
16336                                $html_b = preg_replace(
"'<textarea([^>]*)>(.*?)\n(.*?)</textarea>'si", 
"<textarea\\1>\\2<TBR>\\3</textarea>", $html_b);
 
16337                                $html_b = preg_replace(
"'<textarea([^>]*)>(.*?)[\"](.*?)</textarea>'si", 
"<textarea\\1>\\2''\\3</textarea>", $html_b);
 
16339                        $html = $html_a.$html_b.substr(
$html, $pos + 11);
 
16340                        $offset = strlen($html_a.$html_b);
 
16342                $html = preg_replace(
'/([\s]*)<option/si', 
'<option', 
$html);
 
16343                $html = preg_replace(
'/<\/option>([\s]*)/si', 
'</option>', 
$html);
 
16345                while (($offset < strlen(
$html)) AND ($pos = strpos(
$html, 
'</option>', $offset)) !== 
false) {
 
16346                        $html_a = substr(
$html, 0, $offset);
 
16347                        $html_b = substr(
$html, $offset, ($pos - $offset + 9));
 
16348                        while (preg_match(
"'<option([^>]*)>(.*?)</option>'si", $html_b)) {
 
16349                                $html_b = preg_replace(
"'<option([\s]+)value=\"([^\"]*)\"([^>]*)>(.*?)</option>'si", 
"\\2#!TaB!#\\4#!NwL!#", $html_b);
 
16350                                $html_b = preg_replace(
"'<option([^>]*)>(.*?)</option>'si", 
"\\2#!NwL!#", $html_b);
 
16352                        $html = $html_a.$html_b.substr(
$html, $pos + 9);
 
16353                        $offset = strlen($html_a.$html_b);
 
16355                if (preg_match(
"'</select'si", 
$html)) {
 
16356                        $html = preg_replace(
"'<select([^>]*)>'si", 
"<select\\1 opt=\"", 
$html);
 
16357                        $html = preg_replace(
"'#!NwL!#</select>'si", 
"\" />", 
$html);
 
16363                $html = preg_replace(
'/[\s]+<\/(table|tr|ul|ol|dl)>/', 
'</\\1>', 
$html);
 
16364                $html = preg_replace(
'/'.$this->re_space[
'p'].
'+<\/(td|th|li|dt|dd)>/'.$this->re_space[
'm'], 
'</\\1>', 
$html);
 
16365                $html = preg_replace(
'/[\s]+<(tr|td|th|li|dt|dd)/', 
'<\\1', 
$html);
 
16366                $html = preg_replace(
'/'.$this->re_space[
'p'].
'+<(ul|ol|dl|br)/'.$this->re_space[
'm'], 
'<\\1', 
$html);
 
16367                $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);
 
16368                $html = preg_replace(
'/<\/(td|th)>/', 
'<marker style="font-size:0"/></\\1>', 
$html);
 
16369                $html = preg_replace(
'/<\/table>([\s]*)<marker style="font-size:0"\/>/', 
'</table>', 
$html);
 
16370                $html = preg_replace(
'/'.$this->re_space[
'p'].
'+<img/'.$this->re_space[
'm'], chr(32).
'<img', 
$html);
 
16371                $html = preg_replace(
'/<img([^>]*)>[\s]+([^<])/xi', 
'<img\\1> \\2', 
$html);
 
16372                $html = preg_replace(
'/<img([^>]*)>/xi', 
'<img\\1><span><marker style="font-size:0"/></span>', 
$html);
 
16373                $html = preg_replace(
'/<xre/', 
'<pre', 
$html); 
 
16374                $html = preg_replace(
'/<textarea([^>]*)>([^<]*)<\/textarea>/xi', 
'<textarea\\1 value="\\2" />', 
$html);
 
16375                $html = preg_replace(
'/<li([^>]*)><\/li>/', 
'<li\\1> </li>', 
$html);
 
16376                $html = preg_replace(
'/<li([^>]*)>'.$this->re_space[
'p'].
'*<img/'.$this->re_space[
'm'], 
'<li\\1><font size="1"> </font><img', 
$html);
 
16377                $html = preg_replace(
'/<([^>\/]*)>[\s]/', 
'<\\1> ', 
$html); 
 
16378                $html = preg_replace(
'/[\s]<\/([^>]*)>/', 
' </\\1>', 
$html); 
 
16379                $html = preg_replace(
'/<su([bp])/', 
'<zws/><su\\1', 
$html); 
 
16380                $html = preg_replace(
'/<\/su([bp])>/', 
'</su\\1><zws/>', 
$html); 
 
16381                $html = preg_replace(
'/'.$this->re_space[
'p'].
'+/'.$this->re_space[
'm'], chr(32), 
$html); 
 
16385                $html = preg_replace(
'/<li><br([^>]*)>/', 
'<li> <br\\1>', 
$html);
 
16387                $html = preg_replace(
'/^<img/', 
'<span style="font-size:0"><br /></span> <img', 
$html, 1);
 
16389                $tagpattern = 
'/(<[^>]+>)/';
 
16393                $maxel = count($a);
 
16398                $dom[$key] = array();
 
16401                $dom[$key][
'tag'] = 
false;
 
16402                $dom[$key][
'block'] = 
false;
 
16403                $dom[$key][
'value'] = 
'';
 
16404                $dom[$key][
'parent'] = 0;
 
16405                $dom[$key][
'hide'] = 
false;
 
16412                $dom[$key][
'fill'] = (($this->textrendermode % 2) == 0);
 
16413                $dom[$key][
'clip'] = ($this->textrendermode > 3);
 
16415                $dom[$key][
'bgcolor'] = 
false;
 
16418                $dom[$key][
'align'] = 
'';
 
16419                $dom[$key][
'listtype'] = 
'';
 
16420                $dom[$key][
'text-indent'] = 0;
 
16421                $dom[$key][
'text-transform'] = 
'';
 
16422                $dom[$key][
'border'] = array();
 
16423                $dom[$key][
'dir'] = $this->rtl?
'rtl':
'ltr';
 
16427                array_push($level, 0); 
 
16428                while ($elkey < $maxel) {
 
16429                        $dom[$key] = array();
 
16430                        $element = $a[$elkey];
 
16431                        $dom[$key][
'elkey'] = $elkey;
 
16432                        if (preg_match($tagpattern, $element)) {
 
16434                                $element = substr($element, 1, -1);
 
16436                                preg_match(
'/[\/]?([a-zA-Z0-9]*)/', $element, $tag);
 
16437                                $tagname = strtolower($tag[1]);
 
16439                                if ($tagname == 
'thead') {
 
16440                                        if ($element[0] == 
'/') {
 
16448                                $dom[$key][
'tag'] = 
true;
 
16449                                $dom[$key][
'value'] = $tagname;
 
16450                                if (in_array($dom[$key][
'value'], $blocktags)) {
 
16451                                        $dom[$key][
'block'] = 
true;
 
16453                                        $dom[$key][
'block'] = 
false;
 
16455                                if ($element[0] == 
'/') {
 
16457                                        $dom[$key][
'opening'] = 
false;
 
16458                                        $dom[$key][
'parent'] = end($level);
 
16460                                        $dom[$key][
'hide'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'hide'];
 
16461                                        $dom[$key][
'fontname'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'fontname'];
 
16462                                        $dom[$key][
'fontstyle'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'fontstyle'];
 
16463                                        $dom[$key][
'fontsize'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'fontsize'];
 
16464                                        $dom[$key][
'font-stretch'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'font-stretch'];
 
16465                                        $dom[$key][
'letter-spacing'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'letter-spacing'];
 
16466                                        $dom[$key][
'stroke'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'stroke'];
 
16467                                        $dom[$key][
'fill'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'fill'];
 
16468                                        $dom[$key][
'clip'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'clip'];
 
16469                                        $dom[$key][
'line-height'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'line-height'];
 
16470                                        $dom[$key][
'bgcolor'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'bgcolor'];
 
16471                                        $dom[$key][
'fgcolor'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'fgcolor'];
 
16472                                        $dom[$key][
'strokecolor'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'strokecolor'];
 
16473                                        $dom[$key][
'align'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'align'];
 
16474                                        $dom[$key][
'text-transform'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'text-transform'];
 
16475                                        $dom[$key][
'dir'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'dir'];
 
16476                                        if (isset($dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'listtype'])) {
 
16477                                                $dom[$key][
'listtype'] = $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'listtype'];
 
16480                                        if (($dom[$key][
'value'] == 
'tr') AND (!isset($dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'cols']))) {
 
16481                                                $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'cols'] = $dom[($dom[$key][
'parent'])][
'cols'];
 
16483                                        if (($dom[$key][
'value'] == 
'td') OR ($dom[$key][
'value'] == 
'th')) {
 
16484                                                $dom[($dom[$key][
'parent'])][
'content'] = $csstagarray;
 
16485                                                for ($i = ($dom[$key][
'parent'] + 1); $i < $key; ++$i) {
 
16486                                                        $dom[($dom[$key][
'parent'])][
'content'] .= stripslashes($a[$dom[$i][
'elkey']]);
 
16490                                                $dom[($dom[$key][
'parent'])][
'content'] = str_replace(
'<table', 
'<table nested="true"', $dom[($dom[$key][
'parent'])][
'content']);
 
16492                                                $dom[($dom[$key][
'parent'])][
'content'] = str_replace(
'<thead>', 
'', $dom[($dom[$key][
'parent'])][
'content']);
 
16493                                                $dom[($dom[$key][
'parent'])][
'content'] = str_replace(
'</thead>', 
'', $dom[($dom[$key][
'parent'])][
'content']);
 
16496                                        if (($dom[$key][
'value'] == 
'tr') AND ($dom[($dom[$key][
'parent'])][
'thead'] === 
true)) {
 
16498                                                        $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'thead'] = $csstagarray.$a[$dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'elkey']];
 
16500                                                for ($i = $dom[$key][
'parent']; $i <= $key; ++$i) {
 
16501                                                        $dom[($dom[($dom[$key][
'parent'])][
'parent'])][
'thead'] .= $a[$dom[$i][
'elkey']];
 
16503                                                if (!isset($dom[($dom[$key][
'parent'])][
'attribute'])) {
 
16504                                                        $dom[($dom[$key][
'parent'])][
'attribute'] = array();
 
16507                                                $dom[($dom[$key][
'parent'])][
'attribute'][
'nobr'] = 
'true';
 
16511                                                $dom[($dom[$key][
'parent'])][
'thead'] = str_replace(
' nobr="true"', 
'', $dom[($dom[$key][
'parent'])][
'thead']);
 
16512                                                $dom[($dom[$key][
'parent'])][
'thead'] .= 
'</tablehead>';
 
16516                                        $dom[$key][
'opening'] = 
true;
 
16517                                        $dom[$key][
'parent'] = end($level);
 
16518                                        if ((substr($element, -1, 1) == 
'/') OR (in_array($dom[$key][
'value'], $selfclosingtags))) {
 
16520                                                $dom[$key][
'self'] = 
true;
 
16523                                                array_push($level, $key);
 
16524                                                $dom[$key][
'self'] = 
false;
 
16529                                                $parentkey = $dom[$key][
'parent'];
 
16530                                                $dom[$key][
'hide'] = $dom[$parentkey][
'hide'];
 
16531                                                $dom[$key][
'fontname'] = $dom[$parentkey][
'fontname'];
 
16532                                                $dom[$key][
'fontstyle'] = $dom[$parentkey][
'fontstyle'];
 
16533                                                $dom[$key][
'fontsize'] = $dom[$parentkey][
'fontsize'];
 
16534                                                $dom[$key][
'font-stretch'] = $dom[$parentkey][
'font-stretch'];
 
16535                                                $dom[$key][
'letter-spacing'] = $dom[$parentkey][
'letter-spacing'];
 
16536                                                $dom[$key][
'stroke'] = $dom[$parentkey][
'stroke'];
 
16537                                                $dom[$key][
'fill'] = $dom[$parentkey][
'fill'];
 
16538                                                $dom[$key][
'clip'] = $dom[$parentkey][
'clip'];
 
16539                                                $dom[$key][
'line-height'] = $dom[$parentkey][
'line-height'];
 
16540                                                $dom[$key][
'bgcolor'] = $dom[$parentkey][
'bgcolor'];
 
16541                                                $dom[$key][
'fgcolor'] = $dom[$parentkey][
'fgcolor'];
 
16542                                                $dom[$key][
'strokecolor'] = $dom[$parentkey][
'strokecolor'];
 
16543                                                $dom[$key][
'align'] = $dom[$parentkey][
'align'];
 
16544                                                $dom[$key][
'listtype'] = $dom[$parentkey][
'listtype'];
 
16545                                                $dom[$key][
'text-indent'] = $dom[$parentkey][
'text-indent'];
 
16546                                                $dom[$key][
'text-transform'] = $dom[$parentkey][
'text-transform'];
 
16547                                                $dom[$key][
'border'] = array();
 
16548                                                $dom[$key][
'dir'] = $dom[$parentkey][
'dir'];
 
16551                                        preg_match_all(
'/([^=\s]*)[\s]*=[\s]*"([^"]*)"/', $element, $attr_array, PREG_PATTERN_ORDER);
 
16552                                        $dom[$key][
'attribute'] = array(); 
 
16553                                        while (list($id, $name) = each($attr_array[1])) {
 
16554                                                $dom[$key][
'attribute'][strtolower($name)] = $attr_array[2][$id];
 
16556                                        if (!empty($css)) {
 
16562                                        if (isset($dom[$key][
'attribute'][
'style']) AND !empty($dom[$key][
'attribute'][
'style'])) {
 
16564                                                preg_match_all(
'/([^;:\s]*):([^;]*)/', $dom[$key][
'attribute'][
'style'], $style_array, PREG_PATTERN_ORDER);
 
16565                                                $dom[$key][
'style'] = array(); 
 
16566                                                while (list($id, $name) = each($style_array[1])) {
 
16568                                                        $dom[$key][
'style'][strtolower($name)] = trim($style_array[2][$id]);
 
16572                                                if (isset($dom[$key][
'style'][
'direction'])) {
 
16573                                                        $dom[$key][
'dir'] = $dom[$key][
'style'][
'direction'];
 
16576                                                if (isset($dom[$key][
'style'][
'display'])) {
 
16577                                                        $dom[$key][
'hide'] = (trim(strtolower($dom[$key][
'style'][
'display'])) == 
'none');
 
16580                                                if (isset($dom[$key][
'style'][
'font-family'])) {
 
16581                                                        $dom[$key][
'fontname'] = $this->
getFontFamilyName($dom[$key][
'style'][
'font-family']);
 
16584                                                if (isset($dom[$key][
'style'][
'list-style-type'])) {
 
16585                                                        $dom[$key][
'listtype'] = trim(strtolower($dom[$key][
'style'][
'list-style-type']));
 
16586                                                        if ($dom[$key][
'listtype'] == 
'inherit') {
 
16587                                                                $dom[$key][
'listtype'] = $dom[$parentkey][
'listtype'];
 
16591                                                if (isset($dom[$key][
'style'][
'text-indent'])) {
 
16592                                                        $dom[$key][
'text-indent'] = $this->
getHTMLUnitToUnits($dom[$key][
'style'][
'text-indent']);
 
16593                                                        if ($dom[$key][
'text-indent'] == 
'inherit') {
 
16594                                                                $dom[$key][
'text-indent'] = $dom[$parentkey][
'text-indent'];
 
16598                                                if (isset($dom[$key][
'style'][
'text-transform'])) {
 
16599                                                        $dom[$key][
'text-transform'] = $dom[$key][
'style'][
'text-transform'];
 
16602                                                if (isset($dom[$key][
'style'][
'font-size'])) {
 
16603                                                        $fsize = trim($dom[$key][
'style'][
'font-size']);
 
16604                                                        $dom[$key][
'fontsize'] = $this->
getHTMLFontUnits($fsize, $dom[0][
'fontsize'], $dom[$parentkey][
'fontsize'], 
'pt');
 
16607                                                if (isset($dom[$key][
'style'][
'font-stretch'])) {
 
16608                                                        $dom[$key][
'font-stretch'] = $this->
getCSSFontStretching($dom[$key][
'style'][
'font-stretch'], $dom[$parentkey][
'font-stretch']);
 
16611                                                if (isset($dom[$key][
'style'][
'letter-spacing'])) {
 
16612                                                        $dom[$key][
'letter-spacing'] = $this->
getCSSFontSpacing($dom[$key][
'style'][
'letter-spacing'], $dom[$parentkey][
'letter-spacing']);
 
16615                                                if (isset($dom[$key][
'style'][
'line-height'])) {
 
16616                                                        $lineheight = trim($dom[$key][
'style'][
'line-height']);
 
16617                                                        switch ($lineheight) {
 
16620                                                                        $dom[$key][
'line-height'] = $dom[0][
'line-height'];
 
16624                                                                        $dom[$key][
'line-height'] = $dom[$parentkey][
'line-height'];
 
16627                                                                        if (is_numeric($lineheight)) {
 
16629                                                                                $lineheight = ($lineheight * 100).
'%';
 
16632                                                                        if (substr($lineheight, -1) !== 
'%') {
 
16633                                                                                if ($dom[$key][
'fontsize'] <= 0) {
 
16634                                                                                        $dom[$key][
'line-height'] = 1;
 
16636                                                                                        $dom[$key][
'line-height'] = (($dom[$key][
'line-height'] - $this->cell_padding[
'T'] - $this->cell_padding[
'B']) / $dom[$key][
'fontsize']);
 
16643                                                if (isset($dom[$key][
'style'][
'font-weight'])) {
 
16644                                                        if (strtolower($dom[$key][
'style'][
'font-weight'][0]) == 
'n') {
 
16645                                                                if (strpos($dom[$key][
'fontstyle'], 
'B') !== 
false) {
 
16646                                                                        $dom[$key][
'fontstyle'] = str_replace(
'B', 
'', $dom[$key][
'fontstyle']);
 
16648                                                        } elseif (strtolower($dom[$key][
'style'][
'font-weight'][0]) == 
'b') {
 
16649                                                                $dom[$key][
'fontstyle'] .= 
'B';
 
16652                                                if (isset($dom[$key][
'style'][
'font-style']) AND (strtolower($dom[$key][
'style'][
'font-style'][0]) == 
'i')) {
 
16653                                                        $dom[$key][
'fontstyle'] .= 
'I';
 
16658                                                } elseif ($dom[$key][
'value'] == 
'a') {
 
16662                                                if (isset($dom[$key][
'style'][
'background-color']) AND (!
TCPDF_STATIC::empty_string($dom[$key][
'style'][
'background-color']))) {
 
16666                                                if (isset($dom[$key][
'style'][
'text-decoration'])) {
 
16667                                                        $decors = explode(
' ', strtolower($dom[$key][
'style'][
'text-decoration']));
 
16668                                                        foreach ($decors as $dec) {
 
16671                                                                        if ($dec[0] == 
'u') {
 
16673                                                                                $dom[$key][
'fontstyle'] .= 
'U';
 
16674                                                                        } elseif ($dec[0] == 
'l') {
 
16676                                                                                $dom[$key][
'fontstyle'] .= 
'D';
 
16677                                                                        } elseif ($dec[0] == 
'o') {
 
16679                                                                                $dom[$key][
'fontstyle'] .= 
'O';
 
16683                                                } elseif ($dom[$key][
'value'] == 
'a') {
 
16687                                                if (isset($dom[$key][
'style'][
'width'])) {
 
16688                                                        $dom[$key][
'width'] = $dom[$key][
'style'][
'width'];
 
16691                                                if (isset($dom[$key][
'style'][
'height'])) {
 
16692                                                        $dom[$key][
'height'] = $dom[$key][
'style'][
'height'];
 
16695                                                if (isset($dom[$key][
'style'][
'text-align'])) {
 
16696                                                        $dom[$key][
'align'] = strtoupper($dom[$key][
'style'][
'text-align'][0]);
 
16699                                                if (isset($dom[$key][
'style'][
'border'])) {
 
16701                                                        if (!empty($borderstyle)) {
 
16702                                                                $dom[$key][
'border'][
'LTRB'] = $borderstyle;
 
16705                                                if (isset($dom[$key][
'style'][
'border-color'])) {
 
16706                                                        $brd_colors = preg_split(
'/[\s]+/', trim($dom[$key][
'style'][
'border-color']));
 
16707                                                        if (isset($brd_colors[3])) {
 
16710                                                        if (isset($brd_colors[1])) {
 
16713                                                        if (isset($brd_colors[0])) {
 
16716                                                        if (isset($brd_colors[2])) {
 
16720                                                if (isset($dom[$key][
'style'][
'border-width'])) {
 
16721                                                        $brd_widths = preg_split(
'/[\s]+/', trim($dom[$key][
'style'][
'border-width']));
 
16722                                                        if (isset($brd_widths[3])) {
 
16725                                                        if (isset($brd_widths[1])) {
 
16728                                                        if (isset($brd_widths[0])) {
 
16731                                                        if (isset($brd_widths[2])) {
 
16735                                                if (isset($dom[$key][
'style'][
'border-style'])) {
 
16736                                                        $brd_styles = preg_split(
'/[\s]+/', trim($dom[$key][
'style'][
'border-style']));
 
16737                                                        if (isset($brd_styles[3]) AND ($brd_styles[3]!=
'none')) {
 
16738                                                                $dom[$key][
'border'][
'L'][
'cap'] = 
'square';
 
16739                                                                $dom[$key][
'border'][
'L'][
'join'] = 
'miter';
 
16741                                                                if ($dom[$key][
'border'][
'L'][
'dash'] < 0) {
 
16742                                                                        $dom[$key][
'border'][
'L'] = array();
 
16745                                                        if (isset($brd_styles[1])) {
 
16746                                                                $dom[$key][
'border'][
'R'][
'cap'] = 
'square';
 
16747                                                                $dom[$key][
'border'][
'R'][
'join'] = 
'miter';
 
16749                                                                if ($dom[$key][
'border'][
'R'][
'dash'] < 0) {
 
16750                                                                        $dom[$key][
'border'][
'R'] = array();
 
16753                                                        if (isset($brd_styles[0])) {
 
16754                                                                $dom[$key][
'border'][
'T'][
'cap'] = 
'square';
 
16755                                                                $dom[$key][
'border'][
'T'][
'join'] = 
'miter';
 
16757                                                                if ($dom[$key][
'border'][
'T'][
'dash'] < 0) {
 
16758                                                                        $dom[$key][
'border'][
'T'] = array();
 
16761                                                        if (isset($brd_styles[2])) {
 
16762                                                                $dom[$key][
'border'][
'B'][
'cap'] = 
'square';
 
16763                                                                $dom[$key][
'border'][
'B'][
'join'] = 
'miter';
 
16765                                                                if ($dom[$key][
'border'][
'B'][
'dash'] < 0) {
 
16766                                                                        $dom[$key][
'border'][
'B'] = array();
 
16770                                                $cellside = array(
'L' => 
'left', 
'R' => 
'right', 
'T' => 
'top', 
'B' => 
'bottom');
 
16771                                                foreach ($cellside as $bsk => $bsv) {
 
16772                                                        if (isset($dom[$key][
'style'][
'border-'.$bsv])) {
 
16774                                                                if (!empty($borderstyle)) {
 
16775                                                                        $dom[$key][
'border'][$bsk] = $borderstyle;
 
16778                                                        if (isset($dom[$key][
'style'][
'border-'.$bsv.
'-color'])) {
 
16781                                                        if (isset($dom[$key][
'style'][
'border-'.$bsv.
'-width'])) {
 
16782                                                                $dom[$key][
'border'][$bsk][
'width'] = $this->
getCSSBorderWidth($dom[$key][
'style'][
'border-'.$bsv.
'-width']);
 
16784                                                        if (isset($dom[$key][
'style'][
'border-'.$bsv.
'-style'])) {
 
16785                                                                $dom[$key][
'border'][$bsk][
'dash'] = $this->
getCSSBorderDashStyle($dom[$key][
'style'][
'border-'.$bsv.
'-style']);
 
16786                                                                if ($dom[$key][
'border'][$bsk][
'dash'] < 0) {
 
16787                                                                        $dom[$key][
'border'][$bsk] = array();
 
16792                                                if (isset($dom[$key][
'style'][
'padding'])) {
 
16793                                                        $dom[$key][
'padding'] = $this->
getCSSPadding($dom[$key][
'style'][
'padding']);
 
16797                                                foreach ($cellside as $psk => $psv) {
 
16798                                                        if (isset($dom[$key][
'style'][
'padding-'.$psv])) {
 
16799                                                                $dom[$key][
'padding'][$psk] = $this->
getHTMLUnitToUnits($dom[$key][
'style'][
'padding-'.$psv], 0, 
'px', 
false);
 
16803                                                if (isset($dom[$key][
'style'][
'margin'])) {
 
16804                                                        $dom[$key][
'margin'] = $this->
getCSSMargin($dom[$key][
'style'][
'margin']);
 
16808                                                foreach ($cellside as $psk => $psv) {
 
16809                                                        if (isset($dom[$key][
'style'][
'margin-'.$psv])) {
 
16810                                                                $dom[$key][
'margin'][$psk] = $this->
getHTMLUnitToUnits(str_replace(
'auto', 
'0', $dom[$key][
'style'][
'margin-'.$psv]), 0, 
'px', 
false);
 
16814                                                if (isset($dom[$key][
'style'][
'border-spacing'])) {
 
16815                                                        $dom[$key][
'border-spacing'] = $this->
getCSSBorderMargin($dom[$key][
'style'][
'border-spacing']);
 
16818                                                if (isset($dom[$key][
'style'][
'page-break-inside']) AND ($dom[$key][
'style'][
'page-break-inside'] == 
'avoid')) {
 
16819                                                        $dom[$key][
'attribute'][
'nobr'] = 
'true';
 
16822                                                if (isset($dom[$key][
'style'][
'page-break-before'])) {
 
16823                                                        if ($dom[$key][
'style'][
'page-break-before'] == 
'always') {
 
16824                                                                $dom[$key][
'attribute'][
'pagebreak'] = 
'true';
 
16825                                                        } elseif ($dom[$key][
'style'][
'page-break-before'] == 
'left') {
 
16826                                                                $dom[$key][
'attribute'][
'pagebreak'] = 
'left';
 
16827                                                        } elseif ($dom[$key][
'style'][
'page-break-before'] == 
'right') {
 
16828                                                                $dom[$key][
'attribute'][
'pagebreak'] = 
'right';
 
16832                                                if (isset($dom[$key][
'style'][
'page-break-after'])) {
 
16833                                                        if ($dom[$key][
'style'][
'page-break-after'] == 
'always') {
 
16834                                                                $dom[$key][
'attribute'][
'pagebreakafter'] = 
'true';
 
16835                                                        } elseif ($dom[$key][
'style'][
'page-break-after'] == 
'left') {
 
16836                                                                $dom[$key][
'attribute'][
'pagebreakafter'] = 
'left';
 
16837                                                        } elseif ($dom[$key][
'style'][
'page-break-after'] == 
'right') {
 
16838                                                                $dom[$key][
'attribute'][
'pagebreakafter'] = 
'right';
 
16842                                        if (isset($dom[$key][
'attribute'][
'display'])) {
 
16843                                                $dom[$key][
'hide'] = (trim(strtolower($dom[$key][
'attribute'][
'display'])) == 
'none');
 
16845                                        if (isset($dom[$key][
'attribute'][
'border']) AND ($dom[$key][
'attribute'][
'border'] != 0)) {
 
16846                                                $borderstyle = $this->
getCSSBorderStyle($dom[$key][
'attribute'][
'border'].
' solid black');
 
16847                                                if (!empty($borderstyle)) {
 
16848                                                        $dom[$key][
'border'][
'LTRB'] = $borderstyle;
 
16852                                        if ($dom[$key][
'value'] == 
'font') {
 
16854                                                if (isset($dom[$key][
'attribute'][
'face'])) {
 
16855                                                        $dom[$key][
'fontname'] = $this->
getFontFamilyName($dom[$key][
'attribute'][
'face']);
 
16858                                                if (isset($dom[$key][
'attribute'][
'size'])) {
 
16860                                                                if ($dom[$key][
'attribute'][
'size'][0] == 
'+') {
 
16861                                                                        $dom[$key][
'fontsize'] = $dom[($dom[$key][
'parent'])][
'fontsize'] + intval(substr($dom[$key][
'attribute'][
'size'], 1));
 
16862                                                                } elseif ($dom[$key][
'attribute'][
'size'][0] == 
'-') {
 
16863                                                                        $dom[$key][
'fontsize'] = $dom[($dom[$key][
'parent'])][
'fontsize'] - intval(substr($dom[$key][
'attribute'][
'size'], 1));
 
16865                                                                        $dom[$key][
'fontsize'] = intval($dom[$key][
'attribute'][
'size']);
 
16868                                                                $dom[$key][
'fontsize'] = intval($dom[$key][
'attribute'][
'size']);
 
16873                                        if ((($dom[$key][
'value'] == 
'ul') OR ($dom[$key][
'value'] == 
'ol') OR ($dom[$key][
'value'] == 
'dl'))
 
16876                                                        $dom[$key][
'align'] = 
'R';
 
16878                                                        $dom[$key][
'align'] = 
'L';
 
16881                                        if (($dom[$key][
'value'] == 
'small') OR ($dom[$key][
'value'] == 
'sup') OR ($dom[$key][
'value'] == 
'sub')) {
 
16882                                                if (!isset($dom[$key][
'attribute'][
'size']) AND !isset($dom[$key][
'style'][
'font-size'])) {
 
16883                                                        $dom[$key][
'fontsize'] = $dom[$key][
'fontsize'] * 
K_SMALL_RATIO;
 
16886                                        if (($dom[$key][
'value'] == 
'strong') OR ($dom[$key][
'value'] == 
'b')) {
 
16887                                                $dom[$key][
'fontstyle'] .= 
'B';
 
16889                                        if (($dom[$key][
'value'] == 
'em') OR ($dom[$key][
'value'] == 
'i')) {
 
16890                                                $dom[$key][
'fontstyle'] .= 
'I';
 
16892                                        if ($dom[$key][
'value'] == 
'u') {
 
16893                                                $dom[$key][
'fontstyle'] .= 
'U';
 
16895                                        if (($dom[$key][
'value'] == 
'del') OR ($dom[$key][
'value'] == 
's') OR ($dom[$key][
'value'] == 
'strike')) {
 
16896                                                $dom[$key][
'fontstyle'] .= 
'D';
 
16898                                        if (!isset($dom[$key][
'style'][
'text-decoration']) AND ($dom[$key][
'value'] == 
'a')) {
 
16901                                        if (($dom[$key][
'value'] == 
'pre') OR ($dom[$key][
'value'] == 
'tt')) {
 
16904                                        if (!empty($dom[$key][
'value']) AND ($dom[$key][
'value'][0] == 
'h') AND (intval($dom[$key][
'value']{1}) > 0) AND (intval($dom[$key][
'value']{1}) < 7)) {
 
16906                                                if (!isset($dom[$key][
'attribute'][
'size']) AND !isset($dom[$key][
'style'][
'font-size'])) {
 
16907                                                        $headsize = (4 - intval($dom[$key][
'value']{1})) * 2;
 
16908                                                        $dom[$key][
'fontsize'] = $dom[0][
'fontsize'] + $headsize;
 
16910                                                if (!isset($dom[$key][
'style'][
'font-weight'])) {
 
16911                                                        $dom[$key][
'fontstyle'] .= 
'B';
 
16914                                        if (($dom[$key][
'value'] == 
'table')) {
 
16915                                                $dom[$key][
'rows'] = 0; 
 
16916                                                $dom[$key][
'trids'] = array(); 
 
16917                                                $dom[$key][
'thead'] = 
''; 
 
16919                                        if (($dom[$key][
'value'] == 
'tr')) {
 
16920                                                $dom[$key][
'cols'] = 0;
 
16922                                                        $dom[$key][
'thead'] = 
true;
 
16925                                                        $dom[$key][
'thead'] = 
false;
 
16927                                                        ++$dom[($dom[$key][
'parent'])][
'rows'];
 
16929                                                        array_push($dom[($dom[$key][
'parent'])][
'trids'], $key);
 
16932                                        if (($dom[$key][
'value'] == 
'th') OR ($dom[$key][
'value'] == 
'td')) {
 
16933                                                if (isset($dom[$key][
'attribute'][
'colspan'])) {
 
16934                                                        $colspan = intval($dom[$key][
'attribute'][
'colspan']);
 
16938                                                $dom[$key][
'attribute'][
'colspan'] = $colspan;
 
16939                                                $dom[($dom[$key][
'parent'])][
'cols'] += $colspan;
 
16942                                        if (isset($dom[$key][
'attribute'][
'dir'])) {
 
16943                                                $dom[$key][
'dir'] = $dom[$key][
'attribute'][
'dir'];
 
16948                                        } elseif (!isset($dom[$key][
'style'][
'color']) AND ($dom[$key][
'value'] == 
'a')) {
 
16956                                        if (isset($dom[$key][
'attribute'][
'strokecolor']) AND (!
TCPDF_STATIC::empty_string($dom[$key][
'attribute'][
'strokecolor']))) {
 
16960                                        if (isset($dom[$key][
'attribute'][
'width'])) {
 
16961                                                $dom[$key][
'width'] = $dom[$key][
'attribute'][
'width'];
 
16964                                        if (isset($dom[$key][
'attribute'][
'height'])) {
 
16965                                                $dom[$key][
'height'] = $dom[$key][
'attribute'][
'height'];
 
16968                                        if (isset($dom[$key][
'attribute'][
'align']) AND (!
TCPDF_STATIC::empty_string($dom[$key][
'attribute'][
'align'])) AND ($dom[$key][
'value'] !== 
'img')) {
 
16969                                                $dom[$key][
'align'] = strtoupper($dom[$key][
'attribute'][
'align'][0]);
 
16972                                        if (isset($dom[$key][
'attribute'][
'stroke'])) {
 
16974                                                $dom[$key][
'stroke'] = $this->
getHTMLUnitToUnits($dom[$key][
'attribute'][
'stroke'], $dom[$key][
'fontsize'], 
'pt', 
true);
 
16976                                        if (isset($dom[$key][
'attribute'][
'fill'])) {
 
16978                                                if ($dom[$key][
'attribute'][
'fill'] == 
'true') {
 
16979                                                        $dom[$key][
'fill'] = 
true;
 
16981                                                        $dom[$key][
'fill'] = 
false;
 
16984                                        if (isset($dom[$key][
'attribute'][
'clip'])) {
 
16986                                                if ($dom[$key][
'attribute'][
'clip'] == 
'true') {
 
16987                                                        $dom[$key][
'clip'] = 
true;
 
16989                                                        $dom[$key][
'clip'] = 
false;
 
16995                                $dom[$key][
'tag'] = 
false;
 
16996                                $dom[$key][
'block'] = 
false;
 
16997                                $dom[$key][
'parent'] = end($level);
 
16998                                $dom[$key][
'dir'] = $dom[$dom[$key][
'parent']][
'dir'];
 
16999                                if (!empty($dom[$dom[$key][
'parent']][
'text-transform'])) {
 
17001                                        if (function_exists(
'mb_convert_case')) {
 
17002                                                $ttm = array(
'capitalize' => MB_CASE_TITLE, 
'uppercase' => MB_CASE_UPPER, 
'lowercase' => MB_CASE_LOWER);
 
17003                                                if (isset($ttm[$dom[$dom[$key][
'parent']][
'text-transform']])) {
 
17004                                                        $element = mb_convert_case($element, $ttm[$dom[$dom[$key][
'parent']][
'text-transform']], $this->encoding);
 
17006                                        } elseif (!$this->isunicode) {
 
17007                                                switch ($dom[$dom[$key][
'parent']][
'text-transform']) {
 
17008                                                        case 'capitalize': {
 
17009                                                                $element = ucwords(strtolower($element));
 
17012                                                        case 'uppercase': {
 
17013                                                                $element = strtoupper($element);
 
17016                                                        case 'lowercase': {
 
17017                                                                $element = strtolower($element);
 
17023                                $dom[$key][
'value'] = stripslashes($this->
unhtmlentities($element));
 
17039                $spacestr = chr(32);
 
17041                        $spacestr = chr(0).chr(32);
 
17053                return md5(strlen(
$data).$this->file_id.$data);
 
17063                $encoded = urlencode(json_encode(
$data));
 
17074                $hash = substr(
$data, 0, 32);
 
17075                $encoded = substr(
$data, 32);
 
17077                        $this->
Error(
'Invalid parameters');
 
17079                return json_decode(urldecode($encoded), 
true);
 
17104        public function writeHTMLCell(
$w, 
$h, 
$x, 
$y, 
$html=
'', 
$border=0, $ln=0, $fill=
false, $reseth=
true, $align=
'', $autopadding=
true) {
 
17105                return $this->
MultiCell(
$w, 
$h, 
$html, 
$border, $align, $fill, $ln, 
$x, 
$y, $reseth, 0, 
true, $autopadding, 0, 
'T', 
false);
 
17121        public function writeHTML(
$html, $ln=
true, $fill=
false, $reseth=
false, $cell=
false, $align=
'') {
 
17132                $curfontascent = $this->
getFontAscent($curfontname, $curfontstyle, $curfontsize);
 
17133                $curfontdescent = $this->
getFontDescent($curfontname, $curfontstyle, $curfontsize);
 
17136                $this->newline = 
true;
 
17140                $maxbottomliney = 0;
 
17146                $this_method_vars = array();
 
17148                $fontaligned = 
false;
 
17149                $reverse_dir = 
false; 
 
17150                $this->premode = 
false;
 
17151                if ($this->inxobj) {
 
17153                        $pask = count($this->xobjects[$this->xobjid][
'annotations']);
 
17154                } elseif (isset($this->PageAnnots[$this->page])) {
 
17155                        $pask = count($this->PageAnnots[$this->page]);
 
17159                if ($this->inxobj) {
 
17161                        $startlinepos = strlen($this->xobjects[$this->xobjid][
'outdata']);
 
17162                } elseif (!$this->InFooter) {
 
17163                        if (isset($this->footerlen[$this->page])) {
 
17180                $w -= ($this->cell_padding[
'L'] + $this->cell_padding[
'R']);
 
17183                                $this->x -= $this->cell_padding[
'R'];
 
17184                                $this->lMargin += $this->cell_padding[
'R'];
 
17186                                $this->x += $this->cell_padding[
'L'];
 
17187                                $this->rMargin += $this->cell_padding[
'L'];
 
17190                if ($this->customlistindent >= 0) {
 
17195                $this->listindentlevel = 0;
 
17202                $this->listnum = 0;
 
17203                $this->listordered = array();
 
17204                $this->listcount = array();
 
17205                $this->lispacer = 
'';
 
17211                $maxel = count($dom);
 
17213                while ($key < $maxel) {
 
17214                        if ($dom[$key][
'tag'] AND $dom[$key][
'opening'] AND $dom[$key][
'hide']) {
 
17216                                $hidden_node_key = $key;
 
17217                                if ($dom[$key][
'self']) {
 
17222                                        while (($key < $maxel) AND (!$dom[$key][
'tag'] OR $dom[$key][
'opening'] OR ($dom[$key][
'parent'] != $hidden_node_key))) {
 
17229                        if ($dom[$key][
'tag'] AND isset($dom[$key][
'attribute'][
'pagebreak'])) {
 
17231                                if (($dom[$key][
'attribute'][
'pagebreak'] == 
'true') OR ($dom[$key][
'attribute'][
'pagebreak'] == 
'left') OR ($dom[$key][
'attribute'][
'pagebreak'] == 
'right')) {
 
17234                                        $this->htmlvspace = ($this->PageBreakTrigger + 1);
 
17236                                if ((($dom[$key][
'attribute'][
'pagebreak'] == 
'left') AND (((!$this->rtl) AND (($this->page % 2) == 0)) OR (($this->rtl) AND (($this->page % 2) != 0))))
 
17237                                        OR (($dom[$key][
'attribute'][
'pagebreak'] == 
'right') AND (((!$this->rtl) AND (($this->page % 2) != 0)) OR (($this->rtl) AND (($this->page % 2) == 0))))) {
 
17240                                        $this->htmlvspace = ($this->PageBreakTrigger + 1);
 
17243                        if ($dom[$key][
'tag'] AND $dom[$key][
'opening'] AND isset($dom[$key][
'attribute'][
'nobr']) AND ($dom[$key][
'attribute'][
'nobr'] == 
'true')) {
 
17244                                if (isset($dom[($dom[$key][
'parent'])][
'attribute'][
'nobr']) AND ($dom[($dom[$key][
'parent'])][
'attribute'][
'nobr'] == 
'true')) {
 
17245                                        $dom[$key][
'attribute'][
'nobr'] = 
false;
 
17250                                        $this_method_vars[
'html'] = 
$html;
 
17251                                        $this_method_vars[
'ln'] = $ln;
 
17252                                        $this_method_vars[
'fill'] = $fill;
 
17253                                        $this_method_vars[
'reseth'] = $reseth;
 
17254                                        $this_method_vars[
'cell'] = $cell;
 
17255                                        $this_method_vars[
'align'] = $align;
 
17256                                        $this_method_vars[
'gvars'] = $gvars;
 
17257                                        $this_method_vars[
'prevPage'] = $prevPage;
 
17258                                        $this_method_vars[
'prev_cell_margin'] = $prev_cell_margin;
 
17259                                        $this_method_vars[
'prev_cell_padding'] = $prev_cell_padding;
 
17260                                        $this_method_vars[
'prevlMargin'] = $prevlMargin;
 
17261                                        $this_method_vars[
'prevrMargin'] = $prevrMargin;
 
17262                                        $this_method_vars[
'curfontname'] = $curfontname;
 
17263                                        $this_method_vars[
'curfontstyle'] = $curfontstyle;
 
17264                                        $this_method_vars[
'curfontsize'] = $curfontsize;
 
17265                                        $this_method_vars[
'curfontascent'] = $curfontascent;
 
17266                                        $this_method_vars[
'curfontdescent'] = $curfontdescent;
 
17267                                        $this_method_vars[
'curfontstretcing'] = $curfontstretcing;
 
17268                                        $this_method_vars[
'curfonttracking'] = $curfonttracking;
 
17269                                        $this_method_vars[
'minstartliney'] = $minstartliney;
 
17270                                        $this_method_vars[
'maxbottomliney'] = $maxbottomliney;
 
17271                                        $this_method_vars[
'yshift'] = $yshift;
 
17272                                        $this_method_vars[
'startlinepage'] = $startlinepage;
 
17273                                        $this_method_vars[
'startlinepos'] = $startlinepos;
 
17274                                        $this_method_vars[
'startlinex'] = $startlinex;
 
17275                                        $this_method_vars[
'startliney'] = $startliney;
 
17276                                        $this_method_vars[
'newline'] = 
$newline;
 
17277                                        $this_method_vars[
'loop'] = $loop;
 
17278                                        $this_method_vars[
'curpos'] = $curpos;
 
17279                                        $this_method_vars[
'pask'] = $pask;
 
17280                                        $this_method_vars[
'lalign'] = $lalign;
 
17281                                        $this_method_vars[
'plalign'] = $plalign;
 
17282                                        $this_method_vars[
'w'] = 
$w;
 
17283                                        $this_method_vars[
'prev_cell_height_ratio'] = $prev_cell_height_ratio;
 
17284                                        $this_method_vars[
'prev_listnum'] = $prev_listnum;
 
17285                                        $this_method_vars[
'prev_listordered'] = $prev_listordered;
 
17286                                        $this_method_vars[
'prev_listcount'] = $prev_listcount;
 
17287                                        $this_method_vars[
'prev_lispacer'] = $prev_lispacer;
 
17288                                        $this_method_vars[
'fontaligned'] = $fontaligned;
 
17289                                        $this_method_vars[
'key'] = $key;
 
17290                                        $this_method_vars[
'dom'] = $dom;
 
17294                        if (($dom[$key][
'value'] == 
'tr') AND isset($dom[$key][
'thead']) AND $dom[$key][
'thead']) {
 
17295                                if (isset($dom[$key][
'parent']) AND isset($dom[$dom[$key][
'parent']][
'thead']) AND !
TCPDF_STATIC::empty_string($dom[$dom[$key][
'parent']][
'thead'])) {
 
17296                                        $this->inthead = 
true;
 
17298                                        $this->
writeHTML($this->thead, 
false, 
false, 
false, 
false, 
'');
 
17300                                        if (($this->y < $this->start_transaction_y) OR ($this->
checkPageBreak($this->lasth, 
'', 
false))) {
 
17305                                                foreach ($this_method_vars as $vkey => $vval) {
 
17313                                                if ((!$this->
checkPageBreak($this->PageBreakTrigger + 1)) AND ($this->y < $pre_y)) {
 
17318                                                $this->start_transaction_y = 
$this->y;
 
17320                                                $this->thead = $tmp_thead;
 
17322                                                if (isset($dom[$dom[$key][
'parent']][
'attribute'][
'cellspacing'])) {
 
17323                                                        $tmp_cellspacing = $this->
getHTMLUnitToUnits($dom[$dom[$key][
'parent']][
'attribute'][
'cellspacing'], 1, 
'px');
 
17324                                                } elseif (isset($dom[$dom[$key][
'parent']][
'border-spacing'])) {
 
17325                                                        $tmp_cellspacing = $dom[$dom[$key][
'parent']][
'border-spacing'][
'V'];
 
17327                                                        $tmp_cellspacing = 0;
 
17329                                                $dom[$dom[$key][
'parent']][
'borderposition'][
'page'] = 
$this->page;
 
17331                                                $dom[$dom[$key][
'parent']][
'borderposition'][
'y'] = $this->y + $tmp_cellspacing;
 
17332                                                $xoffset = ($this->x - $dom[$dom[$key][
'parent']][
'borderposition'][
'x']);
 
17333                                                $dom[$dom[$key][
'parent']][
'borderposition'][
'x'] += $xoffset;
 
17334                                                $dom[$dom[$key][
'parent']][
'borderposition'][
'xmax'] += $xoffset;
 
17336                                                $this->
writeHTML($this->thead, 
false, 
false, 
false, 
false, 
'');
 
17340                                while ( ($key < $maxel) AND (!(
 
17341                                        ($dom[$key][
'tag'] AND $dom[$key][
'opening'] AND ($dom[$key][
'value'] == 
'tr') AND (!isset($dom[$key][
'thead']) OR !$dom[$key][
'thead']))
 
17342                                        OR ($dom[$key][
'tag'] AND (!$dom[$key][
'opening']) AND ($dom[$key][
'value'] == 
'table'))) )) {
 
17346                        if ($dom[$key][
'tag'] OR ($key == 0)) {
 
17347                                if ((($dom[$key][
'value'] == 
'table') OR ($dom[$key][
'value'] == 
'tr')) AND (isset($dom[$key][
'align']))) {
 
17348                                        $dom[$key][
'align'] = (
$this->rtl) ? 
'R' : 
'L';
 
17351                                if ((!$this->newline) AND ($dom[$key][
'value'] == 
'img') AND (isset($dom[$key][
'height'])) AND ($dom[$key][
'height'] > 0)) {
 
17353                                        $imgh = $this->
getHTMLUnitToUnits($dom[$key][
'height'], ($dom[$key][
'fontsize'] / $this->k), 
'px');
 
17354                                        $autolinebreak = 
false;
 
17355                                        if (!empty($dom[$key][
'width'])) {
 
17356                                                $imgw = $this->
getHTMLUnitToUnits($dom[$key][
'width'], ($dom[$key][
'fontsize'] / $this->k), 
'px', 
false);
 
17357                                                if (($imgw <= ($this->w - $this->lMargin - $this->rMargin - $this->cell_padding[
'L'] - $this->cell_padding[
'R']))
 
17358                                                        AND ((($this->rtl) AND (($this->x - $imgw) < ($this->lMargin + $this->cell_padding[
'L'])))
 
17359                                                        OR ((!$this->rtl) AND (($this->x + $imgw) > ($this->w - $this->rMargin - $this->cell_padding[
'R']))))) {
 
17361                                                        $autolinebreak = 
true;
 
17362                                                        $this->
Ln(
'', $cell);
 
17363                                                        if ((!$dom[($key-1)][
'tag']) AND ($dom[($key-1)][
'value'] == 
' ')) {
 
17369                                        if (!$autolinebreak) {
 
17378                                                if ($this->page > $startlinepage) {
 
17380                                                        if (isset($this->footerlen[$startlinepage])) {
 
17381                                                                $curpos = $this->pagelen[$startlinepage] - $this->footerlen[$startlinepage];
 
17385                                                        $linebeg = substr($pagebuff, $startlinepos, ($curpos - $startlinepos));
 
17386                                                        $tstart = substr($pagebuff, 0, $startlinepos);
 
17387                                                        $tend = substr($this->
getPageBuffer($startlinepage), $curpos);
 
17391                                                        $tstart = substr($pagebuff, 0, $this->cntmrk[$this->page]);
 
17392                                                        $tend = substr($pagebuff, $this->cntmrk[$this->page]);
 
17394                                                        $yshift = ($minstartliney - 
$this->y);
 
17395                                                        if ($fontaligned) {
 
17396                                                                $yshift += ($curfontsize / 
$this->k);
 
17398                                                        $try = sprintf(
'1 0 0 1 0 %F cm', ($yshift * $this->k));
 
17399                                                        $this->
setPageBuffer($this->page, $tstart.
"\nq\n".$try.
"\n".$linebeg.
"\nQ\n".$tend);
 
17401                                                        if (isset($this->PageAnnots[$this->page])) {
 
17402                                                                $next_pask = count($this->PageAnnots[$this->page]);
 
17406                                                        if (isset($this->PageAnnots[$startlinepage])) {
 
17407                                                                foreach ($this->PageAnnots[$startlinepage] as $pak => $pac) {
 
17408                                                                        if ($pak >= $pask) {
 
17410                                                                                unset($this->PageAnnots[$startlinepage][$pak]);
 
17411                                                                                $npak = count($this->PageAnnots[$this->page]) - 1;
 
17412                                                                                $this->PageAnnots[
$this->page][$npak][
'y'] -= $yshift;
 
17416                                                        $pask = $next_pask;
 
17420                                                        $this->newline = 
false;
 
17423                                                $minstartliney = min($this->y, $minstartliney);
 
17424                                                $maxbottomliney = ($startliney + $this->
getCellHeight($curfontsize / $this->k));
 
17426                                } elseif (isset($dom[$key][
'fontname']) OR isset($dom[$key][
'fontstyle']) OR isset($dom[$key][
'fontsize']) OR isset($dom[$key][
'line-height'])) {
 
17428                                        $pfontname = $curfontname;
 
17429                                        $pfontstyle = $curfontstyle;
 
17430                                        $pfontsize = $curfontsize;
 
17431                                        $fontname = (isset($dom[$key][
'fontname']) ? $dom[$key][
'fontname'] : $curfontname);
 
17432                                        $fontstyle = (isset($dom[$key][
'fontstyle']) ? $dom[$key][
'fontstyle'] : $curfontstyle);
 
17433                                        $fontsize = (isset($dom[$key][
'fontsize']) ? $dom[$key][
'fontsize'] : $curfontsize);
 
17434                                        $fontascent = $this->
getFontAscent($fontname, $fontstyle, $fontsize);
 
17435                                        $fontdescent = $this->
getFontDescent($fontname, $fontstyle, $fontsize);
 
17436                                        if (($fontname != $curfontname) OR ($fontstyle != $curfontstyle) OR ($fontsize != $curfontsize)
 
17437                                                OR ($this->cell_height_ratio != $dom[$key][
'line-height'])
 
17438                                                OR ($dom[$key][
'tag'] AND $dom[$key][
'opening'] AND ($dom[$key][
'value'] == 
'li')) ) {
 
17439                                                if (($key < ($maxel - 1)) AND (
 
17440                                                                ($dom[$key][
'tag'] AND $dom[$key][
'opening'] AND ($dom[$key][
'value'] == 
'li'))
 
17441                                                                OR ($this->cell_height_ratio != $dom[$key][
'line-height'])
 
17442                                                                OR (!$this->newline AND is_numeric($fontsize) AND is_numeric($curfontsize)
 
17443                                                                AND ($fontsize >= 0) AND ($curfontsize >= 0)
 
17444                                                                AND (($fontsize != $curfontsize) OR ($fontstyle != $curfontstyle) OR ($fontname != $curfontname)))
 
17446                                                        if ($this->page > $startlinepage) {
 
17448                                                                if (isset($this->footerlen[$startlinepage])) {
 
17449                                                                        $curpos = $this->pagelen[$startlinepage] - $this->footerlen[$startlinepage];
 
17453                                                                $linebeg = substr($pagebuff, $startlinepos, ($curpos - $startlinepos));
 
17454                                                                $tstart = substr($pagebuff, 0, $startlinepos);
 
17455                                                                $tend = substr($this->
getPageBuffer($startlinepage), $curpos);
 
17459                                                                $tstart = substr($pagebuff, 0, $this->cntmrk[$this->page]);
 
17460                                                                $tend = substr($pagebuff, $this->cntmrk[$this->page]);
 
17462                                                                $yshift = ($minstartliney - 
$this->y);
 
17463                                                                $try = sprintf(
'1 0 0 1 0 %F cm', ($yshift * $this->k));
 
17464                                                                $this->
setPageBuffer($this->page, $tstart.
"\nq\n".$try.
"\n".$linebeg.
"\nQ\n".$tend);
 
17466                                                                if (isset($this->PageAnnots[$this->page])) {
 
17467                                                                        $next_pask = count($this->PageAnnots[$this->page]);
 
17471                                                                if (isset($this->PageAnnots[$startlinepage])) {
 
17472                                                                        foreach ($this->PageAnnots[$startlinepage] as $pak => $pac) {
 
17473                                                                                if ($pak >= $pask) {
 
17475                                                                                        unset($this->PageAnnots[$startlinepage][$pak]);
 
17476                                                                                        $npak = count($this->PageAnnots[$this->page]) - 1;
 
17477                                                                                        $this->PageAnnots[
$this->page][$npak][
'y'] -= $yshift;
 
17481                                                                $pask = $next_pask;
 
17486                                                        if (!isset($dom[$key][
'line-height'])) {
 
17489                                                        if (!$dom[$key][
'block']) {
 
17490                                                                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']))) {
 
17491                                                                        $this->y += (((($curfontsize * 
$this->cell_height_ratio) - ($fontsize * $dom[$key][
'line-height'])) / $this->k) + $curfontascent - $fontascent - $curfontdescent + $fontdescent) / 2;
 
17493                                                                if (($dom[$key][
'value'] != 
'sup') AND ($dom[$key][
'value'] != 
'sub')) {
 
17494                                                                        $current_line_align_data = array($key, $minstartliney, $maxbottomliney);
 
17495                                                                        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)))) {
 
17496                                                                                $minstartliney = min($this->y, $line_align_data[1]);
 
17497                                                                                $maxbottomliney = max(($this->y + $this->
getCellHeight($fontsize / $this->k)), $line_align_data[2]);
 
17499                                                                                $minstartliney = min($this->y, $minstartliney);
 
17500                                                                                $maxbottomliney = max(($this->y + $this->
getCellHeight($fontsize / $this->k)), $maxbottomliney);
 
17502                                                                        $line_align_data = $current_line_align_data;
 
17505                                                        $this->cell_height_ratio = $dom[$key][
'line-height'];
 
17506                                                        $fontaligned = 
true;
 
17508                                                $this->
SetFont($fontname, $fontstyle, $fontsize);
 
17511                                                $curfontname = $fontname;
 
17512                                                $curfontstyle = $fontstyle;
 
17513                                                $curfontsize = $fontsize;
 
17514                                                $curfontascent = $fontascent;
 
17515                                                $curfontdescent = $fontdescent;
 
17520                                $textfill = isset($dom[$key][
'fill']) ? $dom[$key][
'fill'] : (($this->textrendermode % 2) == 0);
 
17521                                $textclip = isset($dom[$key][
'clip']) ? $dom[$key][
'clip'] : ($this->textrendermode > 3);
 
17523                                if (isset($dom[$key][
'font-stretch']) AND ($dom[$key][
'font-stretch'] !== 
false)) {
 
17526                                if (isset($dom[$key][
'letter-spacing']) AND ($dom[$key][
'letter-spacing'] !== 
false)) {
 
17529                                if (($plalign == 
'J') AND $dom[$key][
'block']) {
 
17533                                $curpos = $this->pagelen[$startlinepage];
 
17534                                if (isset($dom[$key][
'bgcolor']) AND ($dom[$key][
'bgcolor'] !== 
false)) {
 
17538                                        $wfill = $fill | 
false;
 
17540                                if (isset($dom[$key][
'fgcolor']) AND ($dom[$key][
'fgcolor'] !== 
false)) {
 
17543                                if (isset($dom[$key][
'strokecolor']) AND ($dom[$key][
'strokecolor'] !== 
false)) {
 
17546                                if (isset($dom[$key][
'align'])) {
 
17547                                        $lalign = $dom[$key][
'align'];
 
17554                        if ($this->newline AND (strlen($dom[$key][
'value']) > 0) AND ($dom[$key][
'value'] != 
'td') AND ($dom[$key][
'value'] != 
'th')) {
 
17556                                $fontaligned = 
false;
 
17558                                if (isset($startlinex)) {
 
17559                                        $yshift = ($minstartliney - $startliney);
 
17560                                        if (($yshift > 0) OR ($this->page > $startlinepage)) {
 
17565                                        $linew = abs($this->endlinex - $startlinex);
 
17566                                        if ($this->inxobj) {
 
17568                                                $pstart = substr($this->xobjects[$this->xobjid][
'outdata'], 0, $startlinepos);
 
17569                                                if (isset($opentagpos)) {
 
17570                                                        $midpos = $opentagpos;
 
17575                                                        $pmid = substr($this->xobjects[$this->xobjid][
'outdata'], $startlinepos, ($midpos - $startlinepos));
 
17576                                                        $pend = substr($this->xobjects[$this->xobjid][
'outdata'], $midpos);
 
17578                                                        $pmid = substr($this->xobjects[$this->xobjid][
'outdata'], $startlinepos);
 
17582                                                $pstart = substr($this->
getPageBuffer($startlinepage), 0, $startlinepos);
 
17583                                                if (isset($opentagpos) AND isset($this->footerlen[$startlinepage]) AND (!$this->InFooter)) {
 
17584                                                        $this->footerpos[$startlinepage] = $this->pagelen[$startlinepage] - $this->footerlen[$startlinepage];
 
17585                                                        $midpos = min($opentagpos, $this->footerpos[$startlinepage]);
 
17586                                                } elseif (isset($opentagpos)) {
 
17587                                                        $midpos = $opentagpos;
 
17588                                                } elseif (isset($this->footerlen[$startlinepage]) AND (!$this->InFooter)) {
 
17589                                                        $this->footerpos[$startlinepage] = $this->pagelen[$startlinepage] - $this->footerlen[$startlinepage];
 
17590                                                        $midpos = $this->footerpos[$startlinepage];
 
17595                                                        $pmid = substr($this->
getPageBuffer($startlinepage), $startlinepos, ($midpos - $startlinepos));
 
17596                                                        $pend = substr($this->
getPageBuffer($startlinepage), $midpos);
 
17598                                                        $pmid = substr($this->
getPageBuffer($startlinepage), $startlinepos);
 
17602                                        if ((isset($plalign) AND ((($plalign == 
'C') OR ($plalign == 
'J') OR (($plalign == 
'R') AND (!$this->rtl)) OR (($plalign == 
'L') AND ($this->rtl)))))) {
 
17605                                                if (($plalign == 
'J') AND $this->
isRTLTextDir() AND ($this->num_columns > 1)) {
 
17606                                                        $tw += $this->cell_padding[
'R'];
 
17608                                                if ($this->lMargin != $prevlMargin) {
 
17611                                                if ($this->rMargin != $prevrMargin) {
 
17620                                                                $pos1 = intval($pos1);
 
17628                                                                if ($pos1 == $pos2) {
 
17629                                                                        $pmid = substr($pmid, 0, ($pos1 + 2)).substr($pmid, ($pos1 + 2 + $spacelen));
 
17630                                                                        if (substr($pmid, $pos1, 4) == 
'[()]') {
 
17631                                                                                $linew -= $one_space_width;
 
17632                                                                        } elseif ($pos1 == strpos($pmid, 
'[(')) {
 
17641                                                                $pos1 = intval($pos1);
 
17649                                                                if ($pos1 == $pos2) {
 
17650                                                                        $pmid = substr($pmid, 0, ($pos1 - $spacelen)).substr($pmid, $pos1);
 
17651                                                                        $linew -= $one_space_width;
 
17655                                                $mdiff = ($tw - $linew);
 
17656                                                if ($plalign == 
'C') {
 
17658                                                                $t_x = -($mdiff / 2);
 
17660                                                                $t_x = ($mdiff / 2);
 
17662                                                } elseif ($plalign == 
'R') {
 
17665                                                } elseif ($plalign == 
'L') {
 
17668                                                } elseif (($plalign == 
'J') AND ($plalign == $lalign)) {
 
17677                                                        $pmidtemp = preg_replace(
'/[\\\][\(]/x', 
'\\#!#OP#!#', $pmidtemp);
 
17678                                                        $pmidtemp = preg_replace(
'/[\\\][\)]/x', 
'\\#!#CP#!#', $pmidtemp);
 
17680                                                        if (preg_match_all(
'/\[\(([^\)]*)\)\]/x', $pmidtemp, $lnstring, PREG_PATTERN_ORDER)) {
 
17682                                                                $maxkk = count($lnstring[1]) - 1;
 
17683                                                                for ($kk=0; $kk <= $maxkk; ++$kk) {
 
17685                                                                        $lnstring[1][$kk] = str_replace(
'#!#OP#!#', 
'(', $lnstring[1][$kk]);
 
17686                                                                        $lnstring[1][$kk] = str_replace(
'#!#CP#!#', 
')', $lnstring[1][$kk]);
 
17688                                                                        $lnstring[2][$kk] = substr_count($lnstring[1][$kk], $spacestr);
 
17690                                                                        $ns += $lnstring[2][$kk];
 
17691                                                                        $lnstring[3][$kk] = $ns;
 
17697                                                                $spacewidth = ($mdiff / ($ns - $no)) * 
$this->k;
 
17698                                                                if ($this->FontSize <= 0) {
 
17699                                                                        $this->FontSize = 1;
 
17701                                                                $spacewidthu = -1000 * ($mdiff + (($ns + $no) * $one_space_width)) / $ns / $this->FontSize;
 
17702                                                                if ($this->font_spacing != 0) {
 
17705                                                                        $spacewidthu += $osw;
 
17712                                                                $prev_epsposbeg = 0;
 
17717                                                                while (preg_match(
'/([0-9\.\+\-]*)[\s](Td|cm|m|l|c|re)[\s]/x', $pmid, $strpiece, PREG_OFFSET_CAPTURE, $offset) == 1) {
 
17719                                                                        $stroffset = strpos($pmid, 
'[(', $offset);
 
17720                                                                        if (($stroffset !== 
false) AND ($stroffset <= $strpiece[2][1])) {
 
17722                                                                                $offset = strpos($pmid, 
')]', $stroffset);
 
17723                                                                                while (($offset !== 
false) AND ($pmid[($offset - 1)] == 
'\\')) {
 
17724                                                                                        $offset = strpos($pmid, 
')]', ($offset + 1));
 
17726                                                                                if ($offset === 
false) {
 
17727                                                                                        $this->
Error(
'HTML Justification: malformed PDF code.');
 
17732                                                                                $spacew = ($spacewidth * ($nsmax - $ns));
 
17734                                                                                $spacew = ($spacewidth * $ns);
 
17736                                                                        $offset = $strpiece[2][1] + strlen($strpiece[2][0]);
 
17737                                                                        $epsposend = strpos($pmid, $this->epsmarker.
'Q', $offset);                              
 
17738                                                                        if ($epsposend !== 
null) {
 
17739                                                                                $epsposend += strlen($this->epsmarker.
'Q');
 
17740                                                                                $epsposbeg = strpos($pmid, 
'q'.$this->epsmarker, $offset);
 
17741                                                                                if ($epsposbeg === 
null) {
 
17742                                                                                        $epsposbeg = strpos($pmid, 
'q'.$this->epsmarker, ($prev_epsposbeg - 6));
 
17743                                                                                        $prev_epsposbeg = $epsposbeg;
 
17745                                                                                if (($epsposbeg > 0) AND ($epsposend > 0) AND ($offset > $epsposbeg) AND ($offset < $epsposend)) {
 
17747                                                                                        $trx = sprintf(
'1 0 0 1 %F 0 cm', $spacew);
 
17748                                                                                        $pmid_b = substr($pmid, 0, $epsposbeg);
 
17749                                                                                        $pmid_m = substr($pmid, $epsposbeg, ($epsposend - $epsposbeg));
 
17750                                                                                        $pmid_e = substr($pmid, $epsposend);
 
17751                                                                                        $pmid = $pmid_b.
"\nq\n".$trx.
"\n".$pmid_m.
"\nQ\n".$pmid_e;
 
17752                                                                                        $offset = $epsposend;
 
17758                                                                        switch ($strpiece[2][0]) {
 
17764                                                                                        preg_match(
'/([0-9\.\+\-]*)[\s]('.$strpiece[1][0].
')[\s]('.$strpiece[2][0].
')([\s]*)/x', $pmid, $xmatches);
 
17765                                                                                        if (!isset($xmatches[1])) {
 
17768                                                                                        $currentxpos = $xmatches[1];
 
17769                                                                                        $textpos = $currentxpos;
 
17770                                                                                        if (($strcount <= $maxkk) AND ($strpiece[2][0] == 
'Td')) {
 
17771                                                                                                $ns = $lnstring[3][$strcount];
 
17773                                                                                                        $spacew = ($spacewidth * ($nsmax - $ns));
 
17778                                                                                        if (preg_match(
'/([0-9\.\+\-]*)[\s]('.$strpiece[1][0].
')[\s]('.$strpiece[2][0].
')([\s]*)/x', $pmid, $pmatch) == 1) {
 
17779                                                                                                $newpmid = sprintf(
'%F',(floatval($pmatch[1]) + $spacew)).
' '.$pmatch[2].
' x*#!#*x'.$pmatch[3].$pmatch[4];
 
17780                                                                                                $pmid = str_replace($pmatch[0], $newpmid, $pmid);
 
17781                                                                                                unset($pmatch, $newpmid);
 
17788                                                                                                $this->lispacer = 
'';
 
17791                                                                                        preg_match(
'/([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]([0-9\.\+\-]*)[\s]('.$strpiece[1][0].
')[\s](re)([\s]*)/x', $pmid, $xmatches);
 
17792                                                                                        if (!isset($xmatches[1])) {
 
17795                                                                                        $currentxpos = $xmatches[1];
 
17799                                                                                                if ($currentxpos < $textpos) {
 
17800                                                                                                        $x_diff = ($spacewidth * ($nsmax - $lnstring[3][$strcount]));
 
17801                                                                                                        $w_diff = ($spacewidth * $lnstring[2][$strcount]);
 
17803                                                                                                        if ($strcount > 0) {
 
17804                                                                                                                $x_diff = ($spacewidth * ($nsmax - $lnstring[3][($strcount - 1)]));
 
17805                                                                                                                $w_diff = ($spacewidth * $lnstring[2][($strcount - 1)]);
 
17809                                                                                                if ($currentxpos > $textpos) {
 
17810                                                                                                        if ($strcount > 0) {
 
17811                                                                                                                $x_diff = ($spacewidth * $lnstring[3][($strcount - 1)]);
 
17813                                                                                                        $w_diff = ($spacewidth * $lnstring[2][$strcount]);
 
17815                                                                                                        if ($strcount > 1) {
 
17816                                                                                                                $x_diff = ($spacewidth * $lnstring[3][($strcount - 2)]);
 
17818                                                                                                        if ($strcount > 0) {
 
17819                                                                                                                $w_diff = ($spacewidth * $lnstring[2][($strcount - 1)]);
 
17823                                                                                        if (preg_match(
'/('.$xmatches[1].
')[\s]('.$xmatches[2].
')[\s]('.$xmatches[3].
')[\s]('.$strpiece[1][0].
')[\s](re)([\s]*)/x', $pmid, $pmatch) == 1) {
 
17824                                                                                                $newx = sprintf(
'%F',(floatval($pmatch[1]) + $x_diff));
 
17825                                                                                                $neww = sprintf(
'%F',(floatval($pmatch[3]) + $w_diff));
 
17826                                                                                                $newpmid = $newx.
' '.$pmatch[2].
' '.$neww.
' '.$pmatch[4].
' x*#!#*x'.$pmatch[5].$pmatch[6];
 
17827                                                                                                $pmid = str_replace($pmatch[0], $newpmid, $pmid);
 
17828                                                                                                unset($pmatch, $newpmid, $newx, $neww);
 
17834                                                                                        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);
 
17835                                                                                        if (!isset($xmatches[1])) {
 
17838                                                                                        $currentxpos = $xmatches[1];
 
17840                                                                                        if (preg_match(
'/('.$xmatches[1].
')[\s]('.$xmatches[2].
')[\s]('.$xmatches[3].
')[\s]('.$xmatches[4].
')[\s]('.$xmatches[5].
')[\s]('.$strpiece[1][0].
')[\s](c)([\s]*)/x', $pmid, $pmatch) == 1) {
 
17841                                                                                                $newx1 = sprintf(
'%F',(floatval($pmatch[1]) + $spacew));
 
17842                                                                                                $newx2 = sprintf(
'%F',(floatval($pmatch[3]) + $spacew));
 
17843                                                                                                $newx3 = sprintf(
'%F',(floatval($pmatch[5]) + $spacew));
 
17844                                                                                                $newpmid = $newx1.
' '.$pmatch[2].
' '.$newx2.
' '.$pmatch[4].
' '.$newx3.
' '.$pmatch[6].
' x*#!#*x'.$pmatch[7].$pmatch[8];
 
17845                                                                                                $pmid = str_replace($pmatch[0], $newpmid, $pmid);
 
17846                                                                                                unset($pmatch, $newpmid, $newx1, $newx2, $newx3);
 
17852                                                                        $cxpos = ($currentxpos / 
$this->k);
 
17853                                                                        $lmpos = ($this->lMargin + $this->cell_padding[
'L'] + 
$this->feps);
 
17854                                                                        if ($this->inxobj) {
 
17856                                                                                foreach ($this->xobjects[$this->xobjid][
'annotations'] as $pak => $pac) {
 
17857                                                                                        if (($pac[
'y'] >= $minstartliney) AND (($pac[
'x'] * $this->k) >= ($currentxpos - $this->feps)) AND (($pac[
'x'] * $this->k) <= ($currentxpos + $this->feps))) {
 
17858                                                                                                if ($cxpos > $lmpos) {
 
17860                                                                                                        $this->xobjects[
$this->xobjid][
'annotations'][$pak][
'w'] += (($spacewidth * $pac[
'numspaces']) / $this->k);
 
17862                                                                                                        $this->xobjects[
$this->xobjid][
'annotations'][$pak][
'w'] += (($spacewidth * $pac[
'numspaces']) / $this->k);
 
17867                                                                        } elseif (isset($this->PageAnnots[$this->page])) {
 
17868                                                                                foreach ($this->PageAnnots[$this->page] as $pak => $pac) {
 
17869                                                                                        if (($pac[
'y'] >= $minstartliney) AND (($pac[
'x'] * $this->k) >= ($currentxpos - $this->feps)) AND (($pac[
'x'] * $this->k) <= ($currentxpos + $this->feps))) {
 
17870                                                                                                if ($cxpos > $lmpos) {
 
17872                                                                                                        $this->PageAnnots[
$this->page][$pak][
'w'] += (($spacewidth * $pac[
'numspaces']) / $this->k);
 
17874                                                                                                        $this->PageAnnots[
$this->page][$pak][
'w'] += (($spacewidth * $pac[
'numspaces']) / $this->k);
 
17882                                                                $pmid = str_replace(
'x*#!#*x', 
'', $pmid);
 
17885                                                                        $spacew = $spacewidthu;
 
17886                                                                        if ($this->font_stretching != 100) {
 
17888                                                                                $spacew /= ($this->font_stretching / 100);
 
17892                                                                        $pmid = preg_replace(
'/[\\\][\(]/x', 
'\\#!#OP#!#', $pmid);
 
17893                                                                        $pmid = preg_replace(
'/[\\\][\)]/x', 
'\\#!#CP#!#', $pmid);
 
17894                                                                        if (preg_match_all(
'/\[\(([^\)]*)\)\]/x', $pmid, $pamatch) > 0) {
 
17895                                                                                foreach($pamatch[0] as $pk => $pmatch) {
 
17896                                                                                        $replace = $pamatch[1][$pk];
 
17897                                                                                        $replace = str_replace(
'#!#OP#!#', 
'(', $replace);
 
17898                                                                                        $replace = str_replace(
'#!#CP#!#', 
')', $replace);
 
17899                                                                                        $newpmid = 
'[('.str_replace(chr(0).chr(32), 
') '.sprintf(
'%F', $spacew).
' (', $replace).
')]';
 
17900                                                                                        $pos = strpos($pmid, $pmatch, $pos);
 
17901                                                                                        if ($pos !== FALSE) {
 
17902                                                                                                $pmid = substr_replace($pmid, $newpmid, $pos, strlen($pmatch));
 
17908                                                                        if ($this->inxobj) {
 
17910                                                                                $this->xobjects[
$this->xobjid][
'outdata'] = $pstart.
"\n".$pmid.
"\n".$pend;
 
17912                                                                                $this->
setPageBuffer($startlinepage, $pstart.
"\n".$pmid.
"\n".$pend);
 
17914                                                                        $endlinepos = strlen($pstart.
"\n".$pmid.
"\n");
 
17917                                                                        if ($this->font_stretching != 100) {
 
17919                                                                                $spacewidth /= ($this->font_stretching / 100);
 
17921                                                                        $rs = sprintf(
'%F Tw', $spacewidth);
 
17922                                                                        $pmid = preg_replace(
"/\[\(/x", $rs.
' [(', $pmid);
 
17923                                                                        if ($this->inxobj) {
 
17925                                                                                $this->xobjects[
$this->xobjid][
'outdata'] = $pstart.
"\n".$pmid.
"\nBT 0 Tw ET\n".$pend;
 
17927                                                                                $this->
setPageBuffer($startlinepage, $pstart.
"\n".$pmid.
"\nBT 0 Tw ET\n".$pend);
 
17929                                                                        $endlinepos = strlen($pstart.
"\n".$pmid.
"\nBT 0 Tw ET\n");
 
17934                                        if (($t_x != 0) OR ($yshift < 0)) {
 
17936                                                $trx = sprintf(
'1 0 0 1 %F %F cm', ($t_x * $this->k), ($yshift * $this->k));
 
17937                                                $pstart .= 
"\nq\n".$trx.
"\n".$pmid.
"\nQ\n";
 
17938                                                $endlinepos = strlen($pstart);
 
17939                                                if ($this->inxobj) {
 
17942                                                        foreach ($this->xobjects[$this->xobjid][
'annotations'] as $pak => $pac) {
 
17943                                                                if ($pak >= $pask) {
 
17944                                                                        $this->xobjects[
$this->xobjid][
'annotations'][$pak][
'x'] += $t_x;
 
17945                                                                        $this->xobjects[
$this->xobjid][
'annotations'][$pak][
'y'] -= $yshift;
 
17951                                                        if (isset($this->PageAnnots[$this->page])) {
 
17952                                                                foreach ($this->PageAnnots[$this->page] as $pak => $pac) {
 
17953                                                                        if ($pak >= $pask) {
 
17954                                                                                $this->PageAnnots[
$this->page][$pak][
'x'] += $t_x;
 
17955                                                                                $this->PageAnnots[
$this->page][$pak][
'y'] -= $yshift;
 
17960                                                $this->y -= $yshift;
 
17964                                $this->newline = 
false;
 
17967                                if ($dom[$dom[$key][
'parent']][
'value'] == 
'sup') {
 
17969                                } elseif ($dom[$dom[$key][
'parent']][
'value'] == 
'sub') {
 
17970                                        $startliney -= (($this->FontSizePt / 0.7) / 
$this->k);
 
17972                                        $minstartliney = $startliney;
 
17973                                        $maxbottomliney = ($this->y + $this->
getCellHeight($fontsize / $this->k));
 
17976                                if (isset($endlinepos) AND (!$pbrk)) {
 
17977                                        $startlinepos = $endlinepos;
 
17979                                        if ($this->inxobj) {
 
17981                                                $startlinepos = strlen($this->xobjects[$this->xobjid][
'outdata']);
 
17982                                        } elseif (!$this->InFooter) {
 
17983                                                if (isset($this->footerlen[$this->page])) {
 
17993                                unset($endlinepos);
 
17994                                $plalign = $lalign;
 
17995                                if (isset($this->PageAnnots[$this->page])) {
 
17996                                        $pask = count($this->PageAnnots[$this->page]);
 
18000                                if (!($dom[$key][
'tag'] AND !$dom[$key][
'opening'] AND ($dom[$key][
'value'] == 
'table')
 
18001                                        AND (isset($this->emptypagemrk[$this->page]))
 
18002                                        AND ($this->emptypagemrk[$this->page] == $this->pagelen[$this->page]))) {
 
18003                                        $this->
SetFont($fontname, $fontstyle, $fontsize);
 
18009                        if (isset($opentagpos)) {
 
18010                                unset($opentagpos);
 
18012                        if ($dom[$key][
'tag']) {
 
18013                                if ($dom[$key][
'opening']) {
 
18015                                        if (isset($dom[$key][
'text-indent']) AND $dom[$key][
'block']) {
 
18016                                                $this->textindent = $dom[$key][
'text-indent'];
 
18017                                                $this->newline = 
true;
 
18020                                        if (($dom[$key][
'value'] == 
'table') AND isset($dom[$key][
'cols']) AND ($dom[$key][
'cols'] > 0)) {
 
18025                                                        $wtmp = $this->w - $this->rMargin - 
$this->x;
 
18028                                                if (isset($dom[$key][
'attribute'][
'cellspacing'])) {
 
18030                                                        $cellspacing = array(
'H' => $clsp, 
'V' => $clsp);
 
18031                                                } elseif (isset($dom[$key][
'border-spacing'])) {
 
18032                                                        $cellspacing = $dom[$key][
'border-spacing'];
 
18034                                                        $cellspacing = array(
'H' => 0, 
'V' => 0);
 
18037                                                if (isset($dom[$key][
'width'])) {
 
18040                                                        $table_width = $wtmp;
 
18042                                                $table_width -= (2 * $cellspacing[
'H']);
 
18043                                                if (!$this->inthead) {
 
18044                                                        $this->y += $cellspacing[
'V'];
 
18047                                                        $cellspacingx = -$cellspacing[
'H'];
 
18049                                                        $cellspacingx = $cellspacing[
'H'];
 
18052                                                $table_columns_width = ($table_width - ($cellspacing[
'H'] * ($dom[$key][
'cols'] - 1)));
 
18054                                                $table_min_column_width = ($table_columns_width / $dom[$key][
'cols']);
 
18056                                                $table_colwidths = array_fill(0, $dom[$key][
'cols'], $table_min_column_width);
 
18059                                        if ($dom[$key][
'value'] == 
'tr') {
 
18064                                        if (($dom[$key][
'value'] == 
'td') OR ($dom[$key][
'value'] == 
'th')) {
 
18065                                                $trid = $dom[$key][
'parent'];
 
18066                                                $table_el = $dom[$trid][
'parent'];
 
18067                                                if (!isset($dom[$table_el][
'cols'])) {
 
18068                                                        $dom[$table_el][
'cols'] = $dom[$trid][
'cols'];
 
18072                                                if (isset($dom[$key][
'border']) AND !empty($dom[$key][
'border'])) {
 
18073                                                        $tdborder = $dom[$key][
'border'];
 
18075                                                $colspan = intval($dom[$key][
'attribute'][
'colspan']);
 
18076                                                if ($colspan <= 0) {
 
18080                                                if (isset($dom[($dom[$trid][
'parent'])][
'attribute'][
'cellpadding'])) {
 
18081                                                        $crclpd = $this->
getHTMLUnitToUnits($dom[($dom[$trid][
'parent'])][
'attribute'][
'cellpadding'], 1, 
'px');
 
18082                                                        $current_cell_padding = array(
'L' => $crclpd, 
'T' => $crclpd, 
'R' => $crclpd, 
'B' => $crclpd);
 
18083                                                } elseif (isset($dom[($dom[$trid][
'parent'])][
'padding'])) {
 
18084                                                        $current_cell_padding = $dom[($dom[$trid][
'parent'])][
'padding'];
 
18086                                                        $current_cell_padding = array(
'L' => 0, 
'T' => 0, 
'R' => 0, 
'B' => 0);
 
18088                                                $this->cell_padding = $current_cell_padding;
 
18089                                                if (isset($dom[$key][
'height'])) {
 
18095                                                if (isset($dom[$key][
'content'])) {
 
18096                                                        $cell_content = $dom[$key][
'content'];
 
18098                                                        $cell_content = 
' ';
 
18100                                                $tagtype = $dom[$key][
'value'];
 
18102                                                while (($key < $maxel) AND (!(($dom[$key][
'tag']) AND (!$dom[$key][
'opening']) AND ($dom[$key][
'value'] == $tagtype) AND ($dom[$key][
'parent'] == $parentid)))) {
 
18106                                                if (!isset($dom[$trid][
'startpage'])) {
 
18109                                                        $this->
setPage($dom[$trid][
'startpage']);
 
18111                                                if (!isset($dom[$trid][
'startcolumn'])) {
 
18113                                                } elseif ($this->current_column != $dom[$trid][
'startcolumn']) {
 
18118                                                if (!isset($dom[$trid][
'starty'])) {
 
18121                                                        $this->y = $dom[$trid][
'starty'];
 
18123                                                if (!isset($dom[$trid][
'startx'])) {
 
18125                                                        $this->x += $cellspacingx;
 
18127                                                        $this->x += ($cellspacingx / 2);
 
18129                                                if (isset($dom[$parentid][
'attribute'][
'rowspan'])) {
 
18130                                                        $rowspan = intval($dom[$parentid][
'attribute'][
'rowspan']);
 
18135                                                if (isset($dom[$table_el][
'rowspans'])) {
 
18137                                                        $rskmax = count($dom[$table_el][
'rowspans']);
 
18138                                                        while ($rsk < $rskmax) {
 
18139                                                                $trwsp = $dom[$table_el][
'rowspans'][$rsk];
 
18140                                                                $rsstartx = $trwsp[
'startx'];
 
18141                                                                $rsendx = $trwsp[
'endx'];
 
18143                                                                if ($trwsp[
'startpage'] < $this->page) {
 
18144                                                                        if (($this->rtl) AND ($this->pagedim[$this->page][
'orm'] != $this->pagedim[$trwsp[
'startpage']][
'orm'])) {
 
18145                                                                                $dl = ($this->pagedim[
$this->page][
'orm'] - $this->pagedim[$trwsp[
'startpage']][
'orm']);
 
18148                                                                        } elseif ((!$this->rtl) AND ($this->pagedim[$this->page][
'olm'] != $this->pagedim[$trwsp[
'startpage']][
'olm'])) {
 
18149                                                                                $dl = ($this->pagedim[
$this->page][
'olm'] - $this->pagedim[$trwsp[
'startpage']][
'olm']);
 
18154                                                                if (($trwsp[
'rowspan'] > 0)
 
18155                                                                        AND ($rsstartx > ($this->x - $cellspacing[
'H'] - $current_cell_padding[
'L'] - $this->feps))
 
18156                                                                        AND ($rsstartx < ($this->x + $cellspacing[
'H'] + $current_cell_padding[
'R'] + $this->feps))
 
18157                                                                        AND (($trwsp[
'starty'] < ($this->y - $this->feps)) OR ($trwsp[
'startpage'] < $this->page) OR ($trwsp[
'startcolumn'] < $this->current_column))) {
 
18159                                                                        $this->x = $rsendx + $cellspacingx;
 
18161                                                                        $colid += $trwsp[
'colspan'];
 
18162                                                                        if (($trwsp[
'rowspan'] == 1)
 
18163                                                                                AND (isset($dom[$trid][
'endy']))
 
18164                                                                                AND (isset($dom[$trid][
'endpage']))
 
18165                                                                                AND (isset($dom[$trid][
'endcolumn']))
 
18166                                                                                AND ($trwsp[
'endpage'] == $dom[$trid][
'endpage'])
 
18167                                                                                AND ($trwsp[
'endcolumn'] == $dom[$trid][
'endcolumn'])) {
 
18169                                                                                $dom[$table_el][
'rowspans'][$rsk][
'endy'] = max($dom[$trid][
'endy'], $trwsp[
'endy']);
 
18170                                                                                $dom[$trid][
'endy'] = $dom[$table_el][
'rowspans'][$rsk][
'endy'];
 
18178                                                if (isset($dom[$parentid][
'width'])) {
 
18180                                                        $cellw = $this->
getHTMLUnitToUnits($dom[$parentid][
'width'], $table_columns_width, 
'px');
 
18181                                                        $tmpcw = ($cellw / $colspan);
 
18182                                                        for ($i = 0; $i < $colspan; ++$i) {
 
18183                                                                $table_colwidths[($colid + $i)] = $tmpcw;
 
18188                                                        for ($i = 0; $i < $colspan; ++$i) {
 
18189                                                                $cellw += (isset($table_colwidths[($colid + $i)]) ? $table_colwidths[($colid + $i)] : 0);
 
18192                                                $cellw += (($colspan - 1) * $cellspacing[
'H']);
 
18194                                                $colid += $colspan;
 
18196                                                if ($rowspan > 1) {
 
18197                                                        $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));
 
18199                                                $cellid = array_push($dom[$trid][
'cellpos'], array(
'startx' => $this->x));
 
18200                                                if ($rowspan > 1) {
 
18201                                                        $dom[$trid][
'cellpos'][($cellid - 1)][
'rowspanid'] = ($trsid - 1);
 
18204                                                if (isset($dom[$parentid][
'bgcolor']) AND ($dom[$parentid][
'bgcolor'] !== 
false)) {
 
18205                                                        $dom[$trid][
'cellpos'][($cellid - 1)][
'bgcolor'] = $dom[$parentid][
'bgcolor'];
 
18208                                                if (isset($tdborder) AND !empty($tdborder)) {
 
18209                                                        $dom[$trid][
'cellpos'][($cellid - 1)][
'border'] = $tdborder;
 
18218                                                $this->colxshift[
's'] = $cellspacing;
 
18219                                                $this->colxshift[
'p'] = $current_cell_padding;
 
18221                                                $this->
MultiCell($cellw, $cellh, $cell_content, 
false, $lalign, 
false, 2, 
'', 
'', 
true, 0, 
true, 
true, 0, 
'T', 
false);
 
18223                                                $this->colxshift = array(
'x' => 0, 
's' => array(
'H' => 0, 
'V' => 0), 
'p' => array(
'L' => 0, 
'T' => 0, 
'R' => 0, 
'B' => 0));
 
18224                                                $this->lasth = $prevLastH;
 
18225                                                $this->cell_padding = $old_cell_padding;
 
18226                                                $dom[$trid][
'cellpos'][($cellid - 1)][
'endx'] = $this->x;
 
18228                                                if ($rowspan <= 1) {
 
18229                                                        if (isset($dom[$trid][
'endy'])) {
 
18230                                                                if (($this->page == $dom[$trid][
'endpage']) AND ($this->current_column == $dom[$trid][
'endcolumn'])) {
 
18231                                                                        $dom[$trid][
'endy'] = max($this->y, $dom[$trid][
'endy']);
 
18232                                                                } elseif (($this->page > $dom[$trid][
'endpage']) OR ($this->current_column > $dom[$trid][
'endcolumn'])) {
 
18238                                                        if (isset($dom[$trid][
'endpage'])) {
 
18239                                                                $dom[$trid][
'endpage'] = max($this->page, $dom[$trid][
'endpage']);
 
18243                                                        if (isset($dom[$trid][
'endcolumn'])) {
 
18244                                                                $dom[$trid][
'endcolumn'] = max($this->current_column, $dom[$trid][
'endcolumn']);
 
18250                                                        $dom[$table_el][
'rowspans'][($trsid - 1)][
'endx'] = $this->x;
 
18251                                                        $dom[$table_el][
'rowspans'][($trsid - 1)][
'endy'] = $this->y;
 
18252                                                        $dom[$table_el][
'rowspans'][($trsid - 1)][
'endpage'] = $this->page;
 
18253                                                        $dom[$table_el][
'rowspans'][($trsid - 1)][
'endcolumn'] = $this->current_column;
 
18255                                                if (isset($dom[$table_el][
'rowspans'])) {
 
18257                                                        foreach ($dom[$table_el][
'rowspans'] as 
$k => $trwsp) {
 
18258                                                                if ($trwsp[
'rowspan'] > 0) {
 
18259                                                                        if (isset($dom[$trid][
'endpage'])) {
 
18260                                                                                if (($trwsp[
'endpage'] == $dom[$trid][
'endpage']) AND ($trwsp[
'endcolumn'] == $dom[$trid][
'endcolumn'])) {
 
18261                                                                                        $dom[$table_el][
'rowspans'][
$k][
'endy'] = max($dom[$trid][
'endy'], $trwsp[
'endy']);
 
18262                                                                                } elseif (($trwsp[
'endpage'] < $dom[$trid][
'endpage']) OR ($trwsp[
'endcolumn'] < $dom[$trid][
'endcolumn'])) {
 
18263                                                                                        $dom[$table_el][
'rowspans'][
$k][
'endy'] = $dom[$trid][
'endy'];
 
18264                                                                                        $dom[$table_el][
'rowspans'][
$k][
'endpage'] = $dom[$trid][
'endpage'];
 
18265                                                                                        $dom[$table_el][
'rowspans'][
$k][
'endcolumn'] = $dom[$trid][
'endcolumn'];
 
18267                                                                                        $dom[$trid][
'endy'] = $this->pagedim[$dom[$trid][
'endpage']][
'hk'] - $this->pagedim[$dom[$trid][
'endpage']][
'bm'];
 
18273                                                $this->x += ($cellspacingx / 2);
 
18276                                                if (!isset($opentagpos)) {
 
18277                                                        if ($this->inxobj) {
 
18279                                                                $opentagpos = strlen($this->xobjects[$this->xobjid][
'outdata']);
 
18280                                                        } elseif (!$this->InFooter) {
 
18281                                                                if (isset($this->footerlen[$this->page])) {
 
18295                                        if ($this->bordermrk[$this->page] > $old_bordermrk) {
 
18296                                                $startlinepos += ($this->bordermrk[
$this->page] - $old_bordermrk);
 
18298                                        if ($prev_numpages > $this->numpages) {
 
18302                        } elseif (strlen($dom[$key][
'value']) > 0) {
 
18305                                        $this->
SetFont($pfontname, $pfontstyle, $pfontsize);
 
18308                                        $maxbottomliney = ($startliney + $this->
getCellHeight($this->FontSize));
 
18309                                        if (is_numeric($pfontsize) AND ($pfontsize > 0)) {
 
18312                                        $this->
SetFont($curfontname, $curfontstyle, $curfontsize);
 
18314                                        if (is_numeric($pfontsize) AND ($pfontsize > 0) AND is_numeric($curfontsize) AND ($curfontsize > 0) AND ($pfontsize != $curfontsize)) {
 
18315                                                $pfontascent = $this->
getFontAscent($pfontname, $pfontstyle, $pfontsize);
 
18316                                                $pfontdescent = $this->
getFontDescent($pfontname, $pfontstyle, $pfontsize);
 
18317                                                $this->y += ($this->
getCellHeight(($pfontsize - $curfontsize) / $this->k) + $pfontascent - $curfontascent - $pfontdescent + $curfontdescent) / 2;
 
18318                                                $minstartliney = min($this->y, $minstartliney);
 
18319                                                $maxbottomliney = max(($this->y + $this->
getCellHeight($pfontsize / $this->k)), $maxbottomliney);
 
18323                                $this->htmlvspace = 0;
 
18328                                        if (preg_match(
'/^('.$this->re_space[
'p'].
'+)/'.$this->re_space[
'm'], $dom[$key][
'value'], $matches)) {
 
18329                                                $lsp = $matches[1];
 
18331                                        if (preg_match(
'/('.$this->re_space[
'p'].
'+)$/'.$this->re_space[
'm'], $dom[$key][
'value'], $matches)) {
 
18332                                                $rsp = $matches[1];
 
18334                                        $dom[$key][
'value'] = $rsp.$this->stringTrim($dom[$key][
'value']).$lsp;
 
18337                                        if (!$this->premode) {
 
18338                                                $prelen = strlen($dom[$key][
'value']);
 
18344                                                        $dom[$key][
'value'] = $this->
stringLeftTrim($dom[$key][
'value']);
 
18346                                                $postlen = strlen($dom[$key][
'value']);
 
18347                                                if (($postlen == 0) AND ($prelen > 0)) {
 
18348                                                        $dom[$key][
'trimmed_space'] = 
true;
 
18352                                        $firstblock = 
true;
 
18354                                        $firstblock = 
false;
 
18356                                        $dom[$key][
'value'] = preg_replace(
'/^'.$this->re_space[
'p'].
'+$/'.$this->re_space[
'm'], chr(32), $dom[$key][
'value']);
 
18364                                if (!isset($dom[$key][
'trimmed_space']) OR !$dom[$key][
'trimmed_space']) {
 
18366                                        if (!empty($this->HREF) AND (isset($this->HREF[
'url']))) {
 
18369                                                if (isset($dom[($dom[$key][
'parent'])][
'fgcolor']) AND ($dom[($dom[$key][
'parent'])][
'fgcolor'] !== 
false)) {
 
18370                                                        $hrefcolor = $dom[($dom[$key][
'parent'])][
'fgcolor'];
 
18373                                                if (isset($dom[($dom[$key][
'parent'])][
'fontstyle']) AND ($dom[($dom[$key][
'parent'])][
'fontstyle'] !== 
false)) {
 
18374                                                        $hrefstyle = $dom[($dom[$key][
'parent'])][
'fontstyle'];
 
18376                                                $strrest = $this->
addHtmlLink($this->HREF[
'url'], $dom[$key][
'value'], $wfill, 
true, $hrefcolor, $hrefstyle, 
true);
 
18382                                                        $cwa = ($this->w - $this->rMargin - 
$this->x);
 
18384                                                if (($strlinelen < $cwa) AND (isset($dom[($key + 1)])) AND ($dom[($key + 1)][
'tag']) AND (!$dom[($key + 1)][
'block'])) {
 
18386                                                        $nkey = ($key + 1);
 
18387                                                        $write_block = 
true;
 
18388                                                        $same_textdir = 
true;
 
18392                                                        while ($write_block AND isset($dom[$nkey])) {
 
18393                                                                if ($dom[$nkey][
'tag']) {
 
18394                                                                        if ($dom[$nkey][
'block']) {
 
18396                                                                                $write_block = 
false;
 
18398                                                                        $tmp_fontname = isset($dom[$nkey][
'fontname']) ? $dom[$nkey][
'fontname'] : 
$this->FontFamily;
 
18399                                                                        $tmp_fontstyle = isset($dom[$nkey][
'fontstyle']) ? $dom[$nkey][
'fontstyle'] : 
$this->FontStyle;
 
18400                                                                        $tmp_fontsize = isset($dom[$nkey][
'fontsize']) ? $dom[$nkey][
'fontsize'] : 
$this->FontSizePt;
 
18401                                                                        $same_textdir = ($dom[$nkey][
'dir'] == $dom[$key][
'dir']);
 
18403                                                                        $nextstr = 
TCPDF_STATIC::pregSplit(
'/'.$this->re_space[
'p'].
'+/', $this->re_space[
'm'], $dom[$nkey][
'value']);
 
18404                                                                        if (isset($nextstr[0]) AND $same_textdir) {
 
18405                                                                                $wadj += $this->
GetStringWidth($nextstr[0], $tmp_fontname, $tmp_fontstyle, $tmp_fontsize);
 
18406                                                                                if (isset($nextstr[1])) {
 
18407                                                                                        $write_block = 
false;
 
18414                                                if (($wadj > 0) AND (($strlinelen + $wadj) >= $cwa)) {
 
18417                                                        $numblks = count($nextstr);
 
18418                                                        if ($numblks > 1) {
 
18420                                                                $wadj = ($cwa - $strlinelen + $this->
GetStringWidth($nextstr[($numblks - 1)]));
 
18427                                                if (($wadj > 0) AND (($this->rtl AND ($this->tmprtl === 
'L')) OR (!$this->rtl AND ($this->tmprtl === 
'R')))) {
 
18429                                                        $reverse_dir = 
true;
 
18431                                                        $revshift = ($strlinelen + $wadj + 0.000001); 
 
18433                                                                $this->x += $revshift;
 
18435                                                                $this->x -= $revshift;
 
18440                                                $strrest = $this->
Write($this->lasth, $dom[$key][
'value'], 
'', $wfill, 
'', 
false, 0, 
true, $firstblock, 0, $wadj);
 
18442                                                if ($reverse_dir AND ($wadj == 0)) {
 
18445                                                        $reverse_dir = 
false;
 
18449                                $this->textindent = 0;
 
18450                                if (strlen($strrest) > 0) {
 
18452                                        $this->newline = 
true;
 
18453                                        if ($strrest == $dom[$key][
'value']) {
 
18459                                        $dom[$key][
'value'] = $strrest;
 
18462                                                        $this->x -= $this->cell_padding[
'R'];
 
18464                                                        $this->x += $this->cell_padding[
'L'];
 
18473                                         if ($this->font_spacing > 0) {
 
18483                        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')) {
 
18485                                if ((!$undo) AND (($this->y < $this->start_transaction_y) OR (($dom[$key][
'value'] == 
'tr') AND ($dom[($dom[$key][
'parent'])][
'endy'] < $this->start_transaction_y)))) {
 
18490                                        foreach ($this_method_vars as $vkey => $vval) {
 
18493                                        if (!empty($dom[$key][
'thead'])) {
 
18494                                                $this->inthead = 
true;
 
18498                                        if ((!$this->
checkPageBreak($this->PageBreakTrigger + 1)) AND ($this->y < $pre_y)) {
 
18508                if (isset($startlinex)) {
 
18509                        $yshift = ($minstartliney - $startliney);
 
18510                        if (($yshift > 0) OR ($this->page > $startlinepage)) {
 
18515                        $linew = abs($this->endlinex - $startlinex);
 
18516                        if ($this->inxobj) {
 
18518                                $pstart = substr($this->xobjects[$this->xobjid][
'outdata'], 0, $startlinepos);
 
18519                                if (isset($opentagpos)) {
 
18520                                        $midpos = $opentagpos;
 
18525                                        $pmid = substr($this->xobjects[$this->xobjid][
'outdata'], $startlinepos, ($midpos - $startlinepos));
 
18526                                        $pend = substr($this->xobjects[$this->xobjid][
'outdata'], $midpos);
 
18528                                        $pmid = substr($this->xobjects[$this->xobjid][
'outdata'], $startlinepos);
 
18532                                $pstart = substr($this->
getPageBuffer($startlinepage), 0, $startlinepos);
 
18533                                if (isset($opentagpos) AND isset($this->footerlen[$startlinepage]) AND (!$this->InFooter)) {
 
18534                                        $this->footerpos[$startlinepage] = $this->pagelen[$startlinepage] - $this->footerlen[$startlinepage];
 
18535                                        $midpos = min($opentagpos, $this->footerpos[$startlinepage]);
 
18536                                } elseif (isset($opentagpos)) {
 
18537                                        $midpos = $opentagpos;
 
18538                                } elseif (isset($this->footerlen[$startlinepage]) AND (!$this->InFooter)) {
 
18539                                        $this->footerpos[$startlinepage] = $this->pagelen[$startlinepage] - $this->footerlen[$startlinepage];
 
18540                                        $midpos = $this->footerpos[$startlinepage];
 
18545                                        $pmid = substr($this->
getPageBuffer($startlinepage), $startlinepos, ($midpos - $startlinepos));
 
18546                                        $pend = substr($this->
getPageBuffer($startlinepage), $midpos);
 
18548                                        $pmid = substr($this->
getPageBuffer($startlinepage), $startlinepos);
 
18552                        if ((isset($plalign) AND ((($plalign == 
'C') OR (($plalign == 
'R') AND (!$this->rtl)) OR (($plalign == 
'L') AND ($this->rtl)))))) {
 
18555                                if ($this->lMargin != $prevlMargin) {
 
18558                                if ($this->rMargin != $prevrMargin) {
 
18567                                                $pos1 = intval($pos1);
 
18575                                                if ($pos1 == $pos2) {
 
18576                                                        $pmid = substr($pmid, 0, ($pos1 + 2)).substr($pmid, ($pos1 + 2 + $spacelen));
 
18577                                                        if (substr($pmid, $pos1, 4) == 
'[()]') {
 
18578                                                                $linew -= $one_space_width;
 
18579                                                        } elseif ($pos1 == strpos($pmid, 
'[(')) {
 
18588                                                $pos1 = intval($pos1);
 
18596                                                if ($pos1 == $pos2) {
 
18597                                                        $pmid = substr($pmid, 0, ($pos1 - $spacelen)).substr($pmid, $pos1);
 
18598                                                        $linew -= $one_space_width;
 
18602                                $mdiff = ($tw - $linew);
 
18603                                if ($plalign == 
'C') {
 
18605                                                $t_x = -($mdiff / 2);
 
18607                                                $t_x = ($mdiff / 2);
 
18609                                } elseif ($plalign == 
'R') {
 
18612                                } elseif ($plalign == 
'L') {
 
18617                        if (($t_x != 0) OR ($yshift < 0)) {
 
18619                                $trx = sprintf(
'1 0 0 1 %F %F cm', ($t_x * $this->k), ($yshift * $this->k));
 
18620                                $pstart .= 
"\nq\n".$trx.
"\n".$pmid.
"\nQ\n";
 
18621                                $endlinepos = strlen($pstart);
 
18622                                if ($this->inxobj) {
 
18625                                        foreach ($this->xobjects[$this->xobjid][
'annotations'] as $pak => $pac) {
 
18626                                                if ($pak >= $pask) {
 
18627                                                        $this->xobjects[
$this->xobjid][
'annotations'][$pak][
'x'] += $t_x;
 
18628                                                        $this->xobjects[
$this->xobjid][
'annotations'][$pak][
'y'] -= $yshift;
 
18634                                        if (isset($this->PageAnnots[$this->page])) {
 
18635                                                foreach ($this->PageAnnots[$this->page] as $pak => $pac) {
 
18636                                                        if ($pak >= $pask) {
 
18637                                                                $this->PageAnnots[
$this->page][$pak][
'x'] += $t_x;
 
18638                                                                $this->PageAnnots[
$this->page][$pak][
'y'] -= $yshift;
 
18643                                $this->y -= $yshift;
 
18649                if ($this->num_columns > 1) {
 
18651                } elseif ($this->page > $prevPage) {
 
18652                        $this->lMargin = $this->pagedim[
$this->page][
'olm'];
 
18653                        $this->rMargin = $this->pagedim[
$this->page][
'orm'];
 
18656                $this->cell_height_ratio = $prev_cell_height_ratio;
 
18657                $this->listnum = $prev_listnum;
 
18658                $this->listordered = $prev_listordered;
 
18659                $this->listcount = $prev_listcount;
 
18660                $this->lispacer = $prev_lispacer;
 
18661                if ($ln AND (!($cell AND ($dom[$key-1][
'value'] == 
'table')))) {
 
18662                        $this->
Ln($this->lasth);
 
18663                        if (($this->y < $maxbottomliney) AND ($startlinepage == $this->page)) {
 
18664                                $this->y = $maxbottomliney;
 
18680                $parent = $dom[($dom[$key][
'parent'])];
 
18681                $firsttag = ($key == 1);
 
18683                if (isset($tag[
'dir'])) {
 
18686                        $this->tmprtl = 
false;
 
18688                if ($tag[
'block']) {
 
18692                        if (isset($this->tagvspaces[$tag[
'value']][0][
'h']) AND ($this->tagvspaces[$tag[
'value']][0][
'h'] >= 0)) {
 
18693                                $cur_h = $this->tagvspaces[$tag[
'value']][0][
'h'];
 
18694                        } elseif (isset($tag[
'fontsize'])) {
 
18695                                $cur_h = $this->
getCellHeight($tag[
'fontsize'] / $this->k);
 
18699                        if (isset($this->tagvspaces[$tag[
'value']][0][
'n'])) {
 
18700                                $on = $this->tagvspaces[$tag[
'value']][0][
'n'];
 
18701                        } elseif (preg_match(
'/[h][0-9]/', $tag[
'value']) > 0) {
 
18706                        if ((!isset($this->tagvspaces[$tag[
'value']])) AND (in_array($tag[
'value'], array(
'div', 
'dt', 
'dd', 
'li', 
'br', 
'hr')))) {
 
18709                                $hb = ($on * $cur_h);
 
18711                        if (($this->htmlvspace <= 0) AND ($on > 0)) {
 
18712                                if (isset($parent[
'fontsize'])) {
 
18713                                        $hbz = (($parent[
'fontsize'] / 
$this->k) * $this->cell_height_ratio);
 
18718                        if (isset($dom[($key - 1)]) AND ($dom[($key - 1)][
'value'] == 
'table')) {
 
18724                        if (isset($this->tagvspaces[$tag[
'value']][1][
'h']) AND ($this->tagvspaces[$tag[
'value']][1][
'h'] >= 0)) {
 
18725                                $pre_h = $this->tagvspaces[$tag[
'value']][1][
'h'];
 
18726                        } elseif (isset($parent[
'fontsize'])) {
 
18727                                $pre_h = $this->
getCellHeight($parent[
'fontsize'] / $this->k);
 
18731                        if (isset($this->tagvspaces[$tag[
'value']][1][
'n'])) {
 
18732                                $cn = $this->tagvspaces[$tag[
'value']][1][
'n'];
 
18733                        } elseif (preg_match(
'/[h][0-9]/', $tag[
'value']) > 0) {
 
18738                        if (isset($this->tagvspaces[$tag[
'value']][1])) {
 
18739                                $hbc = ($cn * $pre_h);
 
18743                switch($tag[
'value']) {
 
18747                                $dom[$key][
'rowspans'] = array();
 
18748                                if (!isset($dom[$key][
'attribute'][
'nested']) OR ($dom[$key][
'attribute'][
'nested'] != 
'true')) {
 
18749                                        $this->htmlvspace = 0;
 
18753                                                $this->thead = $dom[$key][
'thead'];
 
18754                                                if (!isset($this->theadMargins) OR (empty($this->theadMargins))) {
 
18755                                                        $this->theadMargins = array();
 
18760                                                        $this->theadMargins[
'cell'] = $cell;
 
18767                                if (isset($tag[
'attribute'][
'cellpadding'])) {
 
18770                                } elseif (isset($tag[
'padding'])) {
 
18771                                        $this->cell_padding = $tag[
'padding'];
 
18773                                if (isset($tag[
'attribute'][
'cellspacing'])) {
 
18775                                } elseif (isset($tag[
'border-spacing'])) {
 
18776                                        $cs = $tag[
'border-spacing'][
'V'];
 
18779                                if ($this->
checkPageBreak(((2 * $cp) + (2 * $cs) + $this->lasth), 
'', 
false) OR ($this->y < $prev_y)) {
 
18780                                        $this->inthead = 
true;
 
18788                                $dom[$key][
'cellpos'] = array();
 
18792                                if ((isset($tag[
'height'])) AND ($tag[
'height'] != 
'')) {
 
18797                                $this->
addHTMLVertSpace($hbz, max($hb, ($hrHeight / 2)), $cell, $firsttag);
 
18802                                        $wtmp -= ($this->cell_padding[
'L'] + $this->cell_padding[
'R']);
 
18804                                if ((isset($tag[
'width'])) AND ($tag[
'width'] != 
'')) {
 
18813                                $this->
addHTMLVertSpace(max($hbc, ($hrHeight / 2)), 0, $cell, !isset($dom[($key + 1)]));
 
18817                                if (array_key_exists(
'href', $tag[
'attribute'])) {
 
18818                                        $this->HREF[
'url'] = $tag[
'attribute'][
'href'];
 
18823                                if (!empty($tag[
'attribute'][
'src'])) {
 
18824                                        if ($tag[
'attribute'][
'src'][0] === 
'@') {
 
18826                                                $tag[
'attribute'][
'src'] = 
'@'.base64_decode(substr($tag[
'attribute'][
'src'], 1));
 
18832                                        if (!isset($tag[
'width'])) {
 
18835                                        if (!isset($tag[
'height'])) {
 
18836                                                $tag[
'height'] = 0;
 
18841                                                $tag[
'attribute'][
'align'] = 
'bottom';
 
18843                                        switch($tag[
'attribute'][
'align']) {
 
18865                                                $imglink = $this->HREF[
'url'];
 
18866                                                if ($imglink[0] == 
'#') {
 
18868                                                        $lnkdata = explode(
',', $imglink);
 
18869                                                        if (isset($lnkdata[0])) {
 
18870                                                                $page = intval(substr($lnkdata[0], 1));
 
18874                                                                if (isset($lnkdata[1]) AND (strlen($lnkdata[1]) > 0)) {
 
18875                                                                        $lnky = floatval($lnkdata[1]);
 
18885                                        if (isset($tag[
'border']) AND !empty($tag[
'border'])) {
 
18890                                        if (isset($tag[
'width'])) {
 
18891                                                $iw = $this->
getHTMLUnitToUnits($tag[
'width'], ($tag[
'fontsize'] / $this->k), 
'px', 
false);
 
18894                                        if (isset($tag[
'height'])) {
 
18895                                                $ih = $this->
getHTMLUnitToUnits($tag[
'height'], ($tag[
'fontsize'] / $this->k), 
'px', 
false);
 
18897                                        if (($type == 
'eps') OR ($type == 
'ai')) {
 
18898                                                $this->
ImageEps($tag[
'attribute'][
'src'], $xpos, $this->y, $iw, $ih, $imglink, 
true, $align, 
'', 
$border, 
true);
 
18899                                        } elseif ($type == 
'svg') {
 
18900                                                $this->
ImageSVG($tag[
'attribute'][
'src'], $xpos, $this->y, $iw, $ih, $imglink, $align, 
'', 
$border, 
true);
 
18902                                                $this->
Image($tag[
'attribute'][
'src'], $xpos, $this->y, $iw, $ih, 
'', $imglink, $align, 
false, 300, 
'', 
false, 
false, 
$border, 
false, 
false, 
true);
 
18910                                                        $this->y = (($this->img_rb_y + $prevy - ($this->
getCellHeight($tag[
'fontsize'] / $this->k))) / 2);
 
18923                                if ($this->listnum == 1) {
 
18947                                if ($tag[
'value'] == 
'ol') {
 
18952                                if (isset($tag[
'attribute'][
'start'])) {
 
18953                                        $this->listcount[
$this->listnum] = intval($tag[
'attribute'][
'start']) - 1;
 
18965                                if ($this->listnum == 1) {
 
18978                                if ($this->listordered[$this->listnum]) {
 
18981                                                $this->lispacer = $parent[
'attribute'][
'type'];
 
18983                                                $this->lispacer = $parent[
'listtype'];
 
18987                                                $this->lispacer = 
'#';
 
18990                                        if (isset($tag[
'attribute'][
'value'])) {
 
18991                                                $this->listcount[
$this->listnum] = intval($tag[
'attribute'][
'value']);
 
18996                                                $this->lispacer = $parent[
'attribute'][
'type'];
 
18998                                                $this->lispacer = $parent[
'listtype'];
 
19002                                                $this->lispacer = 
'!';
 
19007                        case 'blockquote': {
 
19031                                $this->premode = 
true;
 
19035                                $this->
SetXY($this->
GetX(), $this->
GetY() - ((0.7 * $this->FontSizePt) / $this->k));
 
19039                                $this->
SetXY($this->
GetX(), $this->
GetY() + ((0.3 * $this->FontSizePt) / $this->k));
 
19053                                if (isset($tag[
'attribute'][
'action'])) {
 
19054                                        $this->form_action = $tag[
'attribute'][
'action'];
 
19056                                        $this->
Error(
'Please explicitly set action attribute path!');
 
19058                                if (isset($tag[
'attribute'][
'enctype'])) {
 
19059                                        $this->form_enctype = $tag[
'attribute'][
'enctype'];
 
19061                                        $this->form_enctype = 
'application/x-www-form-urlencoded';
 
19063                                if (isset($tag[
'attribute'][
'method'])) {
 
19064                                        $this->form_mode = $tag[
'attribute'][
'method'];
 
19066                                        $this->form_mode = 
'post';
 
19072                                        $name = $tag[
'attribute'][
'name'];
 
19079                                        $prop[
'readonly'] = 
true;
 
19082                                        $value = $tag[
'attribute'][
'value'];
 
19085                                        $opt[
'maxlen'] = intval($tag[
'attribute'][
'maxlength']);
 
19089                                        $w = intval($tag[
'attribute'][
'size']) * $this->
GetStringWidth(chr(32)) * 2;
 
19093                                if (isset($tag[
'attribute'][
'checked']) AND (($tag[
'attribute'][
'checked'] == 
'checked') OR ($tag[
'attribute'][
'checked'] == 
'true'))) {
 
19098                                if (isset($tag[
'align'])) {
 
19099                                        switch ($tag[
'align']) {
 
19114                                switch ($tag[
'attribute'][
'type']) {
 
19116                                                if (isset($value)) {
 
19117                                                        $opt[
'v'] = $value;
 
19119                                                $this->
TextField($name, 
$w, 
$h, $prop, $opt, 
'', 
'', 
false);
 
19123                                                if (isset($value)) {
 
19124                                                        $opt[
'v'] = $value;
 
19126                                                $prop[
'password'] = 
'true';
 
19127                                                $this->
TextField($name, 
$w, 
$h, $prop, $opt, 
'', 
'', 
false);
 
19131                                                if (!isset($value)) {
 
19134                                                $this->
CheckBox($name, 
$w, $checked, $prop, $opt, $value, 
'', 
'', 
false);
 
19138                                                if (!isset($value)) {
 
19141                                                $this->
RadioButton($name, 
$w, $prop, $opt, $value, $checked, 
'', 
'', 
false);
 
19145                                                if (!isset($value)) {
 
19150                                                $prop = array(
'lineWidth'=>1, 
'borderStyle'=>
'beveled', 
'fillColor'=>array(196, 196, 196), 
'strokeColor'=>array(255, 255, 255));
 
19152                                                $action[
'S'] = 
'SubmitForm';
 
19154                                                if ($this->form_enctype != 
'FDF') {
 
19155                                                        $action[
'Flags'] = array(
'ExportFormat');
 
19157                                                if ($this->form_mode == 
'get') {
 
19158                                                        $action[
'Flags'] = array(
'GetMethod');
 
19160                                                $this->
Button($name, 
$w, 
$h, $value, $action, $prop, $opt, 
'', 
'', 
false);
 
19164                                                if (!isset($value)) {
 
19169                                                $prop = array(
'lineWidth'=>1, 
'borderStyle'=>
'beveled', 
'fillColor'=>array(196, 196, 196), 
'strokeColor'=>array(255, 255, 255));
 
19170                                                $this->
Button($name, 
$w, 
$h, $value, array(
'S'=>
'ResetForm'), $prop, $opt, 
'', 
'', 
false);
 
19174                                                $prop[
'fileSelect'] = 
'true';
 
19175                                                $this->
TextField($name, 
$w, 
$h, $prop, $opt, 
'', 
'', 
false);
 
19176                                                if (!isset($value)) {
 
19181                                                $prop = array(
'lineWidth'=>1, 
'borderStyle'=>
'beveled', 
'fillColor'=>array(196, 196, 196), 
'strokeColor'=>array(255, 255, 255));
 
19182                                                $jsaction = 
'var f=this.getField(\''.$name.
'\'); f.browseForFileToSubmit();
'; 
19183                                                $this->Button('FB_
'.$name, $w, $h, $value, $jsaction, $prop, $opt, '', '', false); 
19187                                                if (isset($value)) { 
19188                                                        $opt['v'] = $value; 
19190                                                $opt['f
'] = array('invisible
', 'hidden
'); 
19191                                                $this->TextField($name, 0, 0, $prop, $opt, '', '', false); 
19195                                                // THIS TYPE MUST BE FIXED 
19196                                                if (isset($tag['attribute
']['src
']) AND !TCPDF_STATIC::empty_string($tag['attribute
']['src
'])) { 
19197                                                        $img = $tag['attribute
']['src
']; 
19202                                                //$opt['mk
'] = array('i
'=>$img, 'tp
'=>1, 'if'=>array('sw
'=>'A
', 's
'=>'A
', 'fb
'=>false)); 
19203                                                if (isset($tag['attribute
']['onclick
']) AND !empty($tag['attribute
']['onclick
'])) { 
19204                                                        $jsaction = $tag['attribute
']['onclick
']; 
19208                                                $this->Button($name, $w, $h, $value, $jsaction, $prop, $opt, '', '', false); 
19212                                                if (!isset($value)) { 
19215                                                $w = $this->GetStringWidth($value) * 1.5; 
19217                                                $prop = array('lineWidth
'=>1, 'borderStyle
'=>'beveled
', 'fillColor
'=>array(196, 196, 196), 'strokeColor
'=>array(255, 255, 255)); 
19218                                                if (isset($tag['attribute
']['onclick
']) AND !empty($tag['attribute
']['onclick
'])) { 
19219                                                        $jsaction = $tag['attribute
']['onclick
']; 
19223                                                $this->Button($name, $w, $h, $value, $jsaction, $prop, $opt, '', '', false); 
19232                                if (isset($tag['attribute
']['readonly
']) AND !TCPDF_STATIC::empty_string($tag['attribute
']['readonly
'])) { 
19233                                        $prop['readonly
'] = true; 
19235                                if (isset($tag['attribute
']['name
']) AND !TCPDF_STATIC::empty_string($tag['attribute
']['name
'])) { 
19236                                        $name = $tag['attribute
']['name
']; 
19240                                if (isset($tag['attribute
']['value
']) AND !TCPDF_STATIC::empty_string($tag['attribute
']['value
'])) { 
19241                                        $opt['v'] = $tag['attribute
']['value
']; 
19243                                if (isset($tag['attribute
']['cols
']) AND !TCPDF_STATIC::empty_string($tag['attribute
']['cols
'])) { 
19244                                        $w = intval($tag['attribute
']['cols
']) * $this->GetStringWidth(chr(32)) * 2; 
19248                                if (isset($tag['attribute
']['rows
']) AND !TCPDF_STATIC::empty_string($tag['attribute
']['rows
'])) { 
19249                                        $h = intval($tag['attribute
']['rows
']) * $this->getCellHeight($this->FontSize); 
19253                                $prop['multiline
'] = 'true'; 
19254                                $this->TextField($name, $w, $h, $prop, $opt, '', '', false); 
19258                                $h = $this->getCellHeight($this->FontSize); 
19259                                if (isset($tag['attribute
']['size
']) AND !TCPDF_STATIC::empty_string($tag['attribute
']['size
'])) { 
19260                                        $h *= ($tag['attribute
']['size
'] + 1); 
19264                                if (isset($tag['attribute
']['name
']) AND !TCPDF_STATIC::empty_string($tag['attribute
']['name
'])) { 
19265                                        $name = $tag['attribute
']['name
']; 
19270                                if (isset($tag['attribute
']['opt
']) AND !TCPDF_STATIC::empty_string($tag['attribute
']['opt
'])) { 
19271                                        $options = explode('#!NwL!#
', $tag['attribute
']['opt
']); 
19273                                        foreach ($options as $val) { 
19274                                                if (strpos($val, '#!TaB!#
') !== false) { 
19275                                                        $opts = explode('#!TaB!#
', $val); 
19277                                                        $w = max($w, $this->GetStringWidth($opts[1])); 
19280                                                        $w = max($w, $this->GetStringWidth($val)); 
19287                                if (isset($tag['attribute
']['multiple
']) AND ($tag['attribute
']['multiple
']='multiple
')) { 
19288                                        $prop['multipleSelection
'] = 'true'; 
19289                                        $this->ListBox($name, $w, $h, $values, $prop, $opt, '', '', false); 
19291                                        $this->ComboBox($name, $w, $h, $values, $prop, $opt, '', '', false); 
19297                                        // Special tag used to call TCPDF methods 
19298                                        if (isset($tag['attribute
']['method
'])) { 
19299                                                $tcpdf_method = $tag['attribute
']['method
']; 
19300                                                if (method_exists($this, $tcpdf_method)) { 
19301                                                        if (isset($tag['attribute
']['params
']) AND (!empty($tag['attribute
']['params
']))) { 
19302                                                                $params = $this->unserializeTCPDFtagParameters($tag['attribute
']['params
']); 
19303                                                                call_user_func_array(array($this, $tcpdf_method), $params); 
19305                                                                $this->$tcpdf_method(); 
19307                                                        $this->newline = true; 
19317                // define tags that support borders and background colors 
19318                $bordertags = array('blockquote
','br
','dd
','dl
','div
','dt
','h1
','h2
','h3
','h4
','h5
','h6
','hr
','li
','ol
','p
','pre
','ul
','tcpdf
','table
'); 
19319                if (in_array($tag['value
'], $bordertags)) { 
19321                        $dom[$key]['borderposition
'] = $this->getBorderStartPosition(); 
19323                if ($dom[$key]['self'] AND isset($dom[$key]['attribute
']['pagebreakafter
'])) { 
19324                        $pba = $dom[$key]['attribute
']['pagebreakafter
']; 
19325                        // check for pagebreak 
19326                        if (($pba == 'true') OR ($pba == 'left
') OR ($pba == 'right
')) { 
19327                                // add a page (or trig AcceptPageBreak() for multicolumn mode) 
19328                                $this->checkPageBreak($this->PageBreakTrigger + 1); 
19330                        if ((($pba == 'left
') AND (((!$this->rtl) AND (($this->page % 2) == 0)) OR (($this->rtl) AND (($this->page % 2) != 0)))) 
19331                                OR (($pba == 'right
') AND (((!$this->rtl) AND (($this->page % 2) != 0)) OR (($this->rtl) AND (($this->page % 2) == 0))))) { 
19332                                // add a page (or trig AcceptPageBreak() for multicolumn mode) 
19333                                $this->checkPageBreak($this->PageBreakTrigger + 1); 
19348        protected function closeHTMLTagHandler($dom, $key, $cell, $maxbottomliney=0) { 
19350                $parent = $dom[($dom[$key]['parent
'])]; 
19351                $lasttag = ((!isset($dom[($key + 1)])) OR ((!isset($dom[($key + 2)])) AND ($dom[($key + 1)]['value
'] == 'marker
'))); 
19352                $in_table_head = false; 
19353                // maximum x position (used to draw borders) 
19359                if ($tag['block
']) { 
19360                        $hbz = 0; // distance from y to line bottom 
19361                        $hb = 0; // vertical space between block tags 
19362                        // calculate vertical space for block tags 
19363                        if (isset($this->tagvspaces[$tag['value
']][1]['h
']) AND ($this->tagvspaces[$tag['value
']][1]['h
'] >= 0)) { 
19364                                $pre_h = $this->tagvspaces[$tag['value
']][1]['h
']; 
19365                        } elseif (isset($parent['fontsize
'])) { 
19366                                $pre_h = $this->getCellHeight($parent['fontsize
'] / $this->k); 
19368                                $pre_h = $this->getCellHeight($this->FontSize); 
19370                        if (isset($this->tagvspaces[$tag['value
']][1]['n
'])) { 
19371                                $cn = $this->tagvspaces[$tag['value
']][1]['n
']; 
19372                        } elseif (preg_match('/[h][0-9]/
', $tag['value
']) > 0) { 
19377                        if ((!isset($this->tagvspaces[$tag['value
']])) AND ($tag['value
'] == 'div
')) { 
19380                                $hb = ($cn * $pre_h); 
19382                        if ($maxbottomliney > $this->PageBreakTrigger) { 
19383                                $hbz = $this->getCellHeight($this->FontSize); 
19384                        } elseif ($this->y < $maxbottomliney) { 
19385                                $hbz = ($maxbottomliney - $this->y); 
19389                switch($tag['value
']) { 
19391                                $table_el = $dom[($dom[$key]['parent
'])]['parent
']; 
19392                                if (!isset($parent['endy
'])) { 
19393                                        $dom[($dom[$key]['parent
'])]['endy
'] = $this->y; 
19394                                        $parent['endy
'] = $this->y; 
19396                                if (!isset($parent['endpage
'])) { 
19397                                        $dom[($dom[$key]['parent
'])]['endpage
'] = $this->page; 
19398                                        $parent['endpage
'] = $this->page; 
19400                                if (!isset($parent['endcolumn
'])) { 
19401                                        $dom[($dom[$key]['parent
'])]['endcolumn
'] = $this->current_column; 
19402                                        $parent['endcolumn
'] = $this->current_column; 
19404                                // update row-spanned cells 
19405                                if (isset($dom[$table_el]['rowspans
'])) { 
19406                                        foreach ($dom[$table_el]['rowspans
'] as $k => $trwsp) { 
19407                                                $dom[$table_el]['rowspans
'][$k]['rowspan
'] -= 1; 
19408                                                if ($dom[$table_el]['rowspans
'][$k]['rowspan
'] == 0) { 
19409                                                        if (($dom[$table_el]['rowspans
'][$k]['endpage
'] == $parent['endpage
']) AND ($dom[$table_el]['rowspans
'][$k]['endcolumn
'] == $parent['endcolumn
'])) { 
19410                                                                $dom[($dom[$key]['parent
'])]['endy
'] = max($dom[$table_el]['rowspans
'][$k]['endy
'], $parent['endy
']); 
19411                                                        } elseif (($dom[$table_el]['rowspans
'][$k]['endpage
'] > $parent['endpage
']) OR ($dom[$table_el]['rowspans
'][$k]['endcolumn
'] > $parent['endcolumn
'])) { 
19412                                                                $dom[($dom[$key]['parent
'])]['endy
'] = $dom[$table_el]['rowspans
'][$k]['endy
']; 
19413                                                                $dom[($dom[$key]['parent
'])]['endpage
'] = $dom[$table_el]['rowspans
'][$k]['endpage
']; 
19414                                                                $dom[($dom[$key]['parent
'])]['endcolumn
'] = $dom[$table_el]['rowspans
'][$k]['endcolumn
']; 
19418                                        // report new endy and endpage to the rowspanned cells 
19419                                        foreach ($dom[$table_el]['rowspans
'] as $k => $trwsp) { 
19420                                                if ($dom[$table_el]['rowspans
'][$k]['rowspan
'] == 0) { 
19421                                                        $dom[$table_el]['rowspans
'][$k]['endpage
'] = max($dom[$table_el]['rowspans
'][$k]['endpage
'], $dom[($dom[$key]['parent
'])]['endpage
']); 
19422                                                        $dom[($dom[$key]['parent
'])]['endpage
'] = $dom[$table_el]['rowspans
'][$k]['endpage
']; 
19423                                                        $dom[$table_el]['rowspans
'][$k]['endcolumn
'] = max($dom[$table_el]['rowspans
'][$k]['endcolumn
'], $dom[($dom[$key]['parent
'])]['endcolumn
']); 
19424                                                        $dom[($dom[$key]['parent
'])]['endcolumn
'] = $dom[$table_el]['rowspans
'][$k]['endcolumn
']; 
19425                                                        $dom[$table_el]['rowspans
'][$k]['endy
'] = max($dom[$table_el]['rowspans
'][$k]['endy
'], $dom[($dom[$key]['parent
'])]['endy
']); 
19426                                                        $dom[($dom[$key]['parent
'])]['endy
'] = $dom[$table_el]['rowspans
'][$k]['endy
']; 
19429                                        // update remaining rowspanned cells 
19430                                        foreach ($dom[$table_el]['rowspans
'] as $k => $trwsp) { 
19431                                                if ($dom[$table_el]['rowspans
'][$k]['rowspan
'] == 0) { 
19432                                                        $dom[$table_el]['rowspans
'][$k]['endpage
'] = $dom[($dom[$key]['parent
'])]['endpage
']; 
19433                                                        $dom[$table_el]['rowspans
'][$k]['endcolumn
'] = $dom[($dom[$key]['parent
'])]['endcolumn
']; 
19434                                                        $dom[$table_el]['rowspans
'][$k]['endy
'] = $dom[($dom[$key]['parent
'])]['endy
']; 
19438                                $prev_page = $this->page; 
19439                                $this->setPage($dom[($dom[$key]['parent
'])]['endpage
']); 
19440                                if ($this->num_columns > 1) { 
19441                                        if (($prev_page < $this->page) 
19442                                                AND ((($this->current_column == 0) AND ($dom[($dom[$key]['parent
'])]['endcolumn
'] == ($this->num_columns - 1))) 
19443                                                        OR ($this->current_column == $dom[($dom[$key]['parent
'])]['endcolumn
']))) { 
19445                                                $this->selectColumn(0); 
19446                                                $dom[($dom[$key]['parent
'])]['endcolumn
'] = 0; 
19447                                                $dom[($dom[$key]['parent
'])]['endy
'] = $this->y; 
19449                                                $this->selectColumn($dom[($dom[$key]['parent
'])]['endcolumn
']); 
19450                                                $this->y = $dom[($dom[$key]['parent
'])]['endy
']; 
19453                                        $this->y = $dom[($dom[$key]['parent
'])]['endy
']; 
19455                                if (isset($dom[$table_el]['attribute
']['cellspacing
'])) { 
19456                                        $this->y += $this->getHTMLUnitToUnits($dom[$table_el]['attribute
']['cellspacing
'], 1, 'px
'); 
19457                                } elseif (isset($dom[$table_el]['border-spacing
'])) { 
19458                                        $this->y += $dom[$table_el]['border-spacing
']['V
']; 
19460                                $this->Ln(0, $cell); 
19461                                if ($this->current_column == $parent['startcolumn
']) { 
19462                                        $this->x = $parent['startx
']; 
19464                                // account for booklet mode 
19465                                if ($this->page > $parent['startpage
']) { 
19466                                        if (($this->rtl) AND ($this->pagedim[$this->page]['orm
'] != $this->pagedim[$parent['startpage
']]['orm
'])) { 
19467                                                $this->x -= ($this->pagedim[$this->page]['orm
'] - $this->pagedim[$parent['startpage
']]['orm
']); 
19468                                        } elseif ((!$this->rtl) AND ($this->pagedim[$this->page]['olm
'] != $this->pagedim[$parent['startpage
']]['olm
'])) { 
19469                                                $this->x += ($this->pagedim[$this->page]['olm
'] - $this->pagedim[$parent['startpage
']]['olm
']); 
19475                                // closing tag used for the thead part 
19476                                $in_table_head = true; 
19477                                $this->inthead = false; 
19479                                $table_el = $parent; 
19480                                // set default border 
19481                                if (isset($table_el['attribute
']['border
']) AND ($table_el['attribute
']['border
'] > 0)) { 
19482                                        // set default border 
19483                                        $border = array('LTRB
' => array('width
' => $this->getCSSBorderWidth($table_el['attribute
']['border
']), 'cap
'=>'square
', 'join
'=>'miter
', 'dash
'=> 0, 'color
'=>array(0,0,0))); 
19487                                $default_border = $border; 
19488                                // fix bottom line alignment of last line before page break 
19489                                foreach ($dom[($dom[$key]['parent
'])]['trids
'] as $j => $trkey) { 
19490                                        // update row-spanned cells 
19491                                        if (isset($dom[($dom[$key]['parent
'])]['rowspans
'])) { 
19492                                                foreach ($dom[($dom[$key]['parent
'])]['rowspans
'] as $k => $trwsp) { 
19493                                                        if (isset($prevtrkey) AND ($trwsp['trid
'] == $prevtrkey) AND ($trwsp['mrowspan
'] > 0)) { 
19494                                                                $dom[($dom[$key]['parent
'])]['rowspans
'][$k]['trid
'] = $trkey; 
19496                                                        if ($dom[($dom[$key]['parent
'])]['rowspans
'][$k]['trid
'] == $trkey) { 
19497                                                                $dom[($dom[$key]['parent
'])]['rowspans
'][$k]['mrowspan
'] -= 1; 
19501                                        if (isset($prevtrkey) AND ($dom[$trkey]['startpage
'] > $dom[$prevtrkey]['endpage
'])) { 
19502                                                $pgendy = $this->pagedim[$dom[$prevtrkey]['endpage
']]['hk
'] - $this->pagedim[$dom[$prevtrkey]['endpage
']]['bm
']; 
19503                                                $dom[$prevtrkey]['endy
'] = $pgendy; 
19504                                                // update row-spanned cells 
19505                                                if (isset($dom[($dom[$key]['parent
'])]['rowspans
'])) { 
19506                                                        foreach ($dom[($dom[$key]['parent
'])]['rowspans
'] as $k => $trwsp) { 
19507                                                                if (($trwsp['trid
'] == $prevtrkey) AND ($trwsp['mrowspan
'] >= 0) AND ($trwsp['endpage
'] == $dom[$prevtrkey]['endpage
'])) { 
19508                                                                        $dom[($dom[$key]['parent
'])]['rowspans
'][$k]['endy
'] = $pgendy; 
19509                                                                        $dom[($dom[$key]['parent
'])]['rowspans
'][$k]['mrowspan
'] = -1; 
19514                                        $prevtrkey = $trkey; 
19515                                        $table_el = $dom[($dom[$key]['parent
'])]; 
19518                                if (count($table_el['trids
']) > 0) { 
19521                                foreach ($table_el['trids
'] as $j => $trkey) { 
19522                                        $parent = $dom[$trkey]; 
19523                                        if (!isset($xmax)) { 
19524                                                $xmax = $parent['cellpos
'][(count($parent['cellpos
']) - 1)]['endx
']; 
19526                                        // for each cell on the row 
19527                                        foreach ($parent['cellpos
'] as $k => $cellpos) { 
19528                                                if (isset($cellpos['rowspanid
']) AND ($cellpos['rowspanid
'] >= 0)) { 
19529                                                        $cellpos['startx
'] = $table_el['rowspans
'][($cellpos['rowspanid
'])]['startx
']; 
19530                                                        $cellpos['endx
'] = $table_el['rowspans
'][($cellpos['rowspanid
'])]['endx
']; 
19531                                                        $endy = $table_el['rowspans
'][($cellpos['rowspanid
'])]['endy
']; 
19532                                                        $startpage = $table_el['rowspans
'][($cellpos['rowspanid
'])]['startpage
']; 
19533                                                        $endpage = $table_el['rowspans
'][($cellpos['rowspanid
'])]['endpage
']; 
19534                                                        $startcolumn = $table_el['rowspans
'][($cellpos['rowspanid
'])]['startcolumn
']; 
19535                                                        $endcolumn = $table_el['rowspans
'][($cellpos['rowspanid
'])]['endcolumn
']; 
19537                                                        $endy = $parent['endy
']; 
19538                                                        $startpage = $parent['startpage
']; 
19539                                                        $endpage = $parent['endpage
']; 
19540                                                        $startcolumn = $parent['startcolumn
']; 
19541                                                        $endcolumn = $parent['endcolumn
']; 
19543                                                if ($this->num_columns == 0) { 
19544                                                        $this->num_columns = 1; 
19546                                                if (isset($cellpos['border
'])) { 
19547                                                        $border = $cellpos['border
']; 
19549                                                if (isset($cellpos['bgcolor
']) AND ($cellpos['bgcolor
']) !== false) { 
19550                                                        $this->SetFillColorArray($cellpos['bgcolor
']); 
19555                                                $x = $cellpos['startx
']; 
19556                                                $y = $parent['starty
']; 
19558                                                $w = abs($cellpos['endx
'] - $cellpos['startx
']); 
19559                                                // get border modes 
19560                                                $border_start = TCPDF_STATIC::getBorderMode($border, $position='start
', $this->opencell); 
19561                                                $border_end = TCPDF_STATIC::getBorderMode($border, $position='end
', $this->opencell); 
19562                                                $border_middle = TCPDF_STATIC::getBorderMode($border, $position='middle
', $this->opencell); 
19563                                                // design borders around HTML cells. 
19564                                                for ($page = $startpage; $page <= $endpage; ++$page) { // for each page 
19566                                                        $this->setPage($page); 
19567                                                        if ($this->num_columns < 2) { 
19568                                                                // single-column mode 
19570                                                                $this->y = $this->tMargin; 
19572                                                        // account for margin changes 
19573                                                        if ($page > $startpage) { 
19574                                                                if (($this->rtl) AND ($this->pagedim[$page]['orm
'] != $this->pagedim[$startpage]['orm
'])) { 
19575                                                                        $this->x -= ($this->pagedim[$page]['orm
'] - $this->pagedim[$startpage]['orm
']); 
19576                                                                } elseif ((!$this->rtl) AND ($this->pagedim[$page]['olm
'] != $this->pagedim[$startpage]['olm
'])) { 
19577                                                                        $this->x += ($this->pagedim[$page]['olm
'] - $this->pagedim[$startpage]['olm
']); 
19580                                                        if ($startpage == $endpage) { // single page 
19583                                                                for ($column = $startcolumn; $column <= $endcolumn; ++$column) { // for each column 
19584                                                                        $this->selectColumn($column); 
19585                                                                        if ($startcolumn == $endcolumn) { // single column 
19586                                                                                $cborder = $border; 
19587                                                                                $h = $endy - $parent['starty
']; 
19590                                                                        } elseif ($column == $startcolumn) { // first column 
19591                                                                                $cborder = $border_start; 
19592                                                                                $this->y = $starty; 
19594                                                                                $h = $this->h - $this->y - $this->bMargin; 
19596                                                                                        $deltacol = $this->x + $this->rMargin - $this->w; 
19598                                                                                        $deltacol = $this->x - $this->lMargin; 
19600                                                                        } elseif ($column == $endcolumn) { // end column 
19601                                                                                $cborder = $border_end; 
19602                                                                                if (isset($this->columns[$column]['th
']['\
''.$page.
'\''])) {
 
19603                                                                                        $this->y = $this->columns[$column][
'th'][
'\''.$page.
'\''];
 
19605                                                                                $this->x += $deltacol;
 
19608                                                                                $cborder = $border_middle;
 
19609                                                                                if (isset($this->columns[$column][
'th'][
'\''.
$page.
'\''])) {
 
19610                                                                                        $this->y = $this->columns[$column][
'th'][
'\''.$page.
'\''];
 
19612                                                                                $this->x += $deltacol;
 
19615                                                                        $ccode .= $this->
getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
19617                                                        } elseif (
$page == $startpage) { 
 
19622                                                                        if ($column == $startcolumn) { 
 
19623                                                                                $cborder = $border_start;
 
19628                                                                                        $deltacol = $this->x + $this->rMargin - 
$this->w;
 
19633                                                                                $cborder = $border_middle;
 
19634                                                                                if (isset($this->columns[$column][
'th'][
'\''.
$page.
'\''])) {
 
19635                                                                                        $this->y = $this->columns[$column][
'th'][
'\''.$page.
'\''];
 
19637                                                                                $this->x += $deltacol;
 
19640                                                                        $ccode .= $this->
getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
19642                                                        } elseif (
$page == $endpage) { 
 
19645                                                                for ($column = 0; $column <= $endcolumn; ++$column) { 
 
19647                                                                        if ($column == $endcolumn) { 
 
19648                                                                                $cborder = $border_end;
 
19649                                                                                if (isset($this->columns[$column][
'th'][
'\''.
$page.
'\''])) {
 
19650                                                                                        $this->y = $this->columns[$column][
'th'][
'\''.$page.
'\''];
 
19652                                                                                $this->x += $deltacol;
 
19655                                                                                $cborder = $border_middle;
 
19656                                                                                if (isset($this->columns[$column][
'th'][
'\''.
$page.
'\''])) {
 
19657                                                                                        $this->y = $this->columns[$column][
'th'][
'\''.$page.
'\''];
 
19659                                                                                $this->x += $deltacol;
 
19662                                                                        $ccode .= $this->
getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
19669                                                                        $cborder = $border_middle;
 
19670                                                                        if (isset($this->columns[$column][
'th'][
'\''.
$page.
'\''])) {
 
19671                                                                                $this->y = $this->columns[$column][
'th'][
'\''.$page.
'\''];
 
19673                                                                        $this->x += $deltacol;
 
19675                                                                        $ccode .= $this->
getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
19678                                                        if (!empty($cborder) OR !empty($fill)) {
 
19679                                                                $offsetlen = strlen($ccode);
 
19681                                                                if ($this->inxobj) {
 
19683                                                                        if (end($this->xobjects[$this->xobjid][
'transfmrk']) !== 
false) {
 
19684                                                                                $pagemarkkey = key($this->xobjects[$this->xobjid][
'transfmrk']);
 
19685                                                                                $pagemark = $this->xobjects[
$this->xobjid][
'transfmrk'][$pagemarkkey];
 
19686                                                                                $this->xobjects[
$this->xobjid][
'transfmrk'][$pagemarkkey] += $offsetlen;
 
19692                                                                        $pstart = substr($pagebuff, 0, $pagemark);
 
19693                                                                        $pend = substr($pagebuff, $pagemark);
 
19694                                                                        $this->xobjects[
$this->xobjid][
'outdata'] = $pstart.$ccode.$pend;
 
19697                                                                        if (end($this->transfmrk[$this->page]) !== 
false) {
 
19698                                                                                $pagemarkkey = key($this->transfmrk[$this->page]);
 
19699                                                                                $pagemark = $this->transfmrk[
$this->page][$pagemarkkey];
 
19700                                                                        } elseif ($this->InFooter) {
 
19706                                                                        $pstart = substr($pagebuff, 0, $pagemark);
 
19707                                                                        $pend = substr($pagebuff, $pagemark);
 
19715                                        if (isset($table_el[
'attribute'][
'cellspacing'])) {
 
19716                                                $this->y += $this->
getHTMLUnitToUnits($table_el[
'attribute'][
'cellspacing'], 1, 
'px');
 
19717                                        } elseif (isset($table_el[
'border-spacing'])) {
 
19718                                                $this->y += $table_el[
'border-spacing'][
'V'];
 
19720                                        $this->
Ln(0, $cell);
 
19721                                        $this->x = $parent[
'startx'];
 
19722                                        if ($endpage > $startpage) {
 
19723                                                if (($this->rtl) AND ($this->pagedim[$endpage][
'orm'] != $this->pagedim[$startpage][
'orm'])) {
 
19724                                                        $this->x += ($this->pagedim[$endpage][
'orm'] - $this->pagedim[$startpage][
'orm']);
 
19725                                                } elseif ((!$this->rtl) AND ($this->pagedim[$endpage][
'olm'] != $this->pagedim[$startpage][
'olm'])) {
 
19726                                                        $this->x += ($this->pagedim[$endpage][
'olm'] - $this->pagedim[$startpage][
'olm']);
 
19730                                if (!$in_table_head) { 
 
19731                                        $this->cell_padding = $table_el[
'old_cell_padding'];
 
19734                                        if (($this->page == ($this->numpages - 1)) AND ($this->pageopen[$this->numpages])) {
 
19736                                                if (($plendiff > 0) AND ($plendiff < 60)) {
 
19737                                                        $pagediff = substr($this->
getPageBuffer($this->numpages), $this->emptypagemrk[$this->numpages], $plendiff);
 
19738                                                        if (substr($pagediff, 0, 5) == 
'BT /F') {
 
19743                                                if ($plendiff == 0) {
 
19748                                        if (isset($this->theadMargins[
'top'])) {
 
19750                                                $this->tMargin = $this->theadMargins[
'top'];
 
19752                                        if (!isset($table_el[
'attribute'][
'nested']) OR ($table_el[
'attribute'][
'nested'] != 
'true')) {
 
19755                                                $this->theadMargins = array();
 
19759                                $parent = $table_el;
 
19767                                $this->
SetXY($this->
GetX(), $this->
GetY() + ((0.7 * $parent[
'fontsize']) / $this->k));
 
19771                                $this->
SetXY($this->
GetX(), $this->
GetY() - ((0.3 * $parent[
'fontsize']) / $this->k));
 
19778                        case 'blockquote': {
 
19794                                $this->premode = 
false;
 
19799                                if ($this->listnum <= 0) {
 
19800                                        $this->listnum = 0;
 
19809                                $this->lispacer = 
'';
 
19814                                $this->lispacer = 
'';
 
19827                                $this->lispacer = 
'';
 
19834                                if ($this->listnum <= 0) {
 
19835                                        $this->listnum = 0;
 
19844                                $this->lispacer = 
'';
 
19859                                $this->form_action = 
'';
 
19860                                $this->form_enctype = 
'application/x-www-form-urlencoded';
 
19869                if (isset($dom[($dom[$key][
'parent'])][
'attribute'][
'pagebreakafter'])) {
 
19870                        $pba = $dom[($dom[$key][
'parent'])][
'attribute'][
'pagebreakafter'];
 
19872                        if (($pba == 
'true') OR ($pba == 
'left') OR ($pba == 'right')) {
 
19876                        if ((($pba == 
'left') AND (((!$this->rtl) AND (($this->page % 2) == 0)) OR (($this->rtl) AND (($this->page % 2) != 0))))
 
19877                                OR (($pba == 
'right') AND (((!$this->rtl) AND (($this->page % 2) != 0)) OR (($this->rtl) AND (($this->page % 2) == 0))))) {
 
19882                $this->tmprtl = 
false;
 
19897                        $this->Ln(0, $cell);
 
19898                        $this->htmlvspace = 0;
 
19902                        $this->Ln($hbz, $cell);
 
19903                        $this->htmlvspace = 0;
 
19906                if ($hb < $this->htmlvspace) {
 
19909                        $hd = $hb - $this->htmlvspace;
 
19910                        $this->htmlvspace = $hb;
 
19912                $this->Ln(($hbz + $hd), $cell);
 
19923                        $xmax = $this->lMargin;
 
19925                        $xmax = $this->w - $this->rMargin;
 
19927                return array(
'page' => $this->page, 
'column' => $this->current_column, 
'x' => $this->x, 
'y' => $this->y, 
'xmax' => $xmax);
 
19938                if (!isset($tag[
'borderposition'])) {
 
19944                $prev_lasth = $this->lasth;
 
19948                if (isset($tag[
'border']) AND !empty($tag[
'border'])) {
 
19956                if (isset($tag[
'bgcolor']) AND ($tag[
'bgcolor'] !== 
false)) {
 
19958                        $old_bgcolor = $this->bgcolor;
 
19959                        $this->SetFillColorArray($tag[
'bgcolor']);
 
19966                if (isset($tag[
'attribute'][
'cellspacing'])) {
 
19967                        $clsp = $this->getHTMLUnitToUnits($tag[
'attribute'][
'cellspacing'], 1, 
'px');
 
19968                        $cellspacing = array(
'H' => $clsp, 
'V' => $clsp);
 
19969                } elseif (isset($tag[
'border-spacing'])) {
 
19970                        $cellspacing = $tag[
'border-spacing'];
 
19972                        $cellspacing = array(
'H' => 0, 
'V' => 0);
 
19974                if (($tag[
'value'] != 
'table') AND (is_array(
$border)) AND (!empty(
$border))) {
 
19979                        if ($xmax >= $tag[
'borderposition'][
'x']) {
 
19980                                $xmax = $tag[
'borderposition'][
'xmax'];
 
19982                        $w = ($tag[
'borderposition'][
'x'] - $xmax);
 
19984                        if ($xmax <= $tag[
'borderposition'][
'x']) {
 
19985                                $xmax = $tag[
'borderposition'][
'xmax'];
 
19987                        $w = ($xmax - $tag[
'borderposition'][
'x']);
 
19992                $w += $cellspacing[
'H'];
 
19993                $startpage = $tag[
'borderposition'][
'page'];
 
19994                $startcolumn = $tag[
'borderposition'][
'column'];
 
19995                $x = $tag[
'borderposition'][
'x'];
 
19996                $y = $tag[
'borderposition'][
'y'];
 
19997                $endpage = $this->page;
 
19998                $starty = $tag[
'borderposition'][
'y'] - $cellspacing[
'V'];
 
20002                $endcolumn = $this->current_column;
 
20003                if ($this->num_columns == 0) {
 
20004                        $this->num_columns = 1;
 
20011                $temp_page_regions = $this->page_regions;
 
20012                $this->page_regions = array();
 
20014                for ($page = $startpage; $page <= $endpage; ++$page) { 
 
20016                        $this->setPage($page);
 
20017                        if ($this->num_columns < 2) {
 
20020                                $this->y = $this->tMargin;
 
20023                        if ($page > $startpage) {
 
20024                                if (($this->rtl) AND ($this->pagedim[$page][
'orm'] != $this->pagedim[$startpage][
'orm'])) {
 
20025                                        $this->x -= ($this->pagedim[$page][
'orm'] - $this->pagedim[$startpage][
'orm']);
 
20026                                } elseif ((!$this->rtl) AND ($this->pagedim[$page][
'olm'] != $this->pagedim[$startpage][
'olm'])) {
 
20027                                        $this->x += ($this->pagedim[$page][
'olm'] - $this->pagedim[$startpage][
'olm']);
 
20030                        if ($startpage == $endpage) {
 
20032                                for ($column = $startcolumn; $column <= $endcolumn; ++$column) { 
 
20033                                        $this->selectColumn($column);
 
20034                                        if ($startcolumn == $endcolumn) { 
 
20036                                                $h = ($currentY - 
$y) + $cellspacing[
'V'];
 
20038                                        } elseif ($column == $startcolumn) { 
 
20039                                                $cborder = $border_start;
 
20042                                        } elseif ($column == $endcolumn) { 
 
20043                                                $cborder = $border_end;
 
20046                                                $cborder = $border_middle;
 
20049                                        $ccode .= $this->getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
20051                        } elseif ($page == $startpage) { 
 
20052                                for ($column = $startcolumn; $column < $this->num_columns; ++$column) { 
 
20053                                        $this->selectColumn($column);
 
20054                                        if ($column == $startcolumn) { 
 
20055                                                $cborder = $border_start;
 
20059                                                $cborder = $border_middle;
 
20062                                        $ccode .= $this->getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
20064                        } elseif ($page == $endpage) { 
 
20065                                for ($column = 0; $column <= $endcolumn; ++$column) { 
 
20066                                        $this->selectColumn($column);
 
20067                                        if ($column == $endcolumn) {
 
20069                                                $cborder = $border_end;
 
20073                                                $cborder = $border_middle;
 
20076                                        $ccode .= $this->getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
20079                                for ($column = 0; $column < $this->num_columns; ++$column) { 
 
20080                                        $this->selectColumn($column);
 
20081                                        $cborder = $border_middle;
 
20083                                        $ccode .= $this->getCellCode(
$w, 
$h, 
'', $cborder, 1, 
'', $fill, 
'', 0, 
true).
"\n";
 
20086                        if ($cborder OR $fill) {
 
20087                                $offsetlen = strlen($ccode);
 
20089                                if ($this->inxobj) {
 
20091                                        if (end($this->xobjects[$this->xobjid][
'transfmrk']) !== 
false) {
 
20092                                                $pagemarkkey = key($this->xobjects[$this->xobjid][
'transfmrk']);
 
20093                                                $pagemark = $this->xobjects[$this->xobjid][
'transfmrk'][$pagemarkkey];
 
20094                                                $this->xobjects[$this->xobjid][
'transfmrk'][$pagemarkkey] += $offsetlen;
 
20096                                                $pagemark = $this->xobjects[$this->xobjid][
'intmrk'];
 
20097                                                $this->xobjects[$this->xobjid][
'intmrk'] += $offsetlen;
 
20099                                        $pagebuff = $this->xobjects[$this->xobjid][
'outdata'];
 
20100                                        $pstart = substr($pagebuff, 0, $pagemark);
 
20101                                        $pend = substr($pagebuff, $pagemark);
 
20102                                        $this->xobjects[$this->xobjid][
'outdata'] = $pstart.$ccode.$pend;
 
20104                                        if (end($this->transfmrk[$this->page]) !== 
false) {
 
20105                                                $pagemarkkey = key($this->transfmrk[$this->page]);
 
20106                                                $pagemark = $this->transfmrk[$this->page][$pagemarkkey];
 
20107                                        } elseif ($this->InFooter) {
 
20108                                                $pagemark = $this->footerpos[$this->page];
 
20110                                                $pagemark = $this->intmrk[$this->page];
 
20112                                        $pagebuff = $this->getPageBuffer($this->page);
 
20113                                        $pstart = substr($pagebuff, 0, $pagemark);
 
20114                                        $pend = substr($pagebuff, $pagemark);
 
20115                                        $this->setPageBuffer($this->page, $pstart.$ccode.$pend);
 
20116                                        $this->bordermrk[$this->page] += $offsetlen;
 
20117                                        $this->cntmrk[$this->page] += $offsetlen;
 
20122                $this->page_regions = $temp_page_regions;
 
20123                if (isset($old_bgcolor)) {
 
20125                        $this->SetFillColorArray($old_bgcolor);
 
20128                $this->x = $prev_x;
 
20129                $this->y = $prev_y;
 
20130                $this->lasth = $prev_lasth;
 
20141                if (substr($symbol, 0, 4) == 
'img|') {
 
20142                        $this->lisymbol = $symbol;
 
20145                $symbol = strtolower($symbol);
 
20146                $valid_symbols = array(
'!', 
'#', 
'disc', 
'circle', 
'square', 
'1', 
'decimal', 
'decimal-leading-zero', 
'i', 
'lower-roman', 
'I', 
'upper-roman', 
'a', 
'lower-alpha', 
'lower-latin', 
'A', 
'upper-alpha', 
'upper-latin', 
'lower-greek');
 
20147                if (in_array($symbol, $valid_symbols)) {
 
20148                        $this->lisymbol = $symbol;
 
20150                        $this->lisymbol = 
'';
 
20163                $this->booklet = $booklet;
 
20165                        $this->lMargin = $inner;
 
20168                        $this->rMargin = $outer;
 
20181                        $mtemp = $this->original_lMargin;
 
20182                        $this->original_lMargin = $this->original_rMargin;
 
20183                        $this->original_rMargin = $mtemp;
 
20184                        $deltam = $this->original_lMargin - $this->original_rMargin;
 
20185                        $this->lMargin += $deltam;
 
20186                        $this->rMargin -= $deltam;
 
20203                $this->tagvspaces = $tagvs;
 
20213                return $this->customlistindent = floatval($width);
 
20223                $this->opencell = $isopen;
 
20234                $this->htmlLinkColorArray = $color;
 
20235                $this->htmlLinkFontStyle = $fontstyle;
 
20249                $supportedunits = array(
'%', 
'em', 
'ex', 
'px', 
'in', 
'cm', 
'mm', 
'pc', 
'pt');
 
20258                if (in_array($defaultunit, $supportedunits)) {
 
20259                        $unit = $defaultunit;
 
20261                if (is_numeric($htmlval)) {
 
20262                        $value = floatval($htmlval);
 
20263                } elseif (preg_match(
'/([0-9\.\-\+]+)/', $htmlval, $mnum)) {
 
20264                        $value = floatval($mnum[1]);
 
20265                        if (preg_match(
'/([a-z%]+)/', $htmlval, $munit)) {
 
20266                                if (in_array($munit[1], $supportedunits)) {
 
20274                                $retval = (($value * $refsize) / 100);
 
20279                                $retval = ($value * $refsize);
 
20284                                $retval = ($value * ($refsize / 2));
 
20289                                $retval = (($value * $this->dpi) / $k);
 
20294                                $retval = (($value / 2.54 * $this->dpi) / $k);
 
20299                                $retval = (($value / 25.4 * $this->dpi) / $k);
 
20304                                $retval = (($value * 12) / $k);
 
20309                                $retval = ($value / $k);
 
20314                                $retval = $this->pixelsToUnits($value);
 
20316                                        $retval *= $this->k;
 
20333                if ($this->state != 2) {
 
20338                $bgcolor = $this->bgcolor;
 
20339                $color = $this->fgcolor;
 
20340                $strokecolor = $this->strokecolor;
 
20344                $lspace = $this->GetStringWidth(
'  ');
 
20345                if ($listtype == 
'^') {
 
20347                        $this->lispacer = 
'';
 
20349                } elseif ($listtype == 
'!') {
 
20351                        $deftypes = array(
'disc', 
'circle', 
'square');
 
20352                        $listtype = $deftypes[($listdepth - 1) % 3];
 
20353                } elseif ($listtype == 
'#') {
 
20355                        $listtype = 
'decimal';
 
20356                } elseif (substr($listtype, 0, 4) == 
'img|') {
 
20358                        $img = explode(
'|', $listtype);
 
20361                switch ($listtype) {
 
20368                                $lspace += (2 * 
$r);
 
20370                                        $this->x += $lspace;
 
20372                                        $this->x -= $lspace;
 
20374                                $this->Circle(($this->x + 
$r), ($this->y + ($this->lasth / 2)), 
$r, 0, 360, 
'F', array(), $color, 8);
 
20379                                $lspace += (2 * 
$r);
 
20381                                        $this->x += $lspace;
 
20383                                        $this->x -= $lspace;
 
20385                                $prev_line_style = $this->linestyleWidth.
' '.$this->linestyleCap.
' '.$this->linestyleJoin.
' '.$this->linestyleDash.
' '.$this->DrawColor;
 
20386                                $new_line_style = array(
'width' => (
$r / 3), 
'cap' => 
'butt', 
'join' => 
'miter', 
'dash' => 0, 
'phase' => 0, 
'color'=>$color);
 
20387                                $this->Circle(($this->x + 
$r), ($this->y + ($this->lasth / 2)), (
$r * (1 - (1/6))), 0, 360, 
'D', $new_line_style, array(), 8);
 
20388                                $this->_out($prev_line_style); 
 
20395                                        $this->x += $lspace;
 
20397                                        $this->x -= $lspace;
 
20399                                $this->Rect($this->x, ($this->y + (($this->lasth - 
$l) / 2)), 
$l, 
$l, 
'F', array(), $color);
 
20404                                $lspace += 
$img[2];
 
20406                                        $this->x += $lspace;
 
20408                                        $this->x -= $lspace;
 
20410                                $imgtype = strtolower(
$img[1]);
 
20412                                switch ($imgtype) {
 
20414                                                $this->ImageSVG(
$img[4], $this->x, ($this->y + (($this->lasth - 
$img[3]) / 2)), 
$img[2], 
$img[3], 
'', 
'T', 
'', 0, 
false);
 
20419                                                $this->ImageEps(
$img[4], $this->x, ($this->y + (($this->lasth - 
$img[3]) / 2)), 
$img[2], 
$img[3], 
'', 
true, 
'T', 
'', 0, 
false);
 
20423                                                $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);
 
20427                                $this->y = $prev_y;
 
20435                                $textitem = $this->listcount[$this->listnum];
 
20438                        case 'decimal-leading-zero': {
 
20439                                $textitem = sprintf(
'%02d', $this->listcount[$this->listnum]);
 
20443                        case 'lower-roman': {
 
20448                        case 'upper-roman': {
 
20453                        case 'lower-alpha':
 
20454                        case 'lower-latin': {
 
20455                                $textitem = chr(97 + $this->listcount[$this->listnum] - 1);
 
20459                        case 'upper-alpha':
 
20460                        case 'upper-latin': {
 
20461                                $textitem = chr(65 + $this->listcount[$this->listnum] - 1);
 
20464                        case 'lower-greek': {
 
20465                                $textitem = 
TCPDF_FONTS::unichr((945 + $this->listcount[$this->listnum] - 1), $this->isunicode);
 
20496                                $textitem = $this->listcount[$this->listnum];
 
20502                        $h = $this->getCellHeight($this->FontSize);
 
20503                        if ($this->checkPageBreak(
$h) OR ($this->y < $prev_y)) {
 
20508                                $textitem = 
'.'.$textitem;
 
20510                                $textitem = $textitem.
'.';
 
20512                        $lspace += $this->GetStringWidth($textitem);
 
20514                                $this->x += $lspace;
 
20516                                $this->x -= $lspace;
 
20518                        $this->Write($this->lasth, $textitem, 
'', 
false, 
'', 
false, 0, 
false);
 
20521                $this->lispacer = 
'^';
 
20523                $this->SetFillColorArray($bgcolor);
 
20524                $this->SetDrawColorArray($strokecolor);
 
20525                $this->SettextColorArray($color);
 
20536                        'FontFamily' => $this->FontFamily,
 
20537                        'FontStyle' => $this->FontStyle,
 
20538                        'FontSizePt' => $this->FontSizePt,
 
20539                        'rMargin' => $this->rMargin,
 
20540                        'lMargin' => $this->lMargin,
 
20541                        'cell_padding' => $this->cell_padding,
 
20542                        'cell_margin' => $this->cell_margin,
 
20543                        'LineWidth' => $this->LineWidth,
 
20544                        'linestyleWidth' => $this->linestyleWidth,
 
20545                        'linestyleCap' => $this->linestyleCap,
 
20546                        'linestyleJoin' => $this->linestyleJoin,
 
20547                        'linestyleDash' => $this->linestyleDash,
 
20548                        'textrendermode' => $this->textrendermode,
 
20549                        'textstrokewidth' => $this->textstrokewidth,
 
20550                        'DrawColor' => $this->DrawColor,
 
20551                        'FillColor' => $this->FillColor,
 
20552                        'TextColor' => $this->TextColor,
 
20553                        'ColorFlag' => $this->ColorFlag,
 
20554                        'bgcolor' => $this->bgcolor,
 
20555                        'fgcolor' => $this->fgcolor,
 
20556                        'htmlvspace' => $this->htmlvspace,
 
20557                        'listindent' => $this->listindent,
 
20558                        'listindentlevel' => $this->listindentlevel,
 
20559                        'listnum' => $this->listnum,
 
20560                        'listordered' => $this->listordered,
 
20561                        'listcount' => $this->listcount,
 
20562                        'lispacer' => $this->lispacer,
 
20563                        'cell_height_ratio' => $this->cell_height_ratio,
 
20564                        'font_stretching' => $this->font_stretching,
 
20565                        'font_spacing' => $this->font_spacing,
 
20566                        'alpha' => $this->alpha,
 
20568                        'lasth' => $this->lasth,
 
20569                        'tMargin' => $this->tMargin,
 
20570                        'bMargin' => $this->bMargin,
 
20571                        'AutoPageBreak' => $this->AutoPageBreak,
 
20572                        'PageBreakTrigger' => $this->PageBreakTrigger,
 
20577                        'wPt' => $this->wPt,
 
20578                        'hPt' => $this->hPt,
 
20579                        'fwPt' => $this->fwPt,
 
20580                        'fhPt' => $this->fhPt,
 
20581                        'page' => $this->page,
 
20582                        'current_column' => $this->current_column,
 
20583                        'num_columns' => $this->num_columns
 
20596                if ($this->state != 2) {
 
20599                $this->FontFamily = $gvars[
'FontFamily'];
 
20600                $this->FontStyle = $gvars[
'FontStyle'];
 
20601                $this->FontSizePt = $gvars[
'FontSizePt'];
 
20602                $this->rMargin = $gvars[
'rMargin'];
 
20603                $this->lMargin = $gvars[
'lMargin'];
 
20604                $this->cell_padding = $gvars[
'cell_padding'];
 
20605                $this->cell_margin = $gvars[
'cell_margin'];
 
20606                $this->LineWidth = $gvars[
'LineWidth'];
 
20607                $this->linestyleWidth = $gvars[
'linestyleWidth'];
 
20608                $this->linestyleCap = $gvars[
'linestyleCap'];
 
20609                $this->linestyleJoin = $gvars[
'linestyleJoin'];
 
20610                $this->linestyleDash = $gvars[
'linestyleDash'];
 
20611                $this->textrendermode = $gvars[
'textrendermode'];
 
20612                $this->textstrokewidth = $gvars[
'textstrokewidth'];
 
20613                $this->DrawColor = $gvars[
'DrawColor'];
 
20614                $this->FillColor = $gvars[
'FillColor'];
 
20615                $this->TextColor = $gvars[
'TextColor'];
 
20616                $this->ColorFlag = $gvars[
'ColorFlag'];
 
20617                $this->bgcolor = $gvars[
'bgcolor'];
 
20618                $this->fgcolor = $gvars[
'fgcolor'];
 
20619                $this->htmlvspace = $gvars[
'htmlvspace'];
 
20620                $this->listindent = $gvars[
'listindent'];
 
20621                $this->listindentlevel = $gvars[
'listindentlevel'];
 
20622                $this->listnum = $gvars[
'listnum'];
 
20623                $this->listordered = $gvars[
'listordered'];
 
20624                $this->listcount = $gvars[
'listcount'];
 
20625                $this->lispacer = $gvars[
'lispacer'];
 
20626                $this->cell_height_ratio = $gvars[
'cell_height_ratio'];
 
20627                $this->font_stretching = $gvars[
'font_stretching'];
 
20628                $this->font_spacing = $gvars[
'font_spacing'];
 
20629                $this->alpha = $gvars[
'alpha'];
 
20632                        $this->lasth = $gvars[
'lasth'];
 
20633                        $this->tMargin = $gvars[
'tMargin'];
 
20634                        $this->bMargin = $gvars[
'bMargin'];
 
20635                        $this->AutoPageBreak = $gvars[
'AutoPageBreak'];
 
20636                        $this->PageBreakTrigger = $gvars[
'PageBreakTrigger'];
 
20637                        $this->x = $gvars[
'x'];
 
20638                        $this->y = $gvars[
'y'];
 
20639                        $this->w = $gvars[
'w'];
 
20640                        $this->h = $gvars[
'h'];
 
20641                        $this->wPt = $gvars[
'wPt'];
 
20642                        $this->hPt = $gvars[
'hPt'];
 
20643                        $this->fwPt = $gvars[
'fwPt'];
 
20644                        $this->fhPt = $gvars[
'fhPt'];
 
20645                        $this->page = $gvars[
'page'];
 
20646                        $this->current_column = $gvars[
'current_column'];
 
20647                        $this->num_columns = $gvars[
'num_columns'];
 
20649                $this->_out(
''.$this->linestyleWidth.
' '.$this->linestyleCap.
' '.$this->linestyleJoin.
' '.$this->linestyleDash.
' '.$this->DrawColor.
' '.$this->FillColor.
'');
 
20651                        $this->SetFont($this->FontFamily, $this->FontStyle, $this->FontSizePt);
 
20678                $this->bufferlen += strlen(
$data);
 
20679                $this->buffer .= 
$data;
 
20689                $this->bufferlen = strlen(
$data);
 
20690                $this->buffer = 
$data;
 
20700                return $this->buffer;
 
20713                        $this->pages[$page] .= 
$data;
 
20715                        $this->pages[$page] = 
$data;
 
20717                if ($append AND isset($this->pagelen[$page])) {
 
20718                        $this->pagelen[$page] += strlen(
$data);
 
20720                        $this->pagelen[$page] = strlen(
$data);
 
20732                if (isset($this->pages[$page])) {
 
20733                        return $this->pages[$page];
 
20747                if ((
$data[
'i'] = array_search($image, $this->imagekeys)) === FALSE) {
 
20748                        $this->imagekeys[$this->numimages] = $image;
 
20749                        $data[
'i'] = $this->numimages;
 
20750                        ++$this->numimages;
 
20752                $this->images[$image] = 
$data;
 
20765                if (!isset($this->images[$image])) {
 
20766                        $this->setImageBuffer($image, array());
 
20768                $this->images[$image][$key] = 
$data;
 
20779                if (isset($this->images[$image])) {
 
20780                        return $this->images[$image];
 
20793                $this->fonts[$font] = 
$data;
 
20794                if (!in_array($font, $this->fontkeys)) {
 
20795                        $this->fontkeys[] = $font;
 
20798                        $this->font_obj_ids[$font] = 
$this->n;
 
20799                        $this->setFontSubBuffer($font, 
'n', $this->n);
 
20812                if (!isset($this->fonts[$font])) {
 
20813                        $this->setFontBuffer($font, array());
 
20815                $this->fonts[$font][$key] = 
$data;
 
20826                if (isset($this->fonts[$font])) {
 
20827                        return $this->fonts[$font];
 
20841                if (($frompage > $this->numpages) OR ($frompage <= $topage)) {
 
20844                if ($frompage == $this->page) {
 
20849                $tmppage = $this->getPageBuffer($frompage);
 
20850                $tmppagedim = $this->pagedim[$frompage];
 
20851                $tmppagelen = $this->pagelen[$frompage];
 
20852                $tmpintmrk = $this->intmrk[$frompage];
 
20853                $tmpbordermrk = $this->bordermrk[$frompage];
 
20854                $tmpcntmrk = $this->cntmrk[$frompage];
 
20855                $tmppageobjects = $this->pageobjects[$frompage];
 
20856                if (isset($this->footerpos[$frompage])) {
 
20857                        $tmpfooterpos = $this->footerpos[$frompage];
 
20859                if (isset($this->footerlen[$frompage])) {
 
20860                        $tmpfooterlen = $this->footerlen[$frompage];
 
20862                if (isset($this->transfmrk[$frompage])) {
 
20863                        $tmptransfmrk = $this->transfmrk[$frompage];
 
20865                if (isset($this->PageAnnots[$frompage])) {
 
20866                        $tmpannots = $this->PageAnnots[$frompage];
 
20868                if (isset($this->newpagegroup) AND !empty($this->newpagegroup)) {
 
20869                        for ($i = $frompage; $i > $topage; --$i) {
 
20870                                if (isset($this->newpagegroup[$i]) AND (($i + $this->pagegroups[$this->newpagegroup[$i]]) > $frompage)) {
 
20871                                        --$this->pagegroups[$this->newpagegroup[$i]];
 
20875                        for ($i = $topage; $i > 0; --$i) {
 
20876                                if (isset($this->newpagegroup[$i]) AND (($i + $this->pagegroups[$this->newpagegroup[$i]]) > $topage)) {
 
20877                                        ++$this->pagegroups[$this->newpagegroup[$i]];
 
20882                for ($i = $frompage; $i > $topage; --$i) {
 
20885                        $this->setPageBuffer($i, $this->getPageBuffer($j));
 
20886                        $this->pagedim[$i] = $this->pagedim[$j];
 
20887                        $this->pagelen[$i] = $this->pagelen[$j];
 
20888                        $this->intmrk[$i] = $this->intmrk[$j];
 
20889                        $this->bordermrk[$i] = $this->bordermrk[$j];
 
20890                        $this->cntmrk[$i] = $this->cntmrk[$j];
 
20891                        $this->pageobjects[$i] = $this->pageobjects[$j];
 
20892                        if (isset($this->footerpos[$j])) {
 
20893                                $this->footerpos[$i] = $this->footerpos[$j];
 
20894                        } elseif (isset($this->footerpos[$i])) {
 
20895                                unset($this->footerpos[$i]);
 
20897                        if (isset($this->footerlen[$j])) {
 
20898                                $this->footerlen[$i] = $this->footerlen[$j];
 
20899                        } elseif (isset($this->footerlen[$i])) {
 
20900                                unset($this->footerlen[$i]);
 
20902                        if (isset($this->transfmrk[$j])) {
 
20903                                $this->transfmrk[$i] = $this->transfmrk[$j];
 
20904                        } elseif (isset($this->transfmrk[$i])) {
 
20905                                unset($this->transfmrk[$i]);
 
20907                        if (isset($this->PageAnnots[$j])) {
 
20908                                $this->PageAnnots[$i] = $this->PageAnnots[$j];
 
20909                        } elseif (isset($this->PageAnnots[$i])) {
 
20910                                unset($this->PageAnnots[$i]);
 
20912                        if (isset($this->newpagegroup[$j])) {
 
20913                                $this->newpagegroup[$i] = $this->newpagegroup[$j];
 
20914                                unset($this->newpagegroup[$j]);
 
20916                        if ($this->currpagegroup == $j) {
 
20917                                $this->currpagegroup = $i;
 
20920                $this->setPageBuffer($topage, $tmppage);
 
20921                $this->pagedim[$topage] = $tmppagedim;
 
20922                $this->pagelen[$topage] = $tmppagelen;
 
20923                $this->intmrk[$topage] = $tmpintmrk;
 
20924                $this->bordermrk[$topage] = $tmpbordermrk;
 
20925                $this->cntmrk[$topage] = $tmpcntmrk;
 
20926                $this->pageobjects[$topage] = $tmppageobjects;
 
20927                if (isset($tmpfooterpos)) {
 
20928                        $this->footerpos[$topage] = $tmpfooterpos;
 
20929                } elseif (isset($this->footerpos[$topage])) {
 
20930                        unset($this->footerpos[$topage]);
 
20932                if (isset($tmpfooterlen)) {
 
20933                        $this->footerlen[$topage] = $tmpfooterlen;
 
20934                } elseif (isset($this->footerlen[$topage])) {
 
20935                        unset($this->footerlen[$topage]);
 
20937                if (isset($tmptransfmrk)) {
 
20938                        $this->transfmrk[$topage] = $tmptransfmrk;
 
20939                } elseif (isset($this->transfmrk[$topage])) {
 
20940                        unset($this->transfmrk[$topage]);
 
20942                if (isset($tmpannots)) {
 
20943                        $this->PageAnnots[$topage] = $tmpannots;
 
20944                } elseif (isset($this->PageAnnots[$topage])) {
 
20945                        unset($this->PageAnnots[$topage]);
 
20948                $tmpoutlines = $this->outlines;
 
20949                foreach ($tmpoutlines as $key => $outline) {
 
20950                        if (!$outline[
'f']) {
 
20951                                if (($outline[
'p'] >= $topage) AND ($outline[
'p'] < $frompage)) {
 
20952                                        $this->outlines[$key][
'p'] = ($outline[
'p'] + 1);
 
20953                                } elseif ($outline[
'p'] == $frompage) {
 
20954                                        $this->outlines[$key][
'p'] = $topage;
 
20959                $tmpdests = $this->dests;
 
20960                foreach ($tmpdests as $key => $dest) {
 
20962                                if (($dest[
'p'] >= $topage) AND ($dest[
'p'] < $frompage)) {
 
20963                                        $this->dests[$key][
'p'] = ($dest[
'p'] + 1);
 
20964                                } elseif ($dest[
'p'] == $frompage) {
 
20965                                        $this->dests[$key][
'p'] = $topage;
 
20970                $tmplinks = $this->links;
 
20971                foreach ($tmplinks as $key => $link) {
 
20973                                if (($link[
'p'] >= $topage) AND ($link[
'p'] < $frompage)) {
 
20974                                        $this->links[$key][
'p'] = ($link[
'p'] + 1);
 
20975                                } elseif ($link[
'p'] == $frompage) {
 
20976                                        $this->links[$key][
'p'] = $topage;
 
20981                $jfrompage = $frompage;
 
20982                $jtopage = $topage;
 
20983                if (preg_match_all(
'/this\.addField\(\'([^\']*)\',\'([^\']*)\',([0-9]+)/', $this->javascript, $pamatch) > 0) {
 
20984                        foreach($pamatch[0] as $pk => $pmatch) {
 
20985                                $pagenum = intval($pamatch[3][$pk]) + 1;
 
20986                                if (($pagenum >= $jtopage) AND ($pagenum < $jfrompage)) {
 
20987                                        $newpage = ($pagenum + 1);
 
20988                                } elseif ($pagenum == $jfrompage) {
 
20989                                        $newpage = $jtopage;
 
20991                                        $newpage = $pagenum;
 
20994                                $newjs = 
"this.addField(\'".$pamatch[1][$pk].
"\',\'".$pamatch[2][$pk].
"\',".$newpage;
 
20995                                $this->javascript = str_replace($pmatch, $newjs, $this->javascript);
 
21000                $this->lastPage(
true);
 
21012                if (($page < 1) OR ($page > $this->numpages)) {
 
21016                unset($this->pages[$page]);
 
21017                unset($this->pagedim[$page]);
 
21018                unset($this->pagelen[$page]);
 
21019                unset($this->intmrk[$page]);
 
21020                unset($this->bordermrk[$page]);
 
21021                unset($this->cntmrk[$page]);
 
21022                foreach ($this->pageobjects[$page] as $oid) {
 
21023                        if (isset($this->offsets[$oid])){
 
21024                                unset($this->offsets[$oid]);
 
21027                unset($this->pageobjects[$page]);
 
21028                if (isset($this->footerpos[$page])) {
 
21029                        unset($this->footerpos[$page]);
 
21031                if (isset($this->footerlen[$page])) {
 
21032                        unset($this->footerlen[$page]);
 
21034                if (isset($this->transfmrk[$page])) {
 
21035                        unset($this->transfmrk[$page]);
 
21037                if (isset($this->PageAnnots[$page])) {
 
21038                        unset($this->PageAnnots[$page]);
 
21040                if (isset($this->newpagegroup) AND !empty($this->newpagegroup)) {
 
21041                        for ($i = $page; $i > 0; --$i) {
 
21042                                if (isset($this->newpagegroup[$i]) AND (($i + $this->pagegroups[$this->newpagegroup[$i]]) > $page)) {
 
21043                                        --$this->pagegroups[$this->newpagegroup[$i]];
 
21048                if (isset($this->pageopen[$page])) {
 
21049                        unset($this->pageopen[$page]);
 
21051                if ($page < $this->numpages) {
 
21053                        for ($i = $page; $i < $this->numpages; ++$i) {
 
21056                                $this->setPageBuffer($i, $this->getPageBuffer($j));
 
21057                                $this->pagedim[$i] = $this->pagedim[$j];
 
21058                                $this->pagelen[$i] = $this->pagelen[$j];
 
21059                                $this->intmrk[$i] = $this->intmrk[$j];
 
21060                                $this->bordermrk[$i] = $this->bordermrk[$j];
 
21061                                $this->cntmrk[$i] = $this->cntmrk[$j];
 
21062                                $this->pageobjects[$i] = $this->pageobjects[$j];
 
21063                                if (isset($this->footerpos[$j])) {
 
21064                                        $this->footerpos[$i] = $this->footerpos[$j];
 
21065                                } elseif (isset($this->footerpos[$i])) {
 
21066                                        unset($this->footerpos[$i]);
 
21068                                if (isset($this->footerlen[$j])) {
 
21069                                        $this->footerlen[$i] = $this->footerlen[$j];
 
21070                                } elseif (isset($this->footerlen[$i])) {
 
21071                                        unset($this->footerlen[$i]);
 
21073                                if (isset($this->transfmrk[$j])) {
 
21074                                        $this->transfmrk[$i] = $this->transfmrk[$j];
 
21075                                } elseif (isset($this->transfmrk[$i])) {
 
21076                                        unset($this->transfmrk[$i]);
 
21078                                if (isset($this->PageAnnots[$j])) {
 
21079                                        $this->PageAnnots[$i] = $this->PageAnnots[$j];
 
21080                                } elseif (isset($this->PageAnnots[$i])) {
 
21081                                        unset($this->PageAnnots[$i]);
 
21083                                if (isset($this->newpagegroup[$j])) {
 
21084                                        $this->newpagegroup[$i] = $this->newpagegroup[$j];
 
21085                                        unset($this->newpagegroup[$j]);
 
21087                                if ($this->currpagegroup == $j) {
 
21088                                        $this->currpagegroup = $i;
 
21090                                if (isset($this->pageopen[$j])) {
 
21091                                        $this->pageopen[$i] = $this->pageopen[$j];
 
21092                                } elseif (isset($this->pageopen[$i])) {
 
21093                                        unset($this->pageopen[$i]);
 
21097                        unset($this->pages[$this->numpages]);
 
21098                        unset($this->pagedim[$this->numpages]);
 
21099                        unset($this->pagelen[$this->numpages]);
 
21100                        unset($this->intmrk[$this->numpages]);
 
21101                        unset($this->bordermrk[$this->numpages]);
 
21102                        unset($this->cntmrk[$this->numpages]);
 
21103                        foreach ($this->pageobjects[$this->numpages] as $oid) {
 
21104                                if (isset($this->offsets[$oid])){
 
21105                                        unset($this->offsets[$oid]);
 
21108                        unset($this->pageobjects[$this->numpages]);
 
21109                        if (isset($this->footerpos[$this->numpages])) {
 
21110                                unset($this->footerpos[$this->numpages]);
 
21112                        if (isset($this->footerlen[$this->numpages])) {
 
21113                                unset($this->footerlen[$this->numpages]);
 
21115                        if (isset($this->transfmrk[$this->numpages])) {
 
21116                                unset($this->transfmrk[$this->numpages]);
 
21118                        if (isset($this->PageAnnots[$this->numpages])) {
 
21119                                unset($this->PageAnnots[$this->numpages]);
 
21121                        if (isset($this->newpagegroup[$this->numpages])) {
 
21122                                unset($this->newpagegroup[$this->numpages]);
 
21124                        if ($this->currpagegroup == $this->numpages) {
 
21125                                $this->currpagegroup = ($this->numpages - 1);
 
21127                        if (isset($this->pagegroups[$this->numpages])) {
 
21128                                unset($this->pagegroups[$this->numpages]);
 
21130                        if (isset($this->pageopen[$this->numpages])) {
 
21131                                unset($this->pageopen[$this->numpages]);
 
21135                $this->page = $this->numpages;
 
21137                $tmpoutlines = $this->outlines;
 
21138                foreach ($tmpoutlines as $key => $outline) {
 
21139                        if (!$outline[
'f']) {
 
21140                                if ($outline[
'p'] > $page) {
 
21141                                        $this->outlines[$key][
'p'] = $outline[
'p'] - 1;
 
21142                                } elseif ($outline[
'p'] == $page) {
 
21143                                        unset($this->outlines[$key]);
 
21148                $tmpdests = $this->dests;
 
21149                foreach ($tmpdests as $key => $dest) {
 
21151                                if ($dest[
'p'] > $page) {
 
21152                                        $this->dests[$key][
'p'] = $dest[
'p'] - 1;
 
21153                                } elseif ($dest[
'p'] == $page) {
 
21154                                        unset($this->dests[$key]);
 
21159                $tmplinks = $this->links;
 
21160                foreach ($tmplinks as $key => $link) {
 
21162                                if ($link[
'p'] > $page) {
 
21163                                        $this->links[$key][
'p'] = $link[
'p'] - 1;
 
21164                                } elseif ($link[
'p'] == $page) {
 
21165                                        unset($this->links[$key]);
 
21171                if (preg_match_all(
'/this\.addField\(\'([^\']*)\',\'([^\']*)\',([0-9]+)/', $this->javascript, $pamatch) > 0) {
 
21172                        foreach($pamatch[0] as $pk => $pmatch) {
 
21173                                $pagenum = intval($pamatch[3][$pk]) + 1;
 
21174                                if ($pagenum >= $jpage) {
 
21175                                        $newpage = ($pagenum - 1);
 
21176                                } elseif ($pagenum == $jpage) {
 
21179                                        $newpage = $pagenum;
 
21182                                $newjs = 
"this.addField(\'".$pamatch[1][$pk].
"\',\'".$pamatch[2][$pk].
"\',".$newpage;
 
21183                                $this->javascript = str_replace($pmatch, $newjs, $this->javascript);
 
21188                if ($this->numpages > 0) {
 
21189                        $this->lastPage(
true);
 
21204                        $page = $this->page;
 
21206                if (($page < 1) OR ($page > $this->numpages)) {
 
21213                $this->page = $this->numpages;
 
21214                $this->setPageBuffer($this->page, $this->getPageBuffer($page));
 
21215                $this->pagedim[$this->page] = $this->pagedim[$page];
 
21216                $this->pagelen[$this->page] = $this->pagelen[$page];
 
21217                $this->intmrk[$this->page] = $this->intmrk[$page];
 
21218                $this->bordermrk[$this->page] = $this->bordermrk[$page];
 
21219                $this->cntmrk[$this->page] = $this->cntmrk[$page];
 
21220                $this->pageobjects[$this->page] = $this->pageobjects[$page];
 
21221                $this->pageopen[$this->page] = 
false;
 
21222                if (isset($this->footerpos[$page])) {
 
21223                        $this->footerpos[$this->page] = $this->footerpos[$page];
 
21225                if (isset($this->footerlen[$page])) {
 
21226                        $this->footerlen[$this->page] = $this->footerlen[$page];
 
21228                if (isset($this->transfmrk[$page])) {
 
21229                        $this->transfmrk[$this->page] = $this->transfmrk[$page];
 
21231                if (isset($this->PageAnnots[$page])) {
 
21232                        $this->PageAnnots[$this->page] = $this->PageAnnots[$page];
 
21234                if (isset($this->newpagegroup[$page])) {
 
21236                        $this->newpagegroup[$this->page] = 
sizeof($this->newpagegroup) + 1;
 
21237                        $this->currpagegroup = $this->newpagegroup[$this->page];
 
21238                        $this->pagegroups[$this->currpagegroup] = 1;
 
21239                } elseif (isset($this->currpagegroup) AND ($this->currpagegroup > 0)) {
 
21240                        ++$this->pagegroups[$this->currpagegroup];
 
21243                $tmpoutlines = $this->outlines;
 
21244                foreach ($tmpoutlines as $key => $outline) {
 
21245                        if ($outline[
'p'] == $page) {
 
21246                                $this->outlines[] = array(
't' => $outline[
't'], 
'l' => $outline[
'l'], 
'x' => $outline[
'x'], 
'y' => $outline[
'y'], 
'p' => $this->page, 
'f' => $outline[
'f'], 
's' => $outline[
's'], 
'c' => $outline[
'c']);
 
21250                $tmplinks = $this->links;
 
21251                foreach ($tmplinks as $key => $link) {
 
21252                        if ($link[
'p'] == $page) {
 
21253                                $this->links[] = array(
'p' => $this->page, 
'y' => $link[
'y'], 
'f' => $link[
'f']);
 
21257                $this->lastPage(
true);
 
21278        public function addTOC($page=
'', $numbersfont=
'', $filler=
'.', $toc_name=
'TOC', 
$style=
'', $color=array(0,0,0)) {
 
21279                $fontsize = $this->FontSizePt;
 
21280                $fontfamily = $this->FontFamily;
 
21281                $fontstyle = $this->FontStyle;
 
21282                $w = $this->w - $this->lMargin - $this->rMargin;
 
21283                $spacer = $this->GetStringWidth(chr(32)) * 4;
 
21284                $lmargin = $this->lMargin;
 
21285                $rmargin = $this->rMargin;
 
21286                $x_start = $this->GetX();
 
21287                $page_first = $this->page;
 
21288                $current_page = $this->page;
 
21289                $page_fill_start = 
false;
 
21290                $page_fill_end = 
false;
 
21291                $current_column = $this->current_column;
 
21293                        $numbersfont = $this->default_monospaced_font;
 
21306                $this->SetFont($numbersfont, $fontstyle, $fontsize);
 
21307                $numwidth = $this->GetStringWidth(
'00000');
 
21309                foreach ($this->outlines as $key => $outline) {
 
21311                        if (($this->page > $page_first) AND ($outline[
'p'] >= $this->numpages)) {
 
21312                                $outline[
'p'] += ($this->page - $page_first);
 
21321                        if ($outline[
'l'] == 0) {
 
21322                                $this->SetFont($fontfamily, $outline[
's'].
'B', $fontsize);
 
21324                                $this->SetFont($fontfamily, $outline[
's'], $fontsize - $outline[
'l']);
 
21326                        $this->SetTextColorArray($outline[
'c']);
 
21328                        $this->checkPageBreak(2 * $this->getCellHeight($this->FontSize));
 
21330                        if (($this->page == $current_page) AND ($this->current_column == $current_column)) {
 
21331                                $this->lMargin = $lmargin;
 
21332                                $this->rMargin = $rmargin;
 
21334                                if ($this->current_column != $current_column) {
 
21336                                                $x_start = $this->w - $this->columns[$this->current_column][
'x'];
 
21338                                                $x_start = $this->columns[$this->current_column][
'x'];
 
21341                                $lmargin = $this->lMargin;
 
21342                                $rmargin = $this->rMargin;
 
21343                                $current_page = $this->page;
 
21344                                $current_column = $this->current_column;
 
21346                        $this->SetX($x_start);
 
21347                        $indent = ($spacer * $outline[
'l']);
 
21349                                $this->x -= $indent;
 
21350                                $this->rMargin = $this->w - 
$this->x;
 
21352                                $this->x += $indent;
 
21355                        $link = $this->AddLink();
 
21356                        $this->SetLink($link, $outline[
'y'], $outline[
'p']);
 
21359                                $txt = 
' '.$outline[
't'];
 
21361                                $txt = $outline[
't'].
' ';
 
21363                        $this->Write(0, 
$txt, $link, 
false, $aligntext, 
false, 0, 
false, 
false, 0, $numwidth, 
'');
 
21365                                $tw = $this->x - $this->lMargin;
 
21367                                $tw = $this->w - $this->rMargin - 
$this->x;
 
21369                        $this->SetFont($numbersfont, $fontstyle, $fontsize);
 
21371                                $pagenum = $outline[
'p'];
 
21374                                $pagenum = 
'{#'.($outline[
'p']).
'}';
 
21375                                if ($this->isUnicodeFont()) {
 
21376                                        $pagenum = 
'{'.$pagenum.
'}';
 
21378                                $maxpage = max($maxpage, $outline[
'p']);
 
21380                        $fw = ($tw - $this->GetStringWidth($pagenum.$filler));
 
21381                        $wfiller = $this->GetStringWidth($filler);
 
21382                        if ($wfiller > 0) {
 
21383                                $numfills = floor($fw / $wfiller);
 
21387                        if ($numfills > 0) {
 
21388                                $rowfill = str_repeat($filler, $numfills);
 
21393                                $pagenum = $pagenum.$gap.$rowfill;
 
21395                                $pagenum = $rowfill.$gap.$pagenum;
 
21398                        $this->Cell($tw, 0, $pagenum, 0, 1, $alignnum, 0, $link, 0);
 
21400                $page_last = $this->getPage();
 
21401                $numpages = ($page_last - $page_first + 1);
 
21403                if ($this->booklet) {
 
21405                        $page_fill_start = ((($page_first % 2) == 0) XOR (($page % 2) == 0));
 
21406                        $page_fill_end = (!((($numpages % 2) == 0) XOR ($page_fill_start)));
 
21407                        if ($page_fill_start) {
 
21413                        if ($page_fill_end) {
 
21420                $maxpage = max($maxpage, $page_last);
 
21422                        for ($p = $page_first; $p <= $page_last; ++$p) {
 
21424                                $temppage = $this->getPageBuffer($p);
 
21425                                for (
$n = 1; 
$n <= $maxpage; ++
$n) {
 
21429                                        $pnalias = $this->getInternalPageNumberAliases($a);
 
21431                                        if ((
$n >= $page) AND ($n <= $this->numpages)) {
 
21432                                                $np = 
$n + $numpages;
 
21439                                        foreach ($pnalias[
'u'] as $u) {
 
21440                                                $sfill = str_repeat($filler, max(0, (strlen($u) - strlen($nu.
' '))));
 
21442                                                        $nr = $nu.TCPDF_FONTS::UTF8ToUTF16BE(
' '.$sfill, 
false, $this->isunicode, $this->CurrentFont);
 
21446                                                $temppage = str_replace($u, $nr, $temppage);
 
21448                                        foreach ($pnalias[
'a'] as $a) {
 
21449                                                $sfill = str_repeat($filler, max(0, (strlen($a) - strlen($na.
' '))));
 
21451                                                        $nr = $na.
' '.$sfill;
 
21453                                                        $nr = $sfill.
' '.$na;
 
21455                                                $temppage = str_replace($a, $nr, $temppage);
 
21459                                $this->setPageBuffer($p, $temppage);
 
21462                        $this->Bookmark($toc_name, 0, 0, $page_first, 
$style, $color);
 
21463                        if ($page_fill_start) {
 
21464                                $this->movePage($page_last, $page_first);
 
21466                        for ($i = 0; $i < $numpages; ++$i) {
 
21467                                $this->movePage($page_last, $page);
 
21488        public function addHTMLTOC($page=
'', $toc_name=
'TOC', $templates=array(), $correct_align=
true, 
$style=
'', $color=array(0,0,0)) {
 
21490                $prev_htmlLinkColorArray = $this->htmlLinkColorArray;
 
21491                $prev_htmlLinkFontStyle = $this->htmlLinkFontStyle;
 
21493                $this->htmlLinkColorArray = array();
 
21494                $this->htmlLinkFontStyle = 
'';
 
21495                $page_first = $this->getPage();
 
21496                $page_fill_start = 
false;
 
21497                $page_fill_end = 
false;
 
21499                $current_font = $this->FontFamily;
 
21500                foreach ($templates as $level => 
$html) {
 
21501                        $dom = $this->getHtmlDomArray(
$html);
 
21502                        foreach ($dom as $key => $value) {
 
21503                                if ($value[
'value'] == 
'#TOC_PAGE_NUMBER#') {
 
21504                                        $this->SetFont($dom[($key - 1)][
'fontname']);
 
21505                                        $templates[
'F'.$level] = $this->isUnicodeFont();
 
21509                $this->SetFont($current_font);
 
21511                foreach ($this->outlines as $key => $outline) {
 
21513                        $row = $templates[$outline[
'l']];
 
21515                                $pagenum = $outline[
'p'];
 
21518                                $pagenum = 
'{#'.($outline[
'p']).
'}';
 
21519                                if ($templates[
'F'.$outline[
'l']]) {
 
21520                                        $pagenum = 
'{'.$pagenum.
'}';
 
21522                                $maxpage = max($maxpage, $outline[
'p']);
 
21525                        $row = str_replace(
'#TOC_DESCRIPTION#', $outline[
't'], 
$row);
 
21526                        $row = str_replace(
'#TOC_PAGE_NUMBER#', $pagenum, 
$row);
 
21528                        $row = 
'<a href="#'.$outline[
'p'].
','.$outline[
'y'].
'">'.
$row.
'</a>';
 
21530                        $this->writeHTML(
$row, 
false, 
false, 
true, 
false, 
'');
 
21533                $this->htmlLinkColorArray = $prev_htmlLinkColorArray;
 
21534                $this->htmlLinkFontStyle = $prev_htmlLinkFontStyle;
 
21536                $page_last = $this->getPage();
 
21537                $numpages = ($page_last - $page_first + 1);
 
21539                if ($this->booklet) {
 
21541                        $page_fill_start = ((($page_first % 2) == 0) XOR (($page % 2) == 0));
 
21542                        $page_fill_end = (!((($numpages % 2) == 0) XOR ($page_fill_start)));
 
21543                        if ($page_fill_start) {
 
21549                        if ($page_fill_end) {
 
21556                $maxpage = max($maxpage, $page_last);
 
21558                        for ($p = $page_first; $p <= $page_last; ++$p) {
 
21560                                $temppage = $this->getPageBuffer($p);
 
21561                                for (
$n = 1; 
$n <= $maxpage; ++
$n) {
 
21565                                        $pnalias = $this->getInternalPageNumberAliases($a);
 
21568                                                $np = 
$n + $numpages;
 
21575                                        foreach ($pnalias[
'u'] as $u) {
 
21576                                                if ($correct_align) {
 
21577                                                        $sfill = str_repeat($filler, (strlen($u) - strlen($nu.
' ')));
 
21579                                                                $nr = $nu.TCPDF_FONTS::UTF8ToUTF16BE(
' '.$sfill, 
false, $this->isunicode, $this->CurrentFont);
 
21586                                                $temppage = str_replace($u, $nr, $temppage);
 
21588                                        foreach ($pnalias[
'a'] as $a) {
 
21589                                                if ($correct_align) {
 
21590                                                        $sfill = str_repeat($filler, (strlen($a) - strlen($na.
' ')));
 
21592                                                                $nr = $na.
' '.$sfill;
 
21594                                                                $nr = $sfill.
' '.$na;
 
21599                                                $temppage = str_replace($a, $nr, $temppage);
 
21603                                $this->setPageBuffer($p, $temppage);
 
21606                        $this->Bookmark($toc_name, 0, 0, $page_first, 
$style, $color);
 
21607                        if ($page_fill_start) {
 
21608                                $this->movePage($page_last, $page_first);
 
21610                        for ($i = 0; $i < $numpages; ++$i) {
 
21611                                $this->movePage($page_last, $page);
 
21622                if (isset($this->objcopy)) {
 
21624                        $this->commitTransaction();
 
21627                $this->start_transaction_page = $this->page;
 
21628                $this->start_transaction_y = 
$this->y;
 
21639                if (isset($this->objcopy)) {
 
21640                        $this->objcopy->_destroy(
true, 
true);
 
21641                        unset($this->objcopy);
 
21653                if (isset($this->objcopy)) {
 
21654                        $this->_destroy(
true, 
true);
 
21656                                $objvars = get_object_vars($this->objcopy);
 
21657                                foreach ($objvars as $key => $value) {
 
21658                                        $this->$key = $value;
 
21661                        return $this->objcopy;
 
21677                $this->columns = array();
 
21678                if ($numcols < 2) {
 
21680                        $this->columns = array();
 
21683                        $maxwidth = ($this->w - $this->original_lMargin - $this->original_rMargin) / $numcols;
 
21684                        if (($width == 0) OR ($width > $maxwidth)) {
 
21685                                $width = $maxwidth;
 
21691                        $space = (($this->w - $this->original_lMargin - $this->original_rMargin - ($numcols * $width)) / ($numcols - 1));
 
21693                        for ($i = 0; $i < $numcols; ++$i) {
 
21694                                $this->columns[$i] = array(
'w' => $width, 
's' => 
$space, 
'y' => 
$y);
 
21697                $this->num_columns = $numcols;
 
21698                $this->current_column = 0;
 
21699                $this->column_start_page = $this->page;
 
21700                $this->selectColumn(0);
 
21709                $this->lMargin = $this->original_lMargin;
 
21710                $this->rMargin = $this->original_rMargin;
 
21711                $this->setEqualColumns();
 
21723                $this->num_columns = count(
$columns);
 
21724                $this->current_column = 0;
 
21725                $this->column_start_page = $this->page;
 
21726                $this->selectColumn(0);
 
21736                if (is_string($col)) {
 
21737                        $col = $this->current_column;
 
21738                } elseif ($col >= $this->num_columns) {
 
21741                $xshift = array(
'x' => 0, 
's' => array(
'H' => 0, 
'V' => 0), 
'p' => array(
'L' => 0, 
'T' => 0, 
'R' => 0, 
'B' => 0));
 
21742                $enable_thead = 
false;
 
21743                if ($this->num_columns > 1) {
 
21744                        if ($col != $this->current_column) {
 
21746                                if ($this->column_start_page == $this->page) {
 
21747                                        $this->y = $this->columns[$col][
'y'];
 
21749                                        $this->y = $this->tMargin;
 
21752                                if (($this->page > $this->maxselcol[
'page']) OR (($this->page == $this->maxselcol[
'page']) AND ($col > $this->maxselcol[
'column']))) {
 
21753                                        $enable_thead = 
true;
 
21754                                        $this->maxselcol[
'page'] = $this->page;
 
21755                                        $this->maxselcol[
'column'] = $col;
 
21758                        $xshift = $this->colxshift;
 
21760                        $listindent = ($this->listindentlevel * $this->listindent);
 
21763                        for ($i = 0; $i < $col; ++$i) {
 
21764                                $colpos += ($this->columns[$i][
'w'] + $this->columns[$i][
's']);
 
21767                                $x = $this->w - $this->original_rMargin - $colpos;
 
21768                                $this->rMargin = ($this->w - 
$x + $listindent);
 
21769                                $this->lMargin = (
$x - $this->columns[$col][
'w']);
 
21770                                $this->x = 
$x - $listindent;
 
21772                                $x = $this->original_lMargin + $colpos;
 
21773                                $this->lMargin = (
$x + $listindent);
 
21774                                $this->rMargin = ($this->w - 
$x - $this->columns[$col][
'w']);
 
21775                                $this->x = 
$x + $listindent;
 
21777                        $this->columns[$col][
'x'] = 
$x;
 
21779                $this->current_column = $col;
 
21781                $this->newline = 
true;
 
21784                        if ($enable_thead) {
 
21786                                $this->writeHTML($this->thead, 
false, 
false, 
false, 
false, 
'');
 
21787                                $this->y += $xshift[
's'][
'V'];
 
21789                                if (!isset($this->columns[$col][
'th'])) {
 
21790                                        $this->columns[$col][
'th'] = array();
 
21792                                $this->columns[$col][
'th'][
'\''.$this->page.
'\''] = 
$this->y;
 
21794                        } elseif (isset($this->columns[$col][
'th'][
'\''.$this->page.
'\''])) {
 
21795                                $this->y = $this->columns[$col][
'th'][
'\''.$this->page.
'\''];
 
21800                        $this->rMargin += $xshift[
'x'];
 
21801                        $this->x -= ($xshift[
'x'] + $xshift[
'p'][
'R']);
 
21803                        $this->lMargin += $xshift[
'x'];
 
21804                        $this->x += $xshift[
'x'] + $xshift[
'p'][
'L'];
 
21815                return $this->current_column;
 
21825                return $this->num_columns;
 
21842                if ($fill === 
true) {
 
21844                                if ($clip === 
true) {
 
21846                                        $textrendermode = 6;
 
21849                                        $textrendermode = 2;
 
21851                                $textstrokewidth = $stroke;
 
21853                                if ($clip === 
true) {
 
21855                                        $textrendermode = 4;
 
21858                                        $textrendermode = 0;
 
21863                                if ($clip === 
true) {
 
21865                                        $textrendermode = 5;
 
21868                                        $textrendermode = 1;
 
21870                                $textstrokewidth = $stroke;
 
21872                                if ($clip === 
true) {
 
21874                                        $textrendermode = 7;
 
21877                                        $textrendermode = 3;
 
21881                $this->textrendermode = $textrendermode;
 
21882                $this->textstrokewidth = $stroke;
 
21891        public function setTextShadow(
$params=array(
'enabled'=>
false, 
'depth_w'=>0, 
'depth_h'=>0, 
'color'=>
false, 
'opacity'=>1, 
'blend_mode'=>
'Normal')) {
 
21892                if (isset(
$params[
'enabled'])) {
 
21893                        $this->txtshadow[
'enabled'] = 
$params[
'enabled']?
true:
false;
 
21895                        $this->txtshadow[
'enabled'] = 
false;
 
21897                if (isset(
$params[
'depth_w'])) {
 
21898                        $this->txtshadow[
'depth_w'] = floatval(
$params[
'depth_w']);
 
21900                        $this->txtshadow[
'depth_w'] = 0;
 
21902                if (isset(
$params[
'depth_h'])) {
 
21903                        $this->txtshadow[
'depth_h'] = floatval(
$params[
'depth_h']);
 
21905                        $this->txtshadow[
'depth_h'] = 0;
 
21908                        $this->txtshadow[
'color'] = 
$params[
'color'];
 
21910                        $this->txtshadow[
'color'] = $this->strokecolor;
 
21912                if (isset(
$params[
'opacity'])) {
 
21913                        $this->txtshadow[
'opacity'] = min(1, max(0, floatval(
$params[
'opacity'])));
 
21915                        $this->txtshadow[
'opacity'] = 1;
 
21917                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'))) {
 
21918                        $this->txtshadow[
'blend_mode'] = 
$params[
'blend_mode'];
 
21920                        $this->txtshadow[
'blend_mode'] = 
'Normal';
 
21922                if ((($this->txtshadow[
'depth_w'] == 0) AND ($this->txtshadow[
'depth_h'] == 0)) OR ($this->txtshadow[
'opacity'] == 0)) {
 
21923                        $this->txtshadow[
'enabled'] = 
false;
 
21934                return $this->txtshadow;
 
21951        protected function hyphenateWord($word, $patterns, $dictionary=array(), $leftmin=1, $rightmin=2, $charmin=1, $charmax=8) {
 
21952                $hyphenword = array(); 
 
21953                $numchars = count($word);
 
21954                if ($numchars <= $charmin) {
 
21959                $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})(\]?)$/';
 
21960                if (preg_match($pattern, $word_string) > 0) {
 
21964                $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})(\]?)$/';
 
21965                if (preg_match($pattern, $word_string) > 0) {
 
21969                if (isset($dictionary[$word_string])) {
 
21973                $tmpword = array_merge(array(46), $word, array(46));
 
21974                $tmpnumchars = $numchars + 2;
 
21975                $maxpos = $tmpnumchars - 1;
 
21976                for ($pos = 0; $pos < $maxpos; ++$pos) {
 
21977                        $imax = min(($tmpnumchars - $pos), $charmax);
 
21978                        for ($i = 1; $i <= $imax; ++$i) {
 
21980                                if (isset($patterns[$subword])) {
 
21982                                        $pattern_length = count($pattern);
 
21984                                        for ($j = 0; $j < $pattern_length; ++$j) {
 
21986                                                if (($pattern[$j] >= 48) AND ($pattern[$j] <= 57)) {
 
21990                                                                $zero = $pos + $j - $digits;
 
21993                                                        $level = ($pattern[$j] - 48);
 
21995                                                        if (!isset($hyphenword[$zero]) OR ($hyphenword[$zero] < $level)) {
 
21996                                                                $hyphenword[$zero] = $level;
 
22005                $maxpos = $numchars - $rightmin;
 
22006                for ($i = $leftmin; $i <= $maxpos; ++$i) {
 
22008                        if (isset($hyphenword[$i]) AND (($hyphenword[$i] % 2) != 0)) {
 
22010                                array_splice($word, $i + $inserted, 0, 173);
 
22031        public function hyphenateText(
$text, $patterns, $dictionary=array(), $leftmin=1, $rightmin=2, $charmin=1, $charmax=8) {
 
22037                if (!is_array($patterns)) {
 
22043                foreach ($unichars as $char) {
 
22051                                        $txtarr = array_merge($txtarr, $this->hyphenateWord($word, $patterns, $dictionary, $leftmin, $rightmin, $charmin, $charmax));
 
22055                                if (chr($char) == 
'<') {
 
22058                                } elseif ($intag AND (chr($char) == 
'>')) {
 
22062                                        $expected = array(115, 116, 121, 108, 101); 
 
22063                                        $current = array_slice($txtarr, -6, 5); 
 
22064                                        $compare = array_diff($expected, $current);
 
22065                                        if (empty($compare)) {
 
22067                                                $expected = array(47); 
 
22068                                                $current = array_slice($txtarr, -7, 1);
 
22069                                                $compare = array_diff($expected, $current);
 
22070                                                if (empty($compare)) {
 
22083                        $txtarr = array_merge($txtarr, $this->hyphenateWord($word, $patterns, $dictionary, $leftmin, $rightmin, $charmin, $charmax));
 
22096                $this->rasterize_vector_images = $mode;
 
22107                if ($this->pdfa_mode) {
 
22108                        $this->font_subsetting = 
false;
 
22110                        $this->font_subsetting = $enable ? true : 
false;
 
22122                return $this->font_subsetting;
 
22135                return preg_replace(
'/^'.$this->re_space[
'p'].
'+/'.$this->re_space[
'm'], $replace, $str);
 
22148                return preg_replace(
'/'.$this->re_space[
'p'].
'+$/'.$this->re_space[
'm'], $replace, $str);
 
22161                $str = $this->stringLeftTrim($str, $replace);
 
22162                $str = $this->stringRightTrim($str, $replace);
 
22174                return (($this->CurrentFont[
'type'] == 
'TrueTypeUnicode') OR ($this->CurrentFont[
'type'] == 
'cidfont0'));
 
22187                $fontfamily = preg_replace(
'/[^a-z0-9_\,]/', 
'', strtolower($fontfamily));
 
22189                $fontslist = preg_split(
'/[,]/', $fontfamily);
 
22191                foreach ($fontslist as $font) {
 
22193                        $font = preg_replace(
'/regular$/', 
'', $font);
 
22194                        $font = preg_replace(
'/italic$/', 
'I', $font);
 
22195                        $font = preg_replace(
'/oblique$/', 
'I', $font);
 
22196                        $font = preg_replace(
'/bold([I]?)$/', 
'B\\1', $font);
 
22198                        $pattern = array();
 
22199                        $replacement = array();
 
22200                        $pattern[] = 
'/^serif|^cursive|^fantasy|^timesnewroman/';
 
22201                        $replacement[] = 
'times';
 
22202                        $pattern[] = 
'/^sansserif/';
 
22203                        $replacement[] = 
'helvetica';
 
22204                        $pattern[] = 
'/^monospace/';
 
22205                        $replacement[] = 
'courier';
 
22206                        $font = preg_replace($pattern, $replacement, $font);
 
22207                        if (in_array(strtolower($font), $this->fontlist) OR in_array($font, $this->fontkeys)) {
 
22212                return $this->CurrentFont[
'fontkey'];
 
22230                if ($this->inxobj) {
 
22234                $this->inxobj = 
true;
 
22237                $this->xobjid = 
'XT'.$this->n;
 
22239                $this->xobjects[$this->xobjid] = array(
'n' => $this->n);
 
22241                $this->xobjects[$this->xobjid][
'gvars'] = $this->getGraphicVars();
 
22243                $this->xobjects[$this->xobjid][
'intmrk'] = 0;
 
22244                $this->xobjects[$this->xobjid][
'transfmrk'] = array();
 
22245                $this->xobjects[$this->xobjid][
'outdata'] = 
'';
 
22246                $this->xobjects[$this->xobjid][
'xobjects'] = array();
 
22247                $this->xobjects[$this->xobjid][
'images'] = array();
 
22248                $this->xobjects[$this->xobjid][
'fonts'] = array();
 
22249                $this->xobjects[$this->xobjid][
'annotations'] = array();
 
22250                $this->xobjects[$this->xobjid][
'extgstates'] = array();
 
22251                $this->xobjects[$this->xobjid][
'gradients'] = array();
 
22252                $this->xobjects[$this->xobjid][
'spot_colors'] = array();
 
22254                $this->num_columns = 1;
 
22255                $this->current_column = 0;
 
22256                $this->SetAutoPageBreak(
false);
 
22257                if ((
$w === 
'') OR (
$w <= 0)) {
 
22258                        $w = $this->w - $this->lMargin - $this->rMargin;
 
22260                if ((
$h === 
'') OR (
$h <= 0)) {
 
22263                $this->xobjects[$this->xobjid][
'x'] = 0;
 
22264                $this->xobjects[$this->xobjid][
'y'] = 0;
 
22265                $this->xobjects[$this->xobjid][
'w'] = 
$w;
 
22266                $this->xobjects[$this->xobjid][
'h'] = 
$h;
 
22269                $this->wPt = $this->w * $this->k;
 
22270                $this->hPt = $this->h * $this->k;
 
22271                $this->fwPt = $this->wPt;
 
22272                $this->fhPt = $this->hPt;
 
22275                $this->lMargin = 0;
 
22276                $this->rMargin = 0;
 
22277                $this->tMargin = 0;
 
22278                $this->bMargin = 0;
 
22280                $this->xobjects[$this->xobjid][
'group'] = $group;
 
22281                return $this->xobjid;
 
22295                if (!$this->inxobj) {
 
22299                $this->inxobj = 
false;
 
22301                $this->setGraphicVars($this->xobjects[$this->xobjid][
'gvars'], 
true);
 
22302                return $this->xobjid;
 
22324                if ($this->state != 2) {
 
22327                if (!isset($this->xobjects[$id])) {
 
22328                        $this->Error(
'The XObject Template \''.$id.
'\' doesn\
't exist!');
 
22330                if ($this->inxobj) {
 
22331                        if ($id == $this->xobjid) {
 
22333                                $this->endTemplate();
 
22336                                $this->xobjects[$this->xobjid][
'xobjects'][$id] = $this->xobjects[$id];
 
22347                list(
$x, 
$y) = $this->checkPageRegions(
$h, 
$x, 
$y);
 
22348                $ow = $this->xobjects[$id][
'w'];
 
22352                $oh = $this->xobjects[$id][
'h'];
 
22357                if ((
$w <= 0) AND (
$h <= 0)) {
 
22360                } elseif (
$w <= 0) {
 
22361                        $w = 
$h * $ow / $oh;
 
22362                } elseif (
$h <= 0) {
 
22363                        $h = 
$w * $oh / $ow;
 
22371                        if ($palign == 
'L') {
 
22372                                $xt = $this->lMargin;
 
22373                        } elseif ($palign == 
'C') {
 
22374                                $xt = ($this->w + $this->lMargin - $this->rMargin - 
$w) / 2;
 
22375                        } elseif ($palign == 
'R') {
 
22376                                $xt = $this->w - $this->rMargin - 
$w;
 
22382                        if ($palign == 
'L') {
 
22383                                $xt = $this->lMargin;
 
22384                        } elseif ($palign == 
'C') {
 
22385                                $xt = ($this->w + $this->lMargin - $this->rMargin - 
$w) / 2;
 
22386                        } elseif ($palign == 
'R') {
 
22387                                $xt = $this->w - $this->rMargin - 
$w;
 
22394                $this->StartTransform();
 
22403                $tm[4] = $xt * $this->k;
 
22404                $tm[5] = ($this->h - 
$h - 
$y) * $this->k;
 
22405                $this->Transform($tm);
 
22407                $this->_out(
'/'.$id.
' Do');
 
22408                $this->StopTransform();
 
22410                if (!empty($this->xobjects[$id][
'annotations'])) {
 
22411                        foreach ($this->xobjects[$id][
'annotations'] as $annot) {
 
22414                                $ax = ($coordlt[4] / $this->k);
 
22415                                $ay = ($this->h - 
$h - ($coordlt[5] / $this->k));
 
22417                                $aw = ($coordrb[4] / $this->k) - $ax;
 
22418                                $ah = ($this->h - 
$h - ($coordrb[5] / $this->k)) - $ay;
 
22419                                $this->Annotation($ax, $ay, $aw, $ah, $annot[
'text'], $annot[
'opt'], $annot[
'spaces']);
 
22430                                $this->y = 
$y + round(
$h/2);
 
22440                                $this->SetY($rb_y);
 
22457                $this->font_stretching = $perc;
 
22468                return $this->font_stretching;
 
22479                $this->font_spacing = $spacing;
 
22490                return $this->font_spacing;
 
22502                return $this->page_regions;
 
22518                $this->page_regions = array();
 
22521                        $this->addPageRegion(
$data);
 
22537                if (!isset($region[
'page']) OR empty($region[
'page'])) {
 
22538                        $region[
'page'] = $this->page;
 
22540                if (isset($region[
'xt']) AND isset($region[
'xb']) AND ($region[
'xt'] > 0) AND ($region[
'xb'] > 0)
 
22541                        AND isset($region[
'yt'])  AND isset($region[
'yb']) AND ($region[
'yt'] >= 0) AND ($region[
'yt'] < $region[
'yb'])
 
22542                        AND isset($region[
'side']) AND (($region[
'side'] == 
'L') OR ($region[
'side'] == 
'R'))) {
 
22543                        $this->page_regions[] = $region;
 
22556                if (isset($this->page_regions[$key])) {
 
22557                        unset($this->page_regions[$key]);
 
22581                if (!$this->check_page_regions OR empty($this->page_regions)) {
 
22583                        return array(
$x, 
$y);
 
22586                        $h = $this->getCellHeight($this->FontSize);
 
22589                if ($this->checkPageBreak(
$h, 
$y)) {
 
22594                if ($this->num_columns > 1) {
 
22596                                $this->lMargin = ($this->columns[$this->current_column][
'x'] - $this->columns[$this->current_column][
'w']);
 
22598                                $this->rMargin = ($this->w - $this->columns[$this->current_column][
'x'] - $this->columns[$this->current_column][
'w']);
 
22602                                $this->lMargin = max($this->clMargin, $this->original_lMargin);
 
22604                                $this->rMargin = max($this->crMargin, $this->original_rMargin);
 
22608                foreach ($this->page_regions as $regid => $regdata) {
 
22609                        if ($regdata[
'page'] == $this->page) {
 
22611                                if ((
$y > ($regdata[
'yt'] - 
$h)) AND (
$y <= $regdata[
'yb'])) {
 
22613                                        $minv = ($regdata[
'xb'] - $regdata[
'xt']) / ($regdata[
'yb'] - $regdata[
'yt']); 
 
22614                                        $yt = max(
$y, $regdata[
'yt']);
 
22615                                        $yb = min(($yt + 
$h), $regdata[
'yb']);
 
22616                                        $xt = (($yt - $regdata[
'yt']) * $minv) + $regdata[
'xt'];
 
22617                                        $xb = (($yb - $regdata[
'yt']) * $minv) + $regdata[
'xt'];
 
22618                                        if ($regdata[
'side'] == 
'L') { 
 
22619                                                $new_margin = max($xt, $xb);
 
22620                                                if ($this->lMargin < $new_margin) {
 
22623                                                                $this->lMargin = max(0, $new_margin);
 
22625                                                        if (
$x < $new_margin) {
 
22628                                                                if ($new_margin > ($this->w - $this->rMargin)) {
 
22630                                                                        $y = $regdata[
'yb'] - 
$h;
 
22634                                        } elseif ($regdata[
'side'] == 
'R') { 
 
22635                                                $new_margin = min($xt, $xb);
 
22636                                                if (($this->w - $this->rMargin) > $new_margin) {
 
22639                                                                $this->rMargin = max(0, ($this->w - $new_margin));
 
22641                                                        if (
$x > $new_margin) {
 
22644                                                                if ($new_margin > $this->lMargin) {
 
22646                                                                        $y = $regdata[
'yb'] - 
$h;
 
22654                return array(
$x, 
$y);
 
22677                if ($this->state != 2) {
 
22681                $this->svggradients = array();
 
22682                $this->svggradientid = 0;
 
22683                $this->svgdefsmode = 
false;
 
22684                $this->svgdefs = array();
 
22685                $this->svgclipmode = 
false;
 
22686                $this->svgclippaths = array();
 
22687                $this->svgcliptm = array();
 
22688                $this->svgclipid = 0;
 
22689                $this->svgtext = 
'';
 
22690                $this->svgtextmode = array();
 
22691                if ($this->rasterize_vector_images AND (
$w > 0) AND (
$h > 0)) {
 
22693                        return $this->Image(
$file, 
$x, 
$y, 
$w, 
$h, 
'SVG', $link, $align, 
true, 300, $palign, 
false, 
false, 
$border, 
false, 
false, 
false);
 
22695                if (
$file[0] === 
'@') { 
 
22696                        $this->svgdir = 
'';
 
22697                        $svgdata = substr(
$file, 1);
 
22699                        $this->svgdir = dirname(
$file);
 
22702                if ($svgdata === FALSE) {
 
22703                        $this->Error(
'SVG file not found: '.
$file);
 
22712                list(
$x, 
$y) = $this->checkPageRegions(
$h, 
$x, 
$y);
 
22718                $aspect_ratio_align = 
'xMidYMid';
 
22719                $aspect_ratio_ms = 
'meet';
 
22722                preg_match(
'/<svg([^>]*)>/si', $svgdata, $regs);
 
22723                if (isset($regs[1]) AND !empty($regs[1])) {
 
22725                        if (preg_match(
'/[\s]+x[\s]*=[\s]*"([^"]*)"/si', $regs[1], $tmp)) {
 
22726                                $ox = $this->getHTMLUnitToUnits($tmp[1], 0, $this->svgunit, 
false);
 
22729                        if (preg_match(
'/[\s]+y[\s]*=[\s]*"([^"]*)"/si', $regs[1], $tmp)) {
 
22730                                $oy = $this->getHTMLUnitToUnits($tmp[1], 0, $this->svgunit, 
false);
 
22733                        if (preg_match(
'/[\s]+width[\s]*=[\s]*"([^"]*)"/si', $regs[1], $tmp)) {
 
22734                                $ow = $this->getHTMLUnitToUnits($tmp[1], 1, $this->svgunit, 
false);
 
22737                        if (preg_match(
'/[\s]+height[\s]*=[\s]*"([^"]*)"/si', $regs[1], $tmp)) {
 
22738                                $oh = $this->getHTMLUnitToUnits($tmp[1], 1, $this->svgunit, 
false);
 
22741                        $view_box = array();
 
22742                        if (preg_match(
'/[\s]+viewBox[\s]*=[\s]*"[\s]*([0-9\.\-]+)[\s]+([0-9\.\-]+)[\s]+([0-9\.]+)[\s]+([0-9\.]+)[\s]*"/si', $regs[1], $tmp)) {
 
22743                                if (count($tmp) == 5) {
 
22745                                        foreach ($tmp as $key => $val) {
 
22746                                                $view_box[$key] = $this->getHTMLUnitToUnits($val, 0, $this->svgunit, 
false);
 
22748                                        $ox = $view_box[0];
 
22749                                        $oy = $view_box[1];
 
22753                                if (preg_match(
'/[\s]+preserveAspectRatio[\s]*=[\s]*"([^"]*)"/si', $regs[1], $tmp)) {
 
22754                                        $aspect_ratio = preg_split(
'/[\s]+/si', $tmp[1]);
 
22755                                        switch (count($aspect_ratio)) {
 
22757                                                        $aspect_ratio_align = $aspect_ratio[1];
 
22758                                                        $aspect_ratio_ms = $aspect_ratio[2];
 
22762                                                        $aspect_ratio_align = $aspect_ratio[0];
 
22763                                                        $aspect_ratio_ms = $aspect_ratio[1];
 
22767                                                        $aspect_ratio_align = $aspect_ratio[0];
 
22768                                                        $aspect_ratio_ms = 
'meet';
 
22782                if ((
$w <= 0) AND (
$h <= 0)) {
 
22786                } elseif (
$w <= 0) {
 
22787                        $w = 
$h * $ow / $oh;
 
22788                } elseif (
$h <= 0) {
 
22789                        $h = 
$w * $oh / $ow;
 
22793                if ($this->rasterize_vector_images) {
 
22795                        return $this->Image(
$file, 
$x, 
$y, 
$w, 
$h, 
'SVG', $link, $align, 
true, 300, $palign, 
false, 
false, 
$border, 
false, 
false, 
false);
 
22798                $this->img_rb_y = 
$y + 
$h;
 
22801                        if ($palign == 
'L') {
 
22802                                $ximg = $this->lMargin;
 
22803                        } elseif ($palign == 
'C') {
 
22804                                $ximg = ($this->w + $this->lMargin - $this->rMargin - 
$w) / 2;
 
22805                        } elseif ($palign == 
'R') {
 
22806                                $ximg = $this->w - $this->rMargin - 
$w;
 
22810                        $this->img_rb_x = $ximg;
 
22812                        if ($palign == 
'L') {
 
22813                                $ximg = $this->lMargin;
 
22814                        } elseif ($palign == 
'C') {
 
22815                                $ximg = ($this->w + $this->lMargin - $this->rMargin - 
$w) / 2;
 
22816                        } elseif ($palign == 
'R') {
 
22817                                $ximg = $this->w - $this->rMargin - 
$w;
 
22821                        $this->img_rb_x = $ximg + 
$w;
 
22824                $gvars = $this->getGraphicVars();
 
22826                $svgoffset_x = ($ximg - $ox) * $this->k;
 
22827                $svgoffset_y = -(
$y - $oy) * $this->k;
 
22828                if (isset($view_box[2]) AND ($view_box[2] > 0) AND ($view_box[3] > 0)) {
 
22829                        $ow = $view_box[2];
 
22830                        $oh = $view_box[3];
 
22839                $svgscale_x = 
$w / $ow;
 
22840                $svgscale_y = 
$h / $oh;
 
22842                if ($aspect_ratio_align != 
'none') {
 
22844                        $svgscale_old_x = $svgscale_x;
 
22845                        $svgscale_old_y = $svgscale_y;
 
22847                        if ($aspect_ratio_ms == 
'slice') {
 
22849                                if ($svgscale_x > $svgscale_y) {
 
22850                                        $svgscale_y = $svgscale_x;
 
22851                                } elseif ($svgscale_x < $svgscale_y) {
 
22852                                        $svgscale_x = $svgscale_y;
 
22856                                if ($svgscale_x < $svgscale_y) {
 
22857                                        $svgscale_y = $svgscale_x;
 
22858                                } elseif ($svgscale_x > $svgscale_y) {
 
22859                                        $svgscale_x = $svgscale_y;
 
22863                        switch (substr($aspect_ratio_align, 1, 3)) {
 
22869                                        $svgoffset_x += ((
$w * $this->k) - ($ow * $this->k * $svgscale_x));
 
22874                                        $svgoffset_x += (((
$w * $this->k) - ($ow * $this->k * $svgscale_x)) / 2);
 
22879                        switch (substr($aspect_ratio_align, 5)) {
 
22885                                        $svgoffset_y -= ((
$h * $this->k) - ($oh * $this->k * $svgscale_y));
 
22890                                        $svgoffset_y -= (((
$h * $this->k) - ($oh * $this->k * $svgscale_y)) / 2);
 
22896                $page_break_mode = $this->AutoPageBreak;
 
22897                $page_break_margin = $this->getBreakMargin();
 
22898                $cell_padding = $this->cell_padding;
 
22899                $this->SetCellPadding(0);
 
22900                $this->SetAutoPageBreak(
false);
 
22902                $this->_out(
'q'.$this->epsmarker);
 
22904                $this->Rect($ximg, 
$y, 
$w, 
$h, 
'CNZ', array(), array());
 
22906                $e = $ox * $this->k * (1 - $svgscale_x);
 
22907                $f = ($this->h - $oy) * $this->k * (1 - $svgscale_y);
 
22908                $this->_out(sprintf(
'%F %F %F %F %F %F cm', $svgscale_x, 0, 0, $svgscale_y, ($e + $svgoffset_x), ($f + $svgoffset_y)));
 
22910                $this->parser = xml_parser_create(
'UTF-8');
 
22912                xml_set_object($this->parser, $this);
 
22914                xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, 0);
 
22916                xml_set_element_handler($this->parser, 
'startSVGElementHandler', 
'endSVGElementHandler');
 
22918                xml_set_character_data_handler($this->parser, 
'segSVGContentHandler');
 
22920                if (!xml_parse($this->parser, $svgdata)) {
 
22921                        $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));
 
22922                        $this->Error($error_message);
 
22925                xml_parser_free($this->parser);
 
22927                $this->_out($this->epsmarker.
'Q');
 
22929                $this->setGraphicVars($gvars);
 
22930                $this->lasth = $gvars[
'lasth'];
 
22939                        $this->Cell(
$w, 
$h, 
'', 
$border, 0, 
'', 0, 
'', 0, 
true);
 
22944                        $this->Link($ximg, 
$y, 
$w, 
$h, $link, 0);
 
22950                                $this->x = $this->img_rb_x;
 
22954                                $this->y = 
$y + round(
$h/2);
 
22955                                $this->x = $this->img_rb_x;
 
22959                                $this->y = $this->img_rb_y;
 
22960                                $this->x = $this->img_rb_x;
 
22964                                $this->SetY($this->img_rb_y);
 
22969                                $this->x = $gvars[
'x'];
 
22970                                $this->y = $gvars[
'y'];
 
22971                                $this->page = $gvars[
'page'];
 
22972                                $this->current_column = $gvars[
'current_column'];
 
22973                                $this->tMargin = $gvars[
'tMargin'];
 
22974                                $this->bMargin = $gvars[
'bMargin'];
 
22975                                $this->w = $gvars[
'w'];
 
22976                                $this->h = $gvars[
'h'];
 
22977                                $this->wPt = $gvars[
'wPt'];
 
22978                                $this->hPt = $gvars[
'hPt'];
 
22979                                $this->fwPt = $gvars[
'fwPt'];
 
22980                                $this->fhPt = $gvars[
'fhPt'];
 
22984                $this->endlinex = $this->img_rb_x;
 
22986                $this->SetAutoPageBreak($page_break_mode, $page_break_margin);
 
22987                $this->cell_padding = $cell_padding;
 
23002                $e = $this->getHTMLUnitToUnits($tm[4], 1, $this->svgunit, 
false) * $this->k;
 
23003                $f = -$this->getHTMLUnitToUnits($tm[5], 1, $this->svgunit, 
false) * $this->k;
 
23005                $y = $this->h * $this->k;
 
23006                $e = (
$x * (1 - $a)) - (
$y * $c) + $e;
 
23007                $f = (
$y * (1 - 
$d)) - (
$x * $b) + $f;
 
23008                return array($a, $b, $c, 
$d, $e, $f);
 
23018                $this->Transform($this->convertSVGtMatrix($tm));
 
23036        protected function setSVGStyles($svgstyle, $prevsvgstyle, 
$x=0, 
$y=0, 
$w=1, 
$h=1, $clip_function=
'', $clip_params=array()) {
 
23037                if ($this->state != 2) {
 
23041                $minlen = (0.01 / $this->k); 
 
23042                if (!isset($svgstyle[
'opacity'])) {
 
23047                if (preg_match(
'/url\([\s]*\#([^\)]*)\)/si', $svgstyle[
'clip-path'], $regs)) {
 
23048                        $clip_path = $this->svgclippaths[$regs[1]];
 
23049                        foreach ($clip_path as $cp) {
 
23050                                $this->startSVGElementHandler(
'clip-path', $cp[
'name'], $cp[
'attribs'], $cp[
'tm']);
 
23054                if ($svgstyle[
'opacity'] != 1) {
 
23055                        $this->setAlpha($svgstyle[
'opacity'], 
'Normal', $svgstyle[
'opacity'], 
false);
 
23059                $this->SetFillColorArray($fill_color);
 
23062                $this->SetTextColorArray($text_color);
 
23064                if (preg_match(
'/rect\(([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)\)/si', $svgstyle[
'clip'], $regs)) {
 
23065                        $top = (isset($regs[1])?$this->getHTMLUnitToUnits($regs[1], 0, $this->svgunit, 
false):0);
 
23066                        $right = (isset($regs[2])?$this->getHTMLUnitToUnits($regs[2], 0, $this->svgunit, 
false):0);
 
23067                        $bottom = (isset($regs[3])?$this->getHTMLUnitToUnits($regs[3], 0, $this->svgunit, 
false):0);
 
23068                        $left = (isset($regs[4])?$this->getHTMLUnitToUnits($regs[4], 0, $this->svgunit, 
false):0);
 
23071                        $cw = 
$w - $left - $right;
 
23072                        $ch = 
$h - $top - $bottom;
 
23073                        if ($svgstyle[
'clip-rule'] == 
'evenodd') {
 
23074                                $clip_rule = 
'CNZ';
 
23076                                $clip_rule = 
'CEO';
 
23078                        $this->Rect($cx, $cy, $cw, $ch, $clip_rule, array(), array());
 
23082                if (preg_match(
'/url\([\s]*\#([^\)]*)\)/si', $svgstyle[
'fill'], $regs)) {
 
23084                        $gradient = $this->svggradients[$regs[1]];
 
23085                        if (isset($gradient[
'xref'])) {
 
23087                                $newgradient = $this->svggradients[$gradient[
'xref']];
 
23088                                $newgradient[
'coords'] = $gradient[
'coords'];
 
23089                                $newgradient[
'mode'] = $gradient[
'mode'];
 
23090                                $newgradient[
'type'] = $gradient[
'type'];
 
23091                                $newgradient[
'gradientUnits'] = $gradient[
'gradientUnits'];
 
23092                                if (isset($gradient[
'gradientTransform'])) {
 
23093                                        $newgradient[
'gradientTransform'] = $gradient[
'gradientTransform'];
 
23095                                $gradient = $newgradient;
 
23098                        $this->_outSaveGraphicsState();
 
23100                        if (!empty($clip_function) AND method_exists($this, $clip_function)) {
 
23101                                $bbox = call_user_func_array(array($this, $clip_function), $clip_params);
 
23102                                if ((!isset($gradient[
'type']) OR ($gradient[
'type'] != 3)) AND is_array($bbox) AND (count($bbox) == 4)) {
 
23106                        if ($gradient[
'mode'] == 
'measure') {
 
23107                                if (!isset($gradient[
'coords'][4])) {
 
23108                                        $gradient[
'coords'][4] = 0.5;
 
23110                                if (isset($gradient[
'gradientTransform']) AND !empty($gradient[
'gradientTransform'])) {
 
23111                                        $gtm = $gradient[
'gradientTransform'];
 
23113                                        $xa = ($gtm[0] * $gradient[
'coords'][0]) + ($gtm[2] * $gradient[
'coords'][1]) + $gtm[4];
 
23114                                        $ya = ($gtm[1] * $gradient[
'coords'][0]) + ($gtm[3] * $gradient[
'coords'][1]) + $gtm[5];
 
23115                                        $xb = ($gtm[0] * $gradient[
'coords'][2]) + ($gtm[2] * $gradient[
'coords'][3]) + $gtm[4];
 
23116                                        $yb = ($gtm[1] * $gradient[
'coords'][2]) + ($gtm[3] * $gradient[
'coords'][3]) + $gtm[5];
 
23117                                        $r = sqrt(pow(($gtm[0] * $gradient[
'coords'][4]), 2) + pow(($gtm[1] * $gradient[
'coords'][4]), 2));
 
23118                                        $gradient[
'coords'][0] = $xa;
 
23119                                        $gradient[
'coords'][1] = $ya;
 
23120                                        $gradient[
'coords'][2] = $xb;
 
23121                                        $gradient[
'coords'][3] = $yb;
 
23122                                        $gradient[
'coords'][4] = 
$r;
 
23125                                $gradient[
'coords'][0] = $this->getHTMLUnitToUnits($gradient[
'coords'][0], 0, $this->svgunit, 
false);
 
23126                                $gradient[
'coords'][1] = $this->getHTMLUnitToUnits($gradient[
'coords'][1], 0, $this->svgunit, 
false);
 
23127                                $gradient[
'coords'][2] = $this->getHTMLUnitToUnits($gradient[
'coords'][2], 0, $this->svgunit, 
false);
 
23128                                $gradient[
'coords'][3] = $this->getHTMLUnitToUnits($gradient[
'coords'][3], 0, $this->svgunit, 
false);
 
23129                                $gradient[
'coords'][4] = $this->getHTMLUnitToUnits($gradient[
'coords'][4], 0, $this->svgunit, 
false);
 
23130                                if (
$w <= $minlen) {
 
23133                                if (
$h <= $minlen) {
 
23137                                if ($gradient[
'gradientUnits'] == 
'objectBoundingBox') {
 
23139                                        $gradient[
'coords'][0] += 
$x;
 
23140                                        $gradient[
'coords'][1] += 
$y;
 
23141                                        $gradient[
'coords'][2] += 
$x;
 
23142                                        $gradient[
'coords'][3] += 
$y;
 
23145                                $gradient[
'coords'][0] = (($gradient[
'coords'][0] - 
$x) / 
$w);
 
23146                                $gradient[
'coords'][1] = (($gradient[
'coords'][1] - 
$y) / 
$h);
 
23147                                $gradient[
'coords'][2] = (($gradient[
'coords'][2] - 
$x) / 
$w);
 
23148                                $gradient[
'coords'][3] = (($gradient[
'coords'][3] - 
$y) / 
$h);
 
23149                                $gradient[
'coords'][4] /= 
$w;
 
23150                        } elseif ($gradient[
'mode'] == 
'percentage') {
 
23151                                foreach($gradient[
'coords'] as $key => $val) {
 
23152                                        $gradient[
'coords'][$key] = (intval($val) / 100);
 
23154                                                $gradient[
'coords'][$key] = 0;
 
23155                                        } elseif ($val > 1) {
 
23156                                                $gradient[
'coords'][$key] = 1;
 
23160                        if (($gradient[
'type'] == 2) AND ($gradient[
'coords'][0] == $gradient[
'coords'][2]) AND ($gradient[
'coords'][1] == $gradient[
'coords'][3])) {
 
23162                                $gradient[
'coords'][0] = 1;
 
23163                                $gradient[
'coords'][1] = 0;
 
23164                                $gradient[
'coords'][2] = 0.999;
 
23165                                $gradient[
'coords'][3] = 0;
 
23168                        $tmp = $gradient[
'coords'][1];
 
23169                        $gradient[
'coords'][1] = $gradient[
'coords'][3];
 
23170                        $gradient[
'coords'][3] = $tmp;
 
23172                        $cy = ($this->h - 
$y);
 
23173                        if ($gradient[
'type'] == 3) {
 
23175                                $cy -= ($gradient[
'coords'][1] * (
$w + 
$h));
 
23180                        $this->_out(sprintf(
'%F 0 0 %F %F %F cm', (
$w * $this->k), (
$h * $this->k), (
$x * $this->k), ($cy * $this->k)));
 
23181                        if (count($gradient[
'stops']) > 1) {
 
23182                                $this->Gradient($gradient[
'type'], $gradient[
'coords'], $gradient[
'stops'], array(), 
false);
 
23184                } elseif ($svgstyle[
'fill'] != 
'none') {
 
23186                        if ($svgstyle[
'fill-opacity'] != 1) {
 
23187                                $this->setAlpha($this->alpha[
'CA'], 
'Normal', $svgstyle[
'fill-opacity'], 
false);
 
23189                        $this->SetFillColorArray($fill_color);
 
23190                        if ($svgstyle[
'fill-rule'] == 
'evenodd') {
 
23197                if ($svgstyle[
'stroke'] != 
'none') {
 
23198                        if ($svgstyle[
'stroke-opacity'] != 1) {
 
23199                                $this->setAlpha($svgstyle[
'stroke-opacity'], 
'Normal', $this->alpha[
'ca'], 
false);
 
23200                        } elseif (preg_match(
'/rgba\(\d+%?,\s*\d+%?,\s*\d+%?,\s*(\d+(?:\.\d+)?)\)/i', $svgstyle[
'stroke'], $rgba_matches)) {
 
23201                                $this->setAlpha($rgba_matches[1], 
'Normal', $this->alpha[
'ca'], 
false);
 
23203                        $stroke_style = array(
 
23205                                'width' => $this->getHTMLUnitToUnits($svgstyle[
'stroke-width'], 0, $this->svgunit, 
false),
 
23206                                'cap' => $svgstyle[
'stroke-linecap'],
 
23207                                'join' => $svgstyle[
'stroke-linejoin']
 
23209                        if (isset($svgstyle[
'stroke-dasharray']) AND !empty($svgstyle[
'stroke-dasharray']) AND ($svgstyle[
'stroke-dasharray'] != 
'none')) {
 
23210                                $stroke_style[
'dash'] = $svgstyle[
'stroke-dasharray'];
 
23212                        $this->SetLineStyle($stroke_style);
 
23217                if (!empty($svgstyle[
'font'])) {
 
23218                        if (preg_match(
'/font-family[\s]*:[\s]*([^\;\"]*)/si', $svgstyle[
'font'], $regs)) {
 
23219                                $font_family = $this->getFontFamilyName($regs[1]);
 
23221                                $font_family = $svgstyle[
'font-family'];
 
23223                        if (preg_match(
'/font-size[\s]*:[\s]*([^\s\;\"]*)/si', $svgstyle[
'font'], $regs)) {
 
23224                                $font_size = trim($regs[1]);
 
23226                                $font_size = $svgstyle[
'font-size'];
 
23228                        if (preg_match(
'/font-style[\s]*:[\s]*([^\s\;\"]*)/si', $svgstyle[
'font'], $regs)) {
 
23229                                $font_style = trim($regs[1]);
 
23231                                $font_style = $svgstyle[
'font-style'];
 
23233                        if (preg_match(
'/font-weight[\s]*:[\s]*([^\s\;\"]*)/si', $svgstyle[
'font'], $regs)) {
 
23234                                $font_weight = trim($regs[1]);
 
23236                                $font_weight = $svgstyle[
'font-weight'];
 
23238                        if (preg_match(
'/font-stretch[\s]*:[\s]*([^\s\;\"]*)/si', $svgstyle[
'font'], $regs)) {
 
23239                                $font_stretch = trim($regs[1]);
 
23241                                $font_stretch = $svgstyle[
'font-stretch'];
 
23243                        if (preg_match(
'/letter-spacing[\s]*:[\s]*([^\s\;\"]*)/si', $svgstyle[
'font'], $regs)) {
 
23244                                $font_spacing = trim($regs[1]);
 
23246                                $font_spacing = $svgstyle[
'letter-spacing'];
 
23249                        $font_family = $this->getFontFamilyName($svgstyle[
'font-family']);
 
23250                        $font_size = $svgstyle[
'font-size'];
 
23251                        $font_style = $svgstyle[
'font-style'];
 
23252                        $font_weight = $svgstyle[
'font-weight'];
 
23253                        $font_stretch = $svgstyle[
'font-stretch'];
 
23254                        $font_spacing = $svgstyle[
'letter-spacing'];
 
23256                $font_size = $this->getHTMLFontUnits($font_size, $this->svgstyles[0][
'font-size'], $prevsvgstyle[
'font-size'], $this->svgunit);
 
23257                $font_stretch = $this->getCSSFontStretching($font_stretch, $svgstyle[
'font-stretch']);
 
23258                $font_spacing = $this->getCSSFontSpacing($font_spacing, $svgstyle[
'letter-spacing']);
 
23259                switch ($font_style) {
 
23274                switch ($font_weight) {
 
23277                                $font_style .= 
'B';
 
23281                                if ((substr($font_family, -1) == 
'I') AND (substr($font_family, -2, 1) == 
'B')) {
 
23282                                        $font_family = substr($font_family, 0, -2).
'I';
 
23283                                } elseif (substr($font_family, -1) == 
'B') {
 
23284                                        $font_family = substr($font_family, 0, -1);
 
23289                switch ($svgstyle[
'text-decoration']) {
 
23290                        case 'underline': {
 
23291                                $font_style .= 
'U';
 
23295                                $font_style .= 
'O';
 
23298                        case 'line-through': {
 
23299                                $font_style .= 
'D';
 
23307                $this->SetFont($font_family, $font_style, $font_size);
 
23308                $this->setFontStretching($font_stretch);
 
23309                $this->setFontSpacing($font_spacing);
 
23332                if ($this->state != 2) {
 
23341                $d = preg_replace(
'/([0-9ACHLMQSTVZ])([\-\+])/si', 
'\\1 \\2', 
$d);
 
23342                preg_match_all(
'/([ACHLMQSTVZ])[\s]*([^ACHLMQSTVZ\"]*)/si', 
$d, $paths, PREG_SET_ORDER);
 
23349                $xmin = 2147483647;
 
23351                $ymin = 2147483647;
 
23354                $minlen = (0.01 / $this->k); 
 
23357                foreach ($paths as $key => $val) {
 
23359                        $cmd = trim($val[1]);
 
23371                        if (isset($val[2])) {
 
23373                                $rawparams = preg_split(
'/([\,\s]+)/si', trim($val[2]));
 
23375                                foreach ($rawparams as $ck => $cp) {
 
23376                                        $params[$ck] = $this->getHTMLUnitToUnits($cp, 0, $this->svgunit, 
false);
 
23377                                        if (abs(
$params[$ck]) < $minlen) {
 
23386                        switch (strtoupper(
$cmd)) {
 
23388                                        foreach (
$params as $ck => $cp) {
 
23389                                                if (($ck % 2) == 0) {
 
23390                                                        $x = $cp + $xoffset;
 
23392                                                        $y = $cp + $yoffset;
 
23393                                                        if ($firstcmd OR (abs($x0 - 
$x) >= $minlen) OR (abs($y0 - 
$y) >= $minlen)) {
 
23395                                                                        $this->_outPoint(
$x, 
$y);
 
23398                                                                        $this->_outLine(
$x, 
$y);
 
23403                                                        $xmin = min($xmin, 
$x);
 
23404                                                        $ymin = min($ymin, 
$y);
 
23405                                                        $xmax = max($xmax, 
$x);
 
23406                                                        $ymax = max($ymax, 
$y);
 
23416                                        foreach (
$params as $ck => $cp) {
 
23417                                                if (($ck % 2) == 0) {
 
23418                                                        $x = $cp + $xoffset;
 
23420                                                        $y = $cp + $yoffset;
 
23421                                                        if ((abs($x0 - 
$x) >= $minlen) OR (abs($y0 - 
$y) >= $minlen)) {
 
23422                                                                $this->_outLine(
$x, 
$y);
 
23426                                                        $xmin = min($xmin, 
$x);
 
23427                                                        $ymin = min($ymin, 
$y);
 
23428                                                        $xmax = max($xmax, 
$x);
 
23429                                                        $ymax = max($ymax, 
$y);
 
23439                                        foreach (
$params as $ck => $cp) {
 
23440                                                $x = $cp + $xoffset;
 
23441                                                if ((abs($x0 - 
$x) >= $minlen) OR (abs($y0 - 
$y) >= $minlen)) {
 
23442                                                        $this->_outLine(
$x, 
$y);
 
23446                                                $xmin = min($xmin, 
$x);
 
23447                                                $xmax = max($xmax, 
$x);
 
23455                                        foreach (
$params as $ck => $cp) {
 
23456                                                $y = $cp + $yoffset;
 
23457                                                if ((abs($x0 - 
$x) >= $minlen) OR (abs($y0 - 
$y) >= $minlen)) {
 
23458                                                        $this->_outLine(
$x, 
$y);
 
23462                                                $ymin = min($ymin, 
$y);
 
23463                                                $ymax = max($ymax, 
$y);
 
23471                                        foreach (
$params as $ck => $cp) {
 
23473                                                if ((($ck + 1) % 6) == 0) {
 
23474                                                        $x1 = 
$params[($ck - 5)] + $xoffset;
 
23475                                                        $y1 = 
$params[($ck - 4)] + $yoffset;
 
23476                                                        $x2 = 
$params[($ck - 3)] + $xoffset;
 
23477                                                        $y2 = 
$params[($ck - 2)] + $yoffset;
 
23480                                                        $this->_outCurve($x1, $y1, $x2, $y2, 
$x, 
$y);
 
23481                                                        $xmin = min($xmin, 
$x, $x1, $x2);
 
23482                                                        $ymin = min($ymin, 
$y, $y1, $y2);
 
23483                                                        $xmax = max($xmax, 
$x, $x1, $x2);
 
23484                                                        $ymax = max($ymax, 
$y, $y1, $y2);
 
23494                                        foreach (
$params as $ck => $cp) {
 
23496                                                if ((($ck + 1) % 4) == 0) {
 
23497                                                        if (($key > 0) AND ((strtoupper($paths[($key - 1)][1]) == 
'C') OR (strtoupper($paths[($key - 1)][1]) == 
'S'))) {
 
23498                                                                $x1 = (2 * 
$x) - $x2;
 
23499                                                                $y1 = (2 * 
$y) - $y2;
 
23504                                                        $x2 = 
$params[($ck - 3)] + $xoffset;
 
23505                                                        $y2 = 
$params[($ck - 2)] + $yoffset;
 
23508                                                        $this->_outCurve($x1, $y1, $x2, $y2, 
$x, 
$y);
 
23509                                                        $xmin = min($xmin, 
$x, $x1, $x2);
 
23510                                                        $ymin = min($ymin, 
$y, $y1, $y2);
 
23511                                                        $xmax = max($xmax, 
$x, $x1, $x2);
 
23512                                                        $ymax = max($ymax, 
$y, $y1, $y2);
 
23522                                        foreach (
$params as $ck => $cp) {
 
23524                                                if ((($ck + 1) % 4) == 0) {
 
23526                                                        $x1 = 
$params[($ck - 3)] + $xoffset;
 
23527                                                        $y1 = 
$params[($ck - 2)] + $yoffset;
 
23528                                                        $xa = (
$x + (2 * $x1)) / 3;
 
23529                                                        $ya = (
$y + (2 * $y1)) / 3;
 
23532                                                        $xb = (
$x + (2 * $x1)) / 3;
 
23533                                                        $yb = (
$y + (2 * $y1)) / 3;
 
23534                                                        $this->_outCurve($xa, $ya, $xb, $yb, 
$x, 
$y);
 
23535                                                        $xmin = min($xmin, 
$x, $xa, $xb);
 
23536                                                        $ymin = min($ymin, 
$y, $ya, $yb);
 
23537                                                        $xmax = max($xmax, 
$x, $xa, $xb);
 
23538                                                        $ymax = max($ymax, 
$y, $ya, $yb);
 
23548                                        foreach (
$params as $ck => $cp) {
 
23550                                                if (($ck % 2) != 0) {
 
23551                                                        if (($key > 0) AND ((strtoupper($paths[($key - 1)][1]) == 
'Q') OR (strtoupper($paths[($key - 1)][1]) == 
'T'))) {
 
23552                                                                $x1 = (2 * 
$x) - $x1;
 
23553                                                                $y1 = (2 * 
$y) - $y1;
 
23559                                                        $xa = (
$x + (2 * $x1)) / 3;
 
23560                                                        $ya = (
$y + (2 * $y1)) / 3;
 
23563                                                        $xb = (
$x + (2 * $x1)) / 3;
 
23564                                                        $yb = (
$y + (2 * $y1)) / 3;
 
23565                                                        $this->_outCurve($xa, $ya, $xb, $yb, 
$x, 
$y);
 
23566                                                        $xmin = min($xmin, 
$x, $xa, $xb);
 
23567                                                        $ymin = min($ymin, 
$y, $ya, $yb);
 
23568                                                        $xmax = max($xmax, 
$x, $xa, $xb);
 
23569                                                        $ymax = max($ymax, 
$y, $ya, $yb);
 
23579                                        foreach (
$params as $ck => $cp) {
 
23581                                                if ((($ck + 1) % 7) == 0) {
 
23584                                                        $rx = abs(
$params[($ck - 6)]);
 
23585                                                        $ry = abs(
$params[($ck - 5)]);
 
23586                                                        $ang = -$rawparams[($ck - 4)];
 
23588                                                        $fa = $rawparams[($ck - 3)]; 
 
23589                                                        $fs = $rawparams[($ck - 2)]; 
 
23592                                                        if ((abs($x0 - 
$x) < $minlen) AND (abs($y0 - 
$y) < $minlen)) {
 
23594                                                                $xmin = min($xmin, 
$x);
 
23595                                                                $ymin = min($ymin, 
$y);
 
23596                                                                $xmax = max($xmax, 
$x);
 
23597                                                                $ymax = max($ymax, 
$y);
 
23601                                                                $a = (($x0 - 
$x) / 2);
 
23602                                                                $b = (($y0 - 
$y) / 2);
 
23603                                                                $xa = ($a * $cos_ang) - ($b * $sin_ang);
 
23604                                                                $ya = ($a * $sin_ang) + ($b * $cos_ang);
 
23609                                                                $delta = ($xa2 / $rx2) + ($ya2 / $ry2);
 
23611                                                                        $rx *= sqrt($delta);
 
23612                                                                        $ry *= sqrt($delta);
 
23616                                                                $numerator = (($rx2 * $ry2) - ($rx2 * $ya2) - ($ry2 * $xa2));
 
23617                                                                if ($numerator < 0) {
 
23620                                                                        $root = sqrt($numerator / (($rx2 * $ya2) + ($ry2 * $xa2)));
 
23625                                                                $cax = $root * (($rx * $ya) / $ry);
 
23626                                                                $cay = -$root * (($ry * $xa) / $rx);
 
23628                                                                $cx = ($cax * $cos_ang) - ($cay * $sin_ang) + (($x0 + 
$x) / 2);
 
23629                                                                $cy = ($cax * $sin_ang) + ($cay * $cos_ang) + (($y0 + 
$y) / 2);
 
23633                                                                if (($fs == 0) AND ($dang > 0)) {
 
23634                                                                        $dang -= (2 * M_PI);
 
23635                                                                } elseif (($fs == 1) AND ($dang < 0)) {
 
23636                                                                        $dang += (2 * M_PI);
 
23638                                                                $angf = $angs - $dang;
 
23639                                                                if ((($fs == 0) AND ($angs > $angf)) OR (($fs == 1) AND ($angs < $angf))) {
 
23645                                                                $angs = round(rad2deg($angs), 6);
 
23646                                                                $angf = round(rad2deg($angf), 6);
 
23648                                                                if (($angs < 0) AND ($angf < 0)) {
 
23653                                                                if (($key == 0) AND (isset($paths[($key + 1)][1])) AND (trim($paths[($key + 1)][1]) == 
'z')) {
 
23656                                                                list($axmin, $aymin, $axmax, $aymax) = $this->_outellipticalarc($cx, $cy, $rx, $ry, $ang, $angs, $angf, $pie, 2, 
false, ($fs == 0), 
true);
 
23657                                                                $xmin = min($xmin, 
$x, $axmin);
 
23658                                                                $ymin = min($ymin, 
$y, $aymin);
 
23659                                                                $xmax = max($xmax, 
$x, $axmax);
 
23660                                                                $ymax = max($ymax, 
$y, $aymax);
 
23680                return array($xmin, $ymin, ($xmax - $xmin), ($ymax - $ymin));
 
23689                if(strpos($name, 
':') !== 
false) {
 
23690                        $parts = explode(
':', $name);
 
23691                        return $parts[(
sizeof($parts) - 1)];
 
23707                $name = $this->removeTagNamespace($name);
 
23709                if ($this->svgclipmode) {
 
23710                        $this->svgclippaths[$this->svgclipid][] = array(
'name' => $name, 
'attribs' => $attribs, 
'tm' => $this->svgcliptm[$this->svgclipid]);
 
23713                if ($this->svgdefsmode AND !in_array($name, array(
'clipPath', 
'linearGradient', 
'radialGradient', 
'stop'))) {
 
23714                        if (isset($attribs[
'id'])) {
 
23715                                $attribs[
'child_elements'] = array();
 
23716                                $this->svgdefs[$attribs[
'id']] = array(
'name' => $name, 
'attribs' => $attribs);
 
23719                        if (end($this->svgdefs) !== FALSE) {
 
23720                                $last_svgdefs_id = key($this->svgdefs);
 
23721                                if (isset($this->svgdefs[$last_svgdefs_id][
'attribs'][
'child_elements'])) {
 
23722                                        $attribs[
'id'] = 
'DF_'.(count($this->svgdefs[$last_svgdefs_id][
'attribs'][
'child_elements']) + 1);
 
23723                                        $this->svgdefs[$last_svgdefs_id][
'attribs'][
'child_elements'][$attribs[
'id']] = array(
'name' => $name, 
'attribs' => $attribs);
 
23730                if ($parser == 
'clip-path') {
 
23735                $prev_svgstyle = $this->svgstyles[max(0,(count($this->svgstyles) - 1))]; 
 
23736                $svgstyle = $this->svgstyles[0]; 
 
23737                if ($clipping AND !isset($attribs[
'fill']) AND (!isset($attribs[
'style']) OR (!preg_match(
'/[;\"\s]{1}fill[\s]*:[\s]*([^;\"]*)/si', $attribs[
'style'], $attrval)))) {
 
23739                        $attribs[
'fill'] = 
'none';
 
23743                        $attribs[
'style'] = 
';'.$attribs[
'style'];
 
23745                foreach ($prev_svgstyle as $key => $val) {
 
23748                                $svgstyle[$key] = $val;
 
23752                                if ($attribs[$key] == 
'inherit') {
 
23753                                        $svgstyle[$key] = $val;
 
23755                                        $svgstyle[$key] = $attribs[$key];
 
23759                                $attrval = array();
 
23760                                if (preg_match(
'/[;\"\s]{1}'.$key.
'[\s]*:[\s]*([^;\"]*)/si', $attribs[
'style'], $attrval) AND isset($attrval[1])) {
 
23761                                        if ($attrval[1] == 
'inherit') {
 
23762                                                $svgstyle[$key] = $val;
 
23764                                                $svgstyle[$key] = $attrval[1];
 
23770                if (!empty($ctm)) {
 
23773                        $tm = array(1,0,0,1,0,0);
 
23775                if (isset($attribs[
'transform']) AND !empty($attribs[
'transform'])) {
 
23778                $svgstyle[
'transfmatrix'] = $tm;
 
23779                $invisible = 
false;
 
23780                if (($svgstyle[
'visibility'] == 
'hidden') OR ($svgstyle[
'visibility'] == 
'collapse') OR ($svgstyle[
'display'] == 
'none')) {
 
23787                                $this->svgdefsmode = 
true;
 
23795                                $this->svgclipmode = 
true;
 
23796                                if (!isset($attribs[
'id'])) {
 
23797                                        $attribs[
'id'] = 
'CP_'.(count($this->svgcliptm) + 1);
 
23799                                $this->svgclipid = $attribs[
'id'];
 
23800                                $this->svgclippaths[$this->svgclipid] = array();
 
23801                                $this->svgcliptm[$this->svgclipid] = $tm;
 
23806                                if(++$this->svg_tag_depth <= 1) {
 
23810                                array_push($this->svgstyles, $svgstyle);
 
23811                                $this->StartTransform();
 
23812                                $svgX = (isset($attribs[
'x'])?$attribs[
'x']:0);
 
23813                                $svgY = (isset($attribs[
'y'])?$attribs[
'y']:0);
 
23814                                $svgW = (isset($attribs[
'width'])?$attribs[
'width']:0);
 
23815                                $svgH = (isset($attribs[
'height'])?$attribs[
'height']:0);
 
23818                                $this->SVGTransform($tm);
 
23822                                $w = (isset($attribs[
'width'])?$this->getHTMLUnitToUnits($attribs[
'width'], 0, $this->svgunit, 
false):
$this->w);
 
23823                                $h = (isset($attribs[
'height'])?$this->getHTMLUnitToUnits($attribs[
'height'], 0, $this->svgunit, 
false):
$this->h);
 
23825                                $this->Rect(
$x, 
$y, 
$w, 
$h, 
'CNZ', array(), array());
 
23827                                if (isset($attribs[
'viewBox'])) {
 
23829                                        preg_match_all(
"/[0-9]+/", $attribs[
'viewBox'], $tmp);
 
23831                                        if (
sizeof($tmp) == 4) {
 
23841                                                if (isset($attribs[
'preserveAspectRatio'])) {
 
23842                                                        if($attribs[
'preserveAspectRatio'] == 
'none') {
 
23845                                                                preg_match_all(
'/[a-zA-Z]+/', $attribs[
'preserveAspectRatio'], $tmp);
 
23847                                                                if ((
sizeof($tmp) == 2) AND (strlen($tmp[0]) == 8) AND (in_array($tmp[1], array(
'meet', 
'slice', 
'none')))) {
 
23848                                                                        $aspectX = substr($tmp[0], 0, 4);
 
23849                                                                        $aspectY = substr($tmp[0], 4, 4);
 
23854                                                $wr = ($svgW / $vw);
 
23855                                                $hr = ($svgH / $vh);
 
23857                                                if ((($fit == 
'meet') AND ($hr < $wr)) OR (($fit == 
'slice') AND ($hr > $wr))) {
 
23858                                                        if ($aspectX == 
'xMax') {
 
23859                                                                $ax = (($vw * ($wr / $hr)) - $vw);
 
23861                                                        if ($aspectX == 
'xMid') {
 
23862                                                                $ax = ((($vw * ($wr / $hr)) - $vw) / 2);
 
23865                                                } elseif ((($fit == 
'meet') AND ($hr > $wr)) OR (($fit == 
'slice') AND ($hr < $wr))) {
 
23866                                                        if ($aspectY == 
'YMax') {
 
23867                                                                $ay = (($vh * ($hr / $wr)) - $vh);
 
23869                                                        if ($aspectY == 
'YMid') {
 
23870                                                                $ay = ((($vh * ($hr / $wr)) - $vh) / 2);
 
23874                                                $newtm = array($wr, 0, 0, $hr, (($wr * ($ax - $vx)) - $svgX), (($hr * ($ay - $vy)) - $svgY));
 
23876                                                $this->SVGTransform($tm);
 
23879                                $this->setSVGStyles($svgstyle, $prev_svgstyle);
 
23884                                array_push($this->svgstyles, $svgstyle);
 
23885                                $this->StartTransform();
 
23886                                $x = (isset($attribs[
'x'])?$attribs[
'x']:0);
 
23887                                $y = (isset($attribs[
'y'])?$attribs[
'y']:0);
 
23891                                $this->SVGTransform($tm);
 
23892                                $this->setSVGStyles($svgstyle, $prev_svgstyle);
 
23895                        case 'linearGradient': {
 
23896                                if ($this->pdfa_mode) {
 
23899                                if (!isset($attribs[
'id'])) {
 
23900                                        $attribs[
'id'] = 
'GR_'.(count($this->svggradients) + 1);
 
23902                                $this->svggradientid = $attribs[
'id'];
 
23903                                $this->svggradients[$this->svggradientid] = array();
 
23904                                $this->svggradients[$this->svggradientid][
'type'] = 2;
 
23905                                $this->svggradients[$this->svggradientid][
'stops'] = array();
 
23906                                if (isset($attribs[
'gradientUnits'])) {
 
23907                                        $this->svggradients[$this->svggradientid][
'gradientUnits'] = $attribs[
'gradientUnits'];
 
23909                                        $this->svggradients[$this->svggradientid][
'gradientUnits'] = 
'objectBoundingBox';
 
23912                                if (((!isset($attribs[
'x1'])) AND (!isset($attribs[
'y1'])) AND (!isset($attribs[
'x2'])) AND (!isset($attribs[
'y2'])))
 
23913                                        OR ((isset($attribs[
'x1']) AND (substr($attribs[
'x1'], -1) == 
'%'))
 
23914                                                OR (isset($attribs[
'y1']) AND (substr($attribs[
'y1'], -1) == 
'%'))
 
23915                                                OR (isset($attribs[
'x2']) AND (substr($attribs[
'x2'], -1) == 
'%'))
 
23916                                                OR (isset($attribs[
'y2']) AND (substr($attribs[
'y2'], -1) == 
'%')))) {
 
23917                                        $this->svggradients[$this->svggradientid][
'mode'] = 
'percentage';
 
23919                                        $this->svggradients[$this->svggradientid][
'mode'] = 
'measure';
 
23921                                $x1 = (isset($attribs[
'x1'])?$attribs[
'x1']:
'0');
 
23922                                $y1 = (isset($attribs[
'y1'])?$attribs[
'y1']:
'0');
 
23923                                $x2 = (isset($attribs[
'x2'])?$attribs[
'x2']:
'100');
 
23924                                $y2 = (isset($attribs[
'y2'])?$attribs[
'y2']:
'0');
 
23925                                if (isset($attribs[
'gradientTransform'])) {
 
23928                                $this->svggradients[$this->svggradientid][
'coords'] = array($x1, $y1, $x2, $y2);
 
23929                                if (isset($attribs[
'xlink:href']) AND !empty($attribs[
'xlink:href'])) {
 
23931                                        $this->svggradients[$this->svggradientid][
'xref'] = substr($attribs[
'xlink:href'], 1);
 
23935                        case 'radialGradient': {
 
23936                                if ($this->pdfa_mode) {
 
23939                                if (!isset($attribs[
'id'])) {
 
23940                                        $attribs[
'id'] = 
'GR_'.(count($this->svggradients) + 1);
 
23942                                $this->svggradientid = $attribs[
'id'];
 
23943                                $this->svggradients[$this->svggradientid] = array();
 
23944                                $this->svggradients[$this->svggradientid][
'type'] = 3;
 
23945                                $this->svggradients[$this->svggradientid][
'stops'] = array();
 
23946                                if (isset($attribs[
'gradientUnits'])) {
 
23947                                        $this->svggradients[$this->svggradientid][
'gradientUnits'] = $attribs[
'gradientUnits'];
 
23949                                        $this->svggradients[$this->svggradientid][
'gradientUnits'] = 
'objectBoundingBox';
 
23952                                if (((!isset($attribs[
'cx'])) AND (!isset($attribs[
'cy'])))
 
23953                                        OR ((isset($attribs[
'cx']) AND (substr($attribs[
'cx'], -1) == 
'%'))
 
23954                                        OR (isset($attribs[
'cy']) AND (substr($attribs[
'cy'], -1) == 
'%')))) {
 
23955                                        $this->svggradients[$this->svggradientid][
'mode'] = 
'percentage';
 
23956                                } elseif (isset($attribs[
'r']) AND is_numeric($attribs[
'r']) AND ($attribs[
'r']) <= 1) {
 
23957                                        $this->svggradients[$this->svggradientid][
'mode'] = 
'ratio';
 
23959                                        $this->svggradients[$this->svggradientid][
'mode'] = 
'measure';
 
23961                                $cx = (isset($attribs[
'cx']) ? $attribs[
'cx'] : 0.5);
 
23962                                $cy = (isset($attribs[
'cy']) ? $attribs[
'cy'] : 0.5);
 
23963                                $fx = (isset($attribs[
'fx']) ? $attribs[
'fx'] : $cx);
 
23964                                $fy = (isset($attribs[
'fy']) ? $attribs[
'fy'] : $cy);
 
23965                                $r = (isset($attribs[
'r']) ? $attribs[
'r'] : 0.5);
 
23966                                if (isset($attribs[
'gradientTransform'])) {
 
23969                                $this->svggradients[$this->svggradientid][
'coords'] = array($cx, $cy, $fx, $fy, 
$r);
 
23970                                if (isset($attribs[
'xlink:href']) AND !empty($attribs[
'xlink:href'])) {
 
23972                                        $this->svggradients[$this->svggradientid][
'xref'] = substr($attribs[
'xlink:href'], 1);
 
23978                                if (substr($attribs[
'offset'], -1) == 
'%') {
 
23979                                        $offset = floatval(substr($attribs[
'offset'], -1)) / 100;
 
23981                                        $offset = floatval($attribs[
'offset']);
 
23987                                $opacity = isset($svgstyle[
'stop-opacity'])?$svgstyle[
'stop-opacity']:1;
 
23988                                $this->svggradients[$this->svggradientid][
'stops'][] = array(
'offset' => $offset, 
'color' => $stop_color, 
'opacity' => $opacity);
 
23996                                if (isset($attribs[
'd'])) {
 
23997                                        $d = trim($attribs[
'd']);
 
23999                                                $x = (isset($attribs[
'x'])?$attribs[
'x']:0);
 
24000                                                $y = (isset($attribs[
'y'])?$attribs[
'y']:0);
 
24001                                                $w = (isset($attribs[
'width'])?$attribs[
'width']:1);
 
24002                                                $h = (isset($attribs[
'height'])?$attribs[
'height']:1);
 
24005                                                        $this->SVGTransform($tm);
 
24006                                                        $this->SVGPath(
$d, 
'CNZ');
 
24008                                                        $this->StartTransform();
 
24009                                                        $this->SVGTransform($tm);
 
24010                                                        $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, 
$x, 
$y, 
$w, 
$h, 
'SVGPath', array(
$d, 
'CNZ'));
 
24011                                                        if (!empty($obstyle)) {
 
24012                                                                $this->SVGPath(
$d, $obstyle);
 
24014                                                        $this->StopTransform();
 
24025                                $x = (isset($attribs[
'x'])?$this->getHTMLUnitToUnits($attribs[
'x'], 0, $this->svgunit, 
false):0);
 
24026                                $y = (isset($attribs[
'y'])?$this->getHTMLUnitToUnits($attribs[
'y'], 0, $this->svgunit, 
false):0);
 
24027                                $w = (isset($attribs[
'width'])?$this->getHTMLUnitToUnits($attribs[
'width'], 0, $this->svgunit, 
false):0);
 
24028                                $h = (isset($attribs[
'height'])?$this->getHTMLUnitToUnits($attribs[
'height'], 0, $this->svgunit, 
false):0);
 
24029                                $rx = (isset($attribs[
'rx'])?$this->getHTMLUnitToUnits($attribs[
'rx'], 0, $this->svgunit, 
false):0);
 
24030                                $ry = (isset($attribs[
'ry'])?$this->getHTMLUnitToUnits($attribs[
'ry'], 0, $this->svgunit, 
false):$rx);
 
24032                                        $this->SVGTransform($tm);
 
24033                                        $this->RoundedRectXY(
$x, 
$y, 
$w, 
$h, $rx, $ry, 
'1111', 
'CNZ', array(), array());
 
24035                                        $this->StartTransform();
 
24036                                        $this->SVGTransform($tm);
 
24037                                        $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, 
$x, 
$y, 
$w, 
$h, 
'RoundedRectXY', array(
$x, 
$y, 
$w, 
$h, $rx, $ry, 
'1111', 
'CNZ'));
 
24038                                        if (!empty($obstyle)) {
 
24039                                                $this->RoundedRectXY(
$x, 
$y, 
$w, 
$h, $rx, $ry, 
'1111', $obstyle, array(), array());
 
24041                                        $this->StopTransform();
 
24049                                $r = (isset($attribs[
'r']) ? $this->getHTMLUnitToUnits($attribs[
'r'], 0, $this->svgunit, 
false) : 0);
 
24050                                $cx = (isset($attribs[
'cx']) ? $this->getHTMLUnitToUnits($attribs[
'cx'], 0, $this->svgunit, 
false) : (isset($attribs[
'x']) ? $this->getHTMLUnitToUnits($attribs[
'x'], 0, $this->svgunit, 
false) : 0));
 
24051                                $cy = (isset($attribs[
'cy']) ? $this->getHTMLUnitToUnits($attribs[
'cy'], 0, $this->svgunit, 
false) : (isset($attribs[
'y']) ? $this->getHTMLUnitToUnits($attribs[
'y'], 0, $this->svgunit, 
false) : 0));
 
24057                                        $this->SVGTransform($tm);
 
24058                                        $this->Circle($cx, $cy, 
$r, 0, 360, 
'CNZ', array(), array(), 8);
 
24060                                        $this->StartTransform();
 
24061                                        $this->SVGTransform($tm);
 
24062                                        $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, 
$x, 
$y, 
$w, 
$h, 
'Circle', array($cx, $cy, 
$r, 0, 360, 
'CNZ'));
 
24063                                        if (!empty($obstyle)) {
 
24064                                                $this->Circle($cx, $cy, 
$r, 0, 360, $obstyle, array(), array(), 8);
 
24066                                        $this->StopTransform();
 
24074                                $rx = (isset($attribs[
'rx']) ? $this->getHTMLUnitToUnits($attribs[
'rx'], 0, $this->svgunit, 
false) : 0);
 
24075                                $ry = (isset($attribs[
'ry']) ? $this->getHTMLUnitToUnits($attribs[
'ry'], 0, $this->svgunit, 
false) : 0);
 
24076                                $cx = (isset($attribs[
'cx']) ? $this->getHTMLUnitToUnits($attribs[
'cx'], 0, $this->svgunit, 
false) : (isset($attribs[
'x']) ? $this->getHTMLUnitToUnits($attribs[
'x'], 0, $this->svgunit, 
false) : 0));
 
24077                                $cy = (isset($attribs[
'cy']) ? $this->getHTMLUnitToUnits($attribs[
'cy'], 0, $this->svgunit, 
false) : (isset($attribs[
'y']) ? $this->getHTMLUnitToUnits($attribs[
'y'], 0, $this->svgunit, 
false) : 0));
 
24083                                        $this->SVGTransform($tm);
 
24084                                        $this->Ellipse($cx, $cy, $rx, $ry, 0, 0, 360, 
'CNZ', array(), array(), 8);
 
24086                                        $this->StartTransform();
 
24087                                        $this->SVGTransform($tm);
 
24088                                        $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, 
$x, 
$y, 
$w, 
$h, 
'Ellipse', array($cx, $cy, $rx, $ry, 0, 0, 360, 
'CNZ'));
 
24089                                        if (!empty($obstyle)) {
 
24090                                                $this->Ellipse($cx, $cy, $rx, $ry, 0, 0, 360, $obstyle, array(), array(), 8);
 
24092                                        $this->StopTransform();
 
24100                                $x1 = (isset($attribs[
'x1'])?$this->getHTMLUnitToUnits($attribs[
'x1'], 0, $this->svgunit, 
false):0);
 
24101                                $y1 = (isset($attribs[
'y1'])?$this->getHTMLUnitToUnits($attribs[
'y1'], 0, $this->svgunit, 
false):0);
 
24102                                $x2 = (isset($attribs[
'x2'])?$this->getHTMLUnitToUnits($attribs[
'x2'], 0, $this->svgunit, 
false):0);
 
24103                                $y2 = (isset($attribs[
'y2'])?$this->getHTMLUnitToUnits($attribs[
'y2'], 0, $this->svgunit, 
false):0);
 
24106                                $w = abs($x2 - $x1);
 
24107                                $h = abs($y2 - $y1);
 
24109                                        $this->StartTransform();
 
24110                                        $this->SVGTransform($tm);
 
24111                                        $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, 
$x, 
$y, 
$w, 
$h, 
'Line', array($x1, $y1, $x2, $y2));
 
24112                                        $this->Line($x1, $y1, $x2, $y2);
 
24113                                        $this->StopTransform();
 
24122                                $points = (isset($attribs[
'points'])?$attribs[
'points']:
'0 0');
 
24123                                $points = trim($points);
 
24125                                $points = preg_split(
'/[\,\s]+/si', $points);
 
24126                                if (count($points) < 4) {
 
24130                                $xmin = 2147483647;
 
24132                                $ymin = 2147483647;
 
24134                                foreach ($points as $key => $val) {
 
24135                                        $p[$key] = $this->getHTMLUnitToUnits($val, 0, $this->svgunit, 
false);
 
24136                                        if (($key % 2) == 0) {
 
24138                                                $xmin = min($xmin, $p[$key]);
 
24139                                                $xmax = max($xmax, $p[$key]);
 
24142                                                $ymin = min($ymin, $p[$key]);
 
24143                                                $ymax = max($ymax, $p[$key]);
 
24148                                $w = ($xmax - $xmin);
 
24149                                $h = ($ymax - $ymin);
 
24150                                if ($name == 
'polyline') {
 
24151                                        $this->StartTransform();
 
24152                                        $this->SVGTransform($tm);
 
24153                                        $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, 
$x, 
$y, 
$w, 
$h, 
'PolyLine', array($p, 
'CNZ'));
 
24154                                        if (!empty($obstyle)) {
 
24155                                                $this->PolyLine($p, $obstyle, array(), array());
 
24157                                        $this->StopTransform();
 
24160                                                $this->SVGTransform($tm);
 
24161                                                $this->Polygon($p, 
'CNZ', array(), array(), 
true);
 
24163                                                $this->StartTransform();
 
24164                                                $this->SVGTransform($tm);
 
24165                                                $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, 
$x, 
$y, 
$w, 
$h, 
'Polygon', array($p, 
'CNZ'));
 
24166                                                if (!empty($obstyle)) {
 
24167                                                        $this->Polygon($p, $obstyle, array(), array(), 
true);
 
24169                                                $this->StopTransform();
 
24179                                if (!isset($attribs[
'xlink:href']) OR empty($attribs[
'xlink:href'])) {
 
24182                                $x = (isset($attribs[
'x'])?$this->getHTMLUnitToUnits($attribs[
'x'], 0, $this->svgunit, 
false):0);
 
24183                                $y = (isset($attribs[
'y'])?$this->getHTMLUnitToUnits($attribs[
'y'], 0, $this->svgunit, 
false):0);
 
24184                                $w = (isset($attribs[
'width'])?$this->getHTMLUnitToUnits($attribs[
'width'], 0, $this->svgunit, 
false):0);
 
24185                                $h = (isset($attribs[
'height'])?$this->getHTMLUnitToUnits($attribs[
'height'], 0, $this->svgunit, 
false):0);
 
24186                                $img = $attribs[
'xlink:href'];
 
24188                                        $this->StartTransform();
 
24189                                        $this->SVGTransform($tm);
 
24190                                        $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, 
$x, 
$y, 
$w, 
$h);
 
24191                                        if (preg_match(
'/^data:image\/[^;]+;base64,/', 
$img, $m) > 0) {
 
24193                                                $img = 
'@'.base64_decode(substr(
$img, strlen($m[0])));
 
24200                                                if ((
$img[0] == 
'/') AND !empty(
$_SERVER[
'DOCUMENT_ROOT']) AND (
$_SERVER[
'DOCUMENT_ROOT'] != 
'/')) {
 
24202                                                        if (($findroot === 
false) OR ($findroot > 1)) {
 
24203                                                                if (substr(
$_SERVER[
'DOCUMENT_ROOT'], -1) == 
'/') {
 
24211                                                $testscrtype = @parse_url(
$img);
 
24212                                                if (!isset($testscrtype[
'query']) OR empty($testscrtype[
'query'])) {
 
24214                                                        $img = str_replace(K_PATH_URL, K_PATH_MAIN, 
$img);
 
24219                                        if (($imgtype == 
'eps') OR ($imgtype == 
'ai')) {
 
24221                                        } elseif ($imgtype == 
'svg') {
 
24223                                                $svggradients = $this->svggradients;
 
24224                                                $svggradientid = $this->svggradientid;
 
24225                                                $svgdefsmode = $this->svgdefsmode;
 
24226                                                $svgdefs = $this->svgdefs;
 
24227                                                $svgclipmode = $this->svgclipmode;
 
24228                                                $svgclippaths = $this->svgclippaths;
 
24229                                                $svgcliptm = $this->svgcliptm;
 
24230                                                $svgclipid = $this->svgclipid;
 
24231                                                $svgtext = $this->svgtext;
 
24232                                                $svgtextmode = $this->svgtextmode;
 
24235                                                $this->svggradients = $svggradients;
 
24236                                                $this->svggradientid = $svggradientid;
 
24237                                                $this->svgdefsmode = $svgdefsmode;
 
24238                                                $this->svgdefs = $svgdefs;
 
24239                                                $this->svgclipmode = $svgclipmode;
 
24240                                                $this->svgclippaths = $svgclippaths;
 
24241                                                $this->svgcliptm = $svgcliptm;
 
24242                                                $this->svgclipid = $svgclipid;
 
24243                                                $this->svgtext = $svgtext;
 
24244                                                $this->svgtextmode = $svgtextmode;
 
24248                                        $this->StopTransform();
 
24255                                if (isset($this->svgtextmode[
'text-anchor']) AND !empty($this->svgtext)) {
 
24259                                $this->svgtextmode[
'invisible'] = $invisible;
 
24263                                array_push($this->svgstyles, $svgstyle);
 
24264                                if (isset($attribs[
'x'])) {
 
24265                                        $x = $this->getHTMLUnitToUnits($attribs[
'x'], 0, $this->svgunit, 
false);
 
24266                                } elseif ($name == 
'tspan') {
 
24271                                if (isset($attribs[
'dx'])) {
 
24272                                        $x += $this->getHTMLUnitToUnits($attribs[
'dx'], 0, $this->svgunit, 
false);
 
24274                                if (isset($attribs[
'y'])) {
 
24275                                        $y = $this->getHTMLUnitToUnits($attribs[
'y'], 0, $this->svgunit, 
false);
 
24276                                } elseif ($name == 
'tspan') {
 
24281                                if (isset($attribs[
'dy'])) {
 
24282                                        $y += $this->getHTMLUnitToUnits($attribs[
'dy'], 0, $this->svgunit, 
false);
 
24284                                $svgstyle[
'text-color'] = $svgstyle[
'fill'];
 
24285                                $this->svgtext = 
'';
 
24286                                if (isset($svgstyle[
'text-anchor'])) {
 
24287                                        $this->svgtextmode[
'text-anchor'] = $svgstyle[
'text-anchor'];
 
24289                                        $this->svgtextmode[
'text-anchor'] = 
'start';
 
24291                                if (isset($svgstyle[
'direction'])) {
 
24292                                        if ($svgstyle[
'direction'] == 
'rtl') {
 
24293                                                $this->svgtextmode[
'rtl'] = 
true;
 
24295                                                $this->svgtextmode[
'rtl'] = 
false;
 
24298                                        $this->svgtextmode[
'rtl'] = 
false;
 
24300                                if (isset($svgstyle[
'stroke']) AND ($svgstyle[
'stroke'] != 
'none') AND isset($svgstyle[
'stroke-width']) AND ($svgstyle[
'stroke-width'] > 0)) {
 
24301                                        $this->svgtextmode[
'stroke'] = $this->getHTMLUnitToUnits($svgstyle[
'stroke-width'], 0, $this->svgunit, 
false);
 
24303                                        $this->svgtextmode[
'stroke'] = 
false;
 
24305                                $this->StartTransform();
 
24306                                $this->SVGTransform($tm);
 
24307                                $obstyle = $this->setSVGStyles($svgstyle, $prev_svgstyle, 
$x, 
$y, 1, 1);
 
24314                                if (isset($attribs[
'xlink:href']) AND !empty($attribs[
'xlink:href'])) {
 
24315                                        $svgdefid = substr($attribs[
'xlink:href'], 1);
 
24316                                        if (isset($this->svgdefs[$svgdefid])) {
 
24317                                                $use = $this->svgdefs[$svgdefid];
 
24318                                                if (isset($attribs[
'xlink:href'])) {
 
24319                                                        unset($attribs[
'xlink:href']);
 
24321                                                if (isset($attribs[
'id'])) {
 
24322                                                        unset($attribs[
'id']);
 
24324                                                if (isset($use[
'attribs'][
'x']) AND isset($attribs[
'x'])) {
 
24325                                                        $attribs[
'x'] += $use[
'attribs'][
'x'];
 
24327                                                if (isset($use[
'attribs'][
'y']) AND isset($attribs[
'y'])) {
 
24328                                                        $attribs[
'y'] += $use[
'attribs'][
'y'];
 
24330                                                if (empty($attribs[
'style'])) {
 
24331                                                        $attribs[
'style'] = 
'';
 
24333                                                if (!empty($use[
'attribs'][
'style'])) {
 
24335                                                        $attribs[
'style'] = str_replace(
';;',
';',
';'.$use[
'attribs'][
'style'].$attribs[
'style']);
 
24337                                                $attribs = array_merge($use[
'attribs'], $attribs);
 
24338                                                $this->startSVGElementHandler($parser, $use[
'name'], $attribs);
 
24349                if (!empty($attribs[
'child_elements'])) {
 
24350                        $child_elements = $attribs[
'child_elements'];
 
24351                        unset($attribs[
'child_elements']);
 
24352                        foreach($child_elements as $child_element) {
 
24353                                if (empty($child_element[
'attribs'][
'closing_tag'])) {
 
24354                                        $this->startSVGElementHandler(
'child-tag', $child_element[
'name'], $child_element[
'attribs']);
 
24356                                        if (isset($child_element[
'attribs'][
'content'])) {
 
24357                                                $this->svgtext = $child_element[
'attribs'][
'content'];
 
24359                                        $this->endSVGElementHandler(
'child-tag', $child_element[
'name']);
 
24374                $name = $this->removeTagNamespace($name);
 
24375                if ($this->svgdefsmode AND !in_array($name, array(
'defs', 
'clipPath', 
'linearGradient', 
'radialGradient', 
'stop'))) {;
 
24376                        if (end($this->svgdefs) !== FALSE) {
 
24377                                $last_svgdefs_id = key($this->svgdefs);
 
24378                                if (isset($this->svgdefs[$last_svgdefs_id][
'attribs'][
'child_elements'])) {
 
24379                                        foreach($this->svgdefs[$last_svgdefs_id][
'attribs'][
'child_elements'] as $child_element) {
 
24380                                                if (isset($child_element[
'attribs'][
'id']) AND ($child_element[
'name'] == $name)) {
 
24381                                                        $this->svgdefs[$last_svgdefs_id][
'attribs'][
'child_elements'][$child_element[
'attribs'][
'id'].
'_CLOSE'] = array(
'name' => $name, 
'attribs' => array(
'closing_tag' => TRUE, 
'content' => $this->svgtext));
 
24385                                        if ($this->svgdefs[$last_svgdefs_id][
'name'] == $name) {
 
24386                                                $this->svgdefs[$last_svgdefs_id][
'attribs'][
'child_elements'][$last_svgdefs_id.
'_CLOSE'] = array(
'name' => $name, 
'attribs' => array(
'closing_tag' => TRUE, 
'content' => $this->svgtext));
 
24395                                $this->svgdefsmode = 
false;
 
24400                                $this->svgclipmode = 
false;
 
24404                                if (--$this->svg_tag_depth <= 0) {
 
24410                                array_pop($this->svgstyles);
 
24411                                $this->StopTransform();
 
24416                                if ($this->svgtextmode[
'invisible']) {
 
24422                                $text = $this->svgtext;
 
24424                                $textlen = $this->GetStringWidth(
$text);
 
24425                                if ($this->svgtextmode[
'text-anchor'] != 
'start') {
 
24427                                        if ($this->svgtextmode[
'text-anchor'] == 
'end') {
 
24428                                                if ($this->svgtextmode[
'rtl']) {
 
24429                                                        $this->x += $textlen;
 
24431                                                        $this->x -= $textlen;
 
24433                                        } elseif ($this->svgtextmode[
'text-anchor'] == 
'middle') {
 
24434                                                if ($this->svgtextmode[
'rtl']) {
 
24435                                                        $this->x += ($textlen / 2);
 
24437                                                        $this->x -= ($textlen / 2);
 
24441                                $textrendermode = $this->textrendermode;
 
24442                                $textstrokewidth = $this->textstrokewidth;
 
24443                                $this->setTextRenderingMode($this->svgtextmode[
'stroke'], 
true, 
false);
 
24444                                if ($name == 
'text') {
 
24450                                $this->Cell($textlen, 0, 
$text, 0, 0, 
'', 
false, 
'', 0, 
false, 
'L', 
'T');
 
24451                                if ($name == 
'text') {
 
24457                                $this->textrendermode = $textrendermode;
 
24458                                $this->textstrokewidth = $textstrokewidth;
 
24459                                $this->svgtext = 
'';
 
24460                                $this->StopTransform();
 
24461                                if (!$this->svgdefsmode) {
 
24462                                        array_pop($this->svgstyles);
 
24481                $this->svgtext .= 
$data;
 
foreach($mandatory_scripts as $file) $timestamp
PHP class to creates array representations for 2D barcodes to be used with TCPDF (http://www....
PHP class to creates array representations for common 1D barcodes to be used with TCPDF (http://www....
static getSpotColor($name, &$spotc)
Return the Spot color array.
static convertHTMLColorToDec($hcolor, &$spotc, $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.
static _JScolor($color)
Convert color to javascript color.
static utf8StrRev($str, $setbom=false, $forcertl=false, $isunicode=true, &$currentfont)
Reverse the RLT substrings using the Bidirectional Algorithm (http://unicode.org/reports/tr9/).
static UTF8ArrSubString($strarr, $start='', $end='', $unicode=true)
Extract a slice of the $strarr array and return it as string.
static UniArrSubString($uniarr, $start='', $end='')
Extract a slice of the $uniarr array and return it as string.
static getFontFullPath($file, $fontdir=false)
Return font full path.
static UTF8ArrToLatin1Arr($unicode)
Converts UTF-8 characters array to array of Latin1 characters array
static utf8Bidi($ta, $str='', $forcertl=false, $isunicode=true, &$currentfont)
Reverse the RLT substrings using the Bidirectional Algorithm (http://unicode.org/reports/tr9/).
static UTF8ToLatin1($str, $isunicode=true, &$currentfont)
Converts UTF-8 strings to Latin1 when using the standard 14 core fonts.
static unichr($c, $unicode=true)
Returns the unicode caracter specified by the value.
static _getfontpath()
Return fonts path.
static UTF8StringToArray($str, $isunicode=true, &$currentfont)
Converts UTF-8 strings to codepoints array.
static arrUTF8ToUTF16BE($unicode, $setbom=false)
Converts array of UTF-8 characters to UTF16-BE string.
static getFontRefSize($size, $refsize=12)
Get a reference font size.
static UTF8ToUTF16BE($str, $setbom=false, $isunicode=true, &$currentfont)
Converts UTF-8 strings to UTF16-BE.
static UTF8ArrayToUniArray($ta, $isunicode=true)
Convert an array of UTF8 values to array of unicode characters.
static _getTrueTypeFontSubset($font, $subsetchars)
Returns a subset of the TrueType font data without the unused glyphs.
static $uni_type
Array of Unicode types.
static $uni_identity_h
ToUnicode map for Identity-H stream static.
static $uni_RE_PATTERN_ARABIC
Pattern to test Arabic strings using regular expressions.
static $uni_RE_PATTERN_RTL
Pattern to test RTL (Righ-To-Left) strings using regular expressions.
static setGDImageTransparency($new_image, $image)
Set the transparency for the given GD image.
static getImageFileType($imgfile, $iminfo=array())
Return the image type given the file name or array returned by getimagesize() function.
static _toPNG($image, $tempfile)
Convert the loaded image to a PNG and then return a structure for the PDF creator.
static _parsejpeg($file)
Extract info from a JPEG file without using the GD library.
static $svginheritprop
Array of hinheritable SVG properties.
static _toJPEG($image, $quality, $tempfile)
Convert the loaded image to a JPEG and then return a structure for the PDF creator.
Static methods used by the TCPDF class.
static setPageBoxes($page, $type, $llx, $lly, $urx, $ury, $points=false, $k, $pagedim=array())
Set page boundaries.
static getPathPaintOperator($style, $default='S')
Get the Path-Painting Operators.
static getPageMode($mode='UseNone')
Get the canonical page layout mode.
static fopenLocal($filename, $mode)
Wrapper to use fopen only with local files.
static getCSSdataArray($dom, $key, $css)
Returns the styles array that apply for the selected HTML tag.
static getUserPermissionCode($permissions, $mode=0)
Return the permission code used on encryption (P value).
static getFormattedDate($time)
Returns a formatted date-time.
static extractCSSproperties($cssdata)
Extracts the CSS properties from a CSS string.
static $alias_group_tot_pages
String alias for total number of pages in a single group.
static getAnnotOptFromJSProp($prop, &$spot_colors, $rtl=false)
Convert JavaScript form fields properties array to Annotation Properties array.
static getEncPermissionsString($protection)
Convert encryption P value to a string of bytes, low-order byte first.
static getPageLayoutMode($layout='SinglePage')
Get the canonical page layout mode.
static _escape($s)
Add "\" before "", "(" and ")".
static getObjFilename($type='tmp', $file_id='')
Returns a temporary filename for caching object on filesystem.
static getPageSizeFromFormat($format)
Get page dimensions from format name.
static $enc_padding
Encryption padding string.
static $pageboxes
Array page boxes names static.
static $alias_tot_pages
String alias for total number of pages.
static getTagStyleFromCSSarray($css)
Compact CSS data array into single string.
static intToRoman($number)
Returns the Roman representation of an integer number.
static sendOutputData($data, $length)
Output input data and compress it if possible.
static replacePageNumAliases($page, $replace, $diff=0)
Replace page number aliases with number.
static fixHTMLCode($html, $default_css='', $tagvs='', $tidy_options='', &$tagvspaces)
Cleanup HTML code (requires HTML Tidy library).
static getTCPDFProducer()
Return the current TCPDF producer.
static getVectorsAngle($x1, $y1, $x2, $y2)
Returns the angle in radiants between two vectors.
static $alias_group_num_page
String alias for group page number.
static $byterange_string
ByteRange placemark used during digital signature process.
static objclone($object)
Creates a copy of a class object.
static encodeNameObject($name)
Encode a name object.
static fileGetContents($file)
Reads entire file into a string.
static formatPageNumber($num)
Format the page numbers.
static removeSHY($txt='', $unicode=true)
Removes SHY characters from text.
static pregSplit($pattern, $modifiers, $subject, $limit=NULL, $flags=NULL)
Split string by a regular expression.
static convertHexStringToString($bs)
Convert hexadecimal string to string.
static formatTOCPageNumber($num)
Format the page numbers on the Table Of Content.
static revstrpos($haystack, $needle, $offset=0)
Find position of last occurrence of a substring in a string.
static swapPageBoxCoordinates($page, $pagedim)
Swap X and Y coordinates of page boxes (change page boxes orientation).
static empty_string($str)
Determine whether a string is empty.
static _AESnopad($key, $text)
Returns the input text exrypted using AES algorithm and the specified key.
static _escapeXML($str)
Escape some special characters (< > &) for XML output.
static set_mqr($mqr)
Sets the current active configuration setting of magic_quotes_runtime (if the set_magic_quotes_runtim...
static getHyphenPatternsFromTEX($file)
Returns an array of hyphenation patterns.
static getRandomSeed($seed='')
Returns a string containing random data to be used as a seed for encryption methods.
static _AES($key, $text)
Returns the input text exrypted using AES algorithm and the specified key.
static _md5_16($str)
Encrypts a string using MD5 and returns it's value as a binary string.
static getBorderMode($brd, $position='start', $opencell=true)
Get the border mode accounting for multicell position (opens bottom side of multicell crossing pages)
static $alias_num_page
String alias for page number.
static _RC4($key, $text, &$last_enc_key, &$last_enc_key_c)
Returns the input text encrypted using RC4 algorithm and the specified key.
static getSVGTransformMatrix($attribute)
Get the tranformation matrix from SVG transform attribute.
static $alias_right_shift
String alias for right shift compensation used to correctly align page numbers on the right.
static getTransformationMatrixProduct($ta, $tb)
Get the product of two SVG tranformation matrices.
static isValidURL($url)
Check if the URL exist.
static getTimestamp($date)
Returns timestamp in seconds from formatted date-time.
static get_mqr()
Gets the current active configuration setting of magic_quotes_runtime (if the get_magic_quotes_runtim...
PHP class for generating PDF documents without requiring external extensions.
Ln($h='', $cell=false)
Performs a line break.
SetXY($x, $y, $rtloff=false)
Defines the abscissa and ordinate of the current position.
getPageNumGroupAlias()
Return the alias for the page number on the current page group.
$colxshift
Array of: X difference between table cell x start and starting page margin, cellspacing,...
endTOCPage()
Terminate the current TOC (Table Of Content) page.
startPage($orientation='', $format='', $tocpage=false)
Starts a new page to the document.
$DrawColor
Commands for drawing color.
getImageRBY()
Return the right-bottom (or left-bottom for RTL) corner Y coordinate of last inserted image.
$doc_modification_timestamp
Document modification date-time.
$crMargin
Cell right margin (used by regions).
IncludeJS($script)
Adds a javascript.
MirrorV($y='')
Verical Mirroring.
unserializeTCPDFtagParameters($data)
Unserialize parameters to be used with TCPDF tag in HTML code.
$pdfunit
Default unit of measure for document.
setJPEGQuality($quality)
Set the default JPEG compression quality (1-100)
AddFont($family, $style='', $fontfile='', $subset='default')
Imports a TrueType, Type1, core, or CID0 font and makes it available.
$encryptdata
Array containing encryption settings.
setGraphicVars($gvars, $extended=false)
Set graphic variables.
$feps
Epsilon value used for float calculations.
endSVGElementHandler($parser, $name)
Sets the closing SVG element handler function for the XML parser.
_putimages()
Output images.
AddSpotColor($name, $c, $m, $y, $k)
Defines a new spot color.
setFontSubsetting($enable=true)
Enable or disable default option for font subsetting.
$custom_xmp
Custom XMP data.
stringLeftTrim($str, $replace='')
Left trim the input string.
_putsignature()
Add certification signature (DocMDP or UR3) You can set only one signature type.
endTemplate()
End the current XObject Template started with startTemplate() and restore the previous graphic state.
$CoreFonts
Array of standard font names.
lastPage($resetmargins=false)
Reset pointer to the last document page.
getFontDescent($font, $style='', $size=0)
Return the font descent value.
getOriginalMargins()
Returns an array containing original margins:
getCSSFontStretching($stretch, $parent=100)
Returns the percentage of font stretching from CSS value.
getFontBBox()
Returns the bounding box of the current font in user units.
$listcount
HTML PARSER: array count list items on nested lists.
$lisymbol
Symbol used for HTML unordered list items.
SetLineWidth($width)
Defines the line width.
$InFooter
Flag set when processing page footer.
resetLastH()
Reset the last cell height.
$page_obj_id
ID of page objects.
$OutlineRoot
Outline root for bookmark.
SetTopMargin($margin)
Defines the top margin.
$sign
Boolean flag to enable document digital signature.
setSignature($signing_cert='', $private_key='', $private_key_password='', $extracerts='', $cert_type=2, $info=array(), $approval='')
Enable document signature (requires the OpenSSL Library).
setFooterData($tc=array(0, 0, 0), $lc=array(0, 0, 0))
Set footer data.
$svgclippaths
Array of SVG clipPath commands.
$file_id
File ID (used on document trailer).
$sig_obj_id
Digital signature object ID.
getCellBorder($x, $y, $w, $h, $brd)
Returns the code to draw the cell border.
$inthead
True when we are printing the thead section on a new page.
$transfmrk
Array used to store positions of graphics transformation blocks inside the page buffer.
$form_action
Current form action (used during XHTML rendering).
openHTMLTagHandler($dom, $key, $cell)
Process opening tags.
getFontStyle()
Returns the current font style.
__construct($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding='UTF-8', $diskcache=false, $pdfa=false)
This is the class constructor.
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.
inPageBody()
Check if we are on the page body (excluding page header and footer).
$re_spaces
Regular expression used to find blank characters (required for word-wrapping).
getFontFamilyName($fontfamily)
Return normalized font name.
$isunicode
Boolean flag set to true when the input text is unicode (require unicode fonts).
$theadMargins
Margins used for table header.
setPageMark()
Set start-writing mark on current page stream used to put borders and fills.
setFormDefaultProp($prop=array())
Set default properties for form fields.
_dooverlinew($x, $y, $w)
Overline for rectangular text area.
_putviewerpreferences()
Output viewer preferences.
LinearGradient($x, $y, $w, $h, $col1=array(), $col2=array(), $coords=array(0, 0, 1, 0))
Paints a linear colour gradient.
_dochecks()
Check for locale-related bug.
$page
Current page number.
$tagvspaces
Array used for custom vertical spaces for HTML tags.
$print_footer
Boolean flag to print/hide page footer.
setLastH($h)
Set the last cell height.
$clMargin
Cell left margin (used by regions).
getImageBuffer($image)
Get image buffer content.
getPDFData()
Returns the PDF data.
setListIndentWidth($width)
Set custom width for list indentation.
colorRegistrationBar($x, $y, $w, $h, $transition=true, $vertical=false, $colors='A, R, G, B, C, M, Y, K')
Paints color transition registration bars.
checkPageRegions($h, $x, $y)
Check page for no-write regions and adapt current coordinates and page margins if necessary.
$txtshadow
Text shadow data array.
SetCreator($creator)
Defines the creator of the document.
_getobj($objid='')
Return the starting object string for the selected object ID.
getAlpha()
Get the alpha mode array (CA, ca, BM, AIS).
$listindentlevel
HTML PARSER: current list indententation level.
$form_mode
Current method to submit forms.
_addfield($type, $name, $x, $y, $w, $h, $prop)
Adds a javascript form field.
_putspotcolors()
Output Spot Colors Resources.
$pagelen
Array containing page lengths in bytes.
TranslateX($t_x)
Translate graphic object horizontally.
ScaleY($s_y, $x='', $y='')
Vertical Scaling.
$dpi
DPI (Dot Per Inch) Document Resolution (do not change).
$internal_encoding
PHP internal encoding.
$ZoomMode
Zoom display mode.
Curve($x0, $y0, $x1, $y1, $x2, $y2, $x3, $y3, $style='', $line_style=array(), $fill_color=array())
Draws a Bezier curve.
getHeaderFont()
Get header font.
getBuffer()
Get buffer content.
getGraphicVars()
Returns current graphic variables as array.
$default_monospaced_font
Default monospace font.
getCellHeight($fontsize, $padding=TRUE)
Return the cell height.
$spot_colors
Array of Spot colors.
StopTransform()
Stops a 2D tranformation restoring previous graphic state.
$page_regions
Array of no-write regions.
getOverprint()
Get the overprint mode array (OP, op, OPM).
PieSectorXY($xc, $yc, $rx, $ry, $a, $b, $style='FD', $cw=false, $o=0, $nc=2)
Draw the sector of an ellipse.
$overprint
Overprint mode array.
$encoding
Default encoding.
$svgcliptm
Array of SVG clipPath tranformation matrix.
setContentMark($page=0)
Set start-writing mark on selected page.
$ColorFlag
Indicates whether fill and text colors are different.
Error($msg)
Throw an exception or print an error message and die if the K_TCPDF_PARSER_THROW_EXCEPTION_ERROR cons...
setPDFVersion($version='1.7')
Set the PDF version (check PDF reference for valid values).
GetCharWidth($char, $notlast=true)
Returns the length of the char in user unit for the current font considering current stretching and s...
SetLeftMargin($margin)
Defines the left margin.
$pageopen
Store the fage status (true when opened, false when closed).
$svggradientid
ID of last SVG gradient.
setStartingPageNumber($num=1)
Set the starting page number.
$page_boxes
Define the page boundaries boxes to be set on document.
Bookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0, 0, 0), $x=-1, $link='')
Adds a bookmark.
$images
Array of used images.
removePageRegion($key)
Remove a single no-write region.
setLanguageArray($language)
Set language array.
Polygon($p, $style='', $line_style=array(), $fill_color=array(), $closed=true)
Draws a polygon.
getAbsFontMeasure($s)
Convert a relative font measure into absolute value.
setPageBuffer($page, $data, $append=false)
Set page buffer content.
$fwPt
Width of page format in points.
SetAbsX($x)
Set the absolute X coordinate of the current pointer.
copyPage($page=0)
Clone the specified page to a new page.
putHtmlListBullet($listdepth, $listtype='', $size=10)
Output an HTML list bullet or ordered item symbol.
getCSSBorderStyle($cssborder)
Returns the border style array from CSS border properties.
Close()
Terminates the PDF document.
startPageGroup($page='')
Create a new page group.
setSRGBmode($mode=false)
Set flag to force sRGB_IEC61966-2.1 black scaled ICC color profile for the whole document.
$annotation_fonts
List of fonts used on form fields (fontname => fontkey).
$tsa_data
Timestamping data.
$linestyleJoin
PDF string for join value of the last line.
getNumberOfColumns()
Return the current number of columns.
rollbackTransaction($self=false)
This method allows to undo the latest transaction by returning the latest saved TCPDF object with sta...
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.
deletePage($page)
Remove the specified page.
segSVGContentHandler($parser, $data)
Sets the character data handler function for the XML parser.
$objcopy
Cloned copy of the current class object.
SetCellPadding($pad)
Set the same internal Cell padding for top, right, bottom, left-.
$footer_text_color
Color for footer text (RGB array).
hyphenateWord($word, $patterns, $dictionary=array(), $leftmin=1, $rightmin=2, $charmin=1, $charmax=8)
Returns an array of chars containing soft hyphens.
$imagekeys
Store the image keys.
printTemplate($id, $x='', $y='', $w=0, $h=0, $align='', $palign='', $fitonpage=false)
Print an XObject Template.
getAliasNbPages()
Returns the string alias used for the total number of pages.
movePage($frompage, $topage)
Move a page to a previous position.
SetRightMargin($margin)
Defines the right margin.
getImageScale()
Returns the adjusting factor to convert pixels to user units.
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).
$pagegroups
Array that contains the number of pages in each page group.
Output($name='doc.pdf', $dest='I')
Send the document to a given destination: string, local file or browser.
SetLineStyle($style, $ret=false)
Set line style.
_putjavascript()
Create a javascript PDF string.
$svgdefs
Array of SVG defs.
_putresources()
Output Resources.
$font_spacing
Increases or decreases the space between characters in a text by the specified amount (tracking).
getFooterFont()
Get Footer font.
sortBookmarks()
Sort bookmarks for page and key.
GetX()
Returns the relative X value of current position.
$lasth
Height of last cell printed.
$font_stretching
Percentage of character stretching.
_putAPXObject($w=0, $h=0, $stream='')
Put appearance streams XObject used to define annotation's appearance states.
_putbookmarks()
Create a bookmark PDF string.
_getannotsrefs($n)
Get references to page annotations.
_dounderlinew($x, $y, $w)
Underline for rectangular text area.
PageNoFormatted()
Returns the current page number formatted as a string.
SetAutoPageBreak($auto, $margin=0)
Enables or disables the automatic page breaking mode.
$textrendermode
Text rendering mode: 0 = Fill text; 1 = Stroke text; 2 = Fill, then stroke text; 3 = Neither fill nor...
isCharDefined($char, $font='', $style='')
Return true in the character is present in the specified font.
Translate($t_x, $t_y)
Translate graphic object horizontally and vertically.
setAlpha($stroking=1, $bm='Normal', $nonstroking='', $ais=false)
Set alpha for stroking (CA) and non-stroking (ca) operations.
$signature_appearance
Data for digital signature appearance.
$footerlen
Array used to store footer length of each page.
$force_srgb
If true force sRGB color profile for all document.
_UEvalue()
Compute UE value (used for encryption)
setColumnsArray($columns)
Set columns array.
$header_string
String to pring on page header after title.
write1DBarcode($code, $type, $x='', $y='', $w='', $h='', $xres='', $style='', $align='')
Print a Linear Barcode.
setOverprint($stroking=true, $nonstroking='', $mode=0)
Set overprint mode for stroking (OP) and non-stroking (op) painting operations.
registrationMark($x, $y, $r, $double=false, $cola=array(100, 100, 100, 100, 'All'), $colb=array(0, 0, 0, 0, 'None'))
Paints a registration mark.
$fhPt
Height of page format in points.
getDestination()
Return the Named Destination array.
PolyLine($p, $style='', $line_style=array(), $fill_color=array())
Draws a polygonal line.
MirrorH($x='')
Horizontal Mirroring.
$rtl
Boolean flag to indicate if the document language is Right-To-Left.
addEmptySignatureAppearance($x=0, $y=0, $w=0, $h=0, $page=-1, $name='')
Add an empty digital signature appearance (a cliccable rectangle area to get signature properties)
getPageBuffer($page)
Get page buffer content.
removeTagNamespace($name)
Return the tag name without the namespace.
_newobj()
Begin a new object and return the object number.
startSVGElementHandler($parser, $name, $attribs, $ctm=array())
Sets the opening SVG element handler function for the XML parser.
addExtGState($parms)
Add transparency parameters to the current extgstate.
selectColumn($col='')
Set position at a given column.
getCSSFontSpacing($spacing, $parent=0)
Returns the letter-spacing value from CSS value.
$newline
Boolean flag to indicate if a new line is created.
getPageWidth($pagenum='')
Returns the page width in units.
$FontFiles
Array of font files.
AddPage($orientation='', $format='', $keepmargins=false, $tocpage=false)
Adds a new page to the document.
setTableHeader()
This method is used to render the table header on new page (if any).
closeHTMLTagHandler($dom, $key, $cell, $maxbottomliney=0)
Process closing tags.
$svgunit
Deafult unit of measure for SVG.
$linethrough
line through state
replaceMissingChars($text, $font='', $style='', $subs=array())
Replace missing font characters on selected font with specified substitutions.
Header()
This method is used to render the page header.
$underline
Underlining flag.
_enddoc()
Output end of document (EOF).
getRemainingWidth()
Returns the remaining width between the current position and margins.
ImageSVG($file, $x='', $y='', $w=0, $h=0, $link='', $align='', $palign='', $border=0, $fitonpage=false)
Embedd a Scalable Vector Graphics (SVG) image.
getCSSMargin($cssmargin, $width=0)
Get the internal Cell margin from CSS attribute.
setRasterizeVectorImages($mode)
Enable/disable rasterization of vector images using ImageMagick library.
$svgclipmode
Boolean value true when in SVG clipPath tag.
_putXMP()
Put XMP data object and return ID.
adjustCellPadding($brd=0)
Adjust the internal Cell padding array to take account of the line width.
getHashForTCPDFtagParams($data)
Return an hash code used to ensure that the serialized data has been generated by this TCPDF instance...
$default_table_columns
Default number of columns for html table.
Open()
This method begins the generation of the PDF document.
getHtmlDomArray($html)
Returns the HTML DOM array.
$LineWidth
Line width in user unit.
$efnames
Embedded Files Names.
Scale($s_x, $s_y, $x='', $y='')
Vertical and horizontal non-proportional Scaling.
__destruct()
Default destructor.
_putcidfont0($font)
Output CID-0 fonts.
_putextgstates()
Put extgstates for object transparency.
$header_logo_width
Width of header image logo in user units.
GetAbsX()
Returns the absolute X value of current position.
$tempfontsize
Temporary font size in points.
$jpeg_quality
Set the default JPEG compression quality (1-100).
$htmlLinkFontStyle
Default font style to add to html links.
getDocModificationTimestamp()
Returns document modification timestamp in seconds.
$js_objects
Javascript objects array.
_outCurveV($x2, $y2, $x3, $y3)
Append a cubic Bezier curve to the current path.
RoundedRect($x, $y, $w, $h, $r, $round_corner='1111', $style='', $border_style=array(), $fill_color=array())
Draws a rounded rectangle.
getBorderStartPosition()
Return the starting coordinates to draw an html border.
$CurrentFont
Current font info.
SetCompression($compress=true)
Activates or deactivates page compression.
resetHeaderTemplate()
Reset the xobject template used by Header() method.
$buffer
Buffer holding in-memory PDF.
getSpaceString()
Returns the string used to find spaces.
$svgdefsmode
Boolean value true when in SVG defs group.
$font_obj_ids
Store the font object IDs.
$fontkeys
Store the font keys.
$FontAscent
Current font ascent (distance between font top and baseline).
getPageDimensions($pagenum='')
Returns an array of page dimensions:
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 Imagick or GD library.
$footer_font
Default font used on page footer.
$default_graphic_vars
Array of default graphic settings.
$FontFamily
Current font family.
$endlinex
End position of the latest inserted line.
Transform($tm)
Apply graphic transformations.
getHTMLUnitToUnits($htmlval, $refsize=1, $defaultunit='px', $points=false)
Convert HTML string containing value and unit of measure to user's units or points.
SkewY($angle_y, $x='', $y='')
Skew vertically.
_putpages()
Output pages (and replace page number aliases).
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.
$listindent
HTML PARSER: indent amount for lists.
getFontStretching()
Get the percentage of character stretching.
getImageRBX()
Return the right-bottom (or left-bottom for RTL) corner X coordinate of last inserted image.
setImageBuffer($image, $data)
Set image buffer content.
$FillColor
Commands for filling color.
$PageMode
A name object specifying how the document should be displayed when opened.
$svgclipid
ID of last SVG clipPath.
$javascript
Javascript code.
setTempRTL($mode)
Force temporary RTL language direction.
startLayer($name='', $print=true, $view=true, $lock=true)
Start a new pdf layer.
$cell_margin
Array of cell margins ('T' => top, 'R' => right, 'B' => bottom, 'L' => left).
SetFontSize($size, $out=true)
Defines the size of the current font.
getCellHeightRatio()
return the height of cell repect font height.
$cache_file_length
Array used to store the lengths of cache files.
$FontStyle
Current font style.
getHeaderData()
Returns header data:
$empty_signature_appearance
Array of empty digital signature appearances.
$header_text_color
Color for header text (RGB array).
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.
$footer_line_color
Color for footer line (RGB array).
setOpenCell($isopen)
Set the top/bottom cell sides to be open or closed when the cell cross the page.
setHtmlVSpace($tagvs)
Set the vertical spaces for HTML tags.
TextField($name, $w, $h, $prop=array(), $opt=array(), $x='', $y='', $js=false)
Creates a text field.
$linestyleWidth
PDF string for width value of the last line.
ListBox($name, $w, $h, $values, $prop=array(), $opt=array(), $x='', $y='', $js=false)
Creates a List-box field.
$linestyleDash
PDF string for dash value of the last line.
_getxobjectdict()
Return XObjects Dictionary.
_putinfo()
Adds some Metadata information (Document Information Dictionary) (see Chapter 14.3....
_fixAES256Password($password)
Convert password for AES-256 encryption mode.
$diffs
Array of encoding differences.
getAutoPageBreak()
Return the auto-page-break mode (true or false).
addPageRegion($region)
Add a single no-write region on selected page.
AddLink()
Creates a new internal link and returns its identifier.
$keywords
Document keywords.
$cell_padding
Array of cell internal paddings ('T' => top, 'R' => right, 'B' => bottom, 'L' => left).
$extgstates
Array of transparency objects and parameters.
$dests
A dictionary of names and corresponding destinations (Dests key on document Catalog).
ScaleXY($s, $x='', $y='')
Vertical and horizontal proportional Scaling.
$original_rMargin
Original right margin value.
setDefaultTableColumns($cols=4)
Set the default number of columns in a row for HTML tables.
SetFillSpotColor($name, $tint=100)
Defines the spot color used for all filling operations (filled rectangles and cell backgrounds).
$form_enctype
Current form encryption type (used during XHTML rendering).
_putcatalog()
Output Catalog.
$hPt
Current height of page in points.
getCSSBorderWidth($width)
Returns the border width from CSS property.
startTransaction()
Stores a copy of the current TCPDF object used for undo operation.
endPage($tocpage=false)
Terminate the current page.
$creator
Document creator.
$w
Current width of page in user unit.
setBuffer($data)
Set buffer content (always append data).
$openMarkedContent
Boolean flag to indicate if marked-content sequence is open.
$header_title
Title to be printed on default page header.
setFooter()
This method is used to render the page footer.
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.
_getrawstream($s, $n=0)
get raw output stream.
getCSSBorderDashStyle($style)
Returns the border dash style from CSS property.
$intmrk
Array used to store positions inside the pages buffer (keys are the page numbers).
setRTL($enable, $resetx=true)
Enable or disable Right-To-Left language mode.
getColumn()
Return the current column number.
_datestring($n=0, $timestamp=0)
Returns a formatted date for meta information.
$premode
Boolean flag to indicate if we are inside a PRE tag.
Circle($x0, $y0, $r, $angstr=0, $angend=360, $style='', $line_style=array(), $fill_color=array(), $nc=2)
Draws a circle.
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...
startTemplate($w=0, $h=0, $group=false)
Start a new XObject Template.
getCSSBorderMargin($cssbspace, $width=0)
Get the border-spacing from CSS attribute.
getFooterMargin()
Returns footer margin in user units.
$FontDescent
Current font descent (distance between font bottom and baseline).
setImageSubBuffer($image, $key, $data)
Set image buffer content for a specified sub-key.
cropMark($x, $y, $w, $h, $type='T, R, B, L', $color=array(100, 100, 100, 100, 'All'))
Paints crop marks.
$header_line_color
Color for header line (RGB array).
_dooverline($x, $y, $txt)
Overline text.
GetStringWidth($s, $fontname='', $fontstyle='', $fontsize=0, $getarray=false)
Returns the length of a string in user unit.
setCellMargins($left='', $top='', $right='', $bottom='')
Set the internal Cell margins.
isUnicodeFont()
Return true if the current font is unicode type.
$tmprtl
Boolean flag used to force RTL or LTR string direction.
getBreakMargin($pagenum='')
Returns the page break margin.
setHeaderData($ln='', $lw=0, $ht='', $hs='', $tc=array(0, 0, 0), $lc=array(0, 0, 0))
Set header data.
setFooterMargin($fm=10)
Set footer margin.
$tcpdflink
If true print TCPDF meta link.
SetAbsY($y)
Set the absolute Y coordinate of the current pointer.
writeHTMLCell($w, $h, $x, $y, $html='', $border=0, $ln=0, $fill=false, $reseth=true, $align='', $autopadding=true)
setPageBoxTypes($boxes)
Set page boxes to be included on page descriptions.
SetFillColorArray($color, $ret=false)
Defines the color used for all filling operations (filled rectangles and cell backgrounds).
$columns
Array of column measures (width, space, starting Y position).
_objectkey($n)
Compute encryption key depending on object number where the encrypted data is stored.
setHtmlLinksStyle($color=array(0, 0, 255), $fontstyle='U')
Set the color and font style for HTML links.
_dounderline($x, $y, $txt)
Underline text.
drawHTMLTagBorder($tag, $xmax)
Draw an HTML block border and fill.
addHTMLVertSpace($hbz=0, $hb=0, $cell=false, $firsttag=false, $lasttag=false)
Add vertical spaces if needed.
Line($x1, $y1, $x2, $y2, $style=array())
Draws a line between two points.
$y
Current vertical position in user unit for cell positioning.
_dolinethrough($x, $y, $txt)
Line through text.
RadioButton($name, $w, $prop=array(), $opt=array(), $onvalue='On', $checked=false, $x='', $y='', $js=false)
Creates a RadioButton field.
setBookmark($txt, $level=0, $y=-1, $page='', $style='', $color=array(0, 0, 0), $x=-1, $link='')
Adds a bookmark - alias for Bookmark().
$ur
Array with additional document-wide usage rights for the document.
setColor($type, $col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='')
Defines the color used by the specified type ('draw', 'fill', 'text').
getPageHeight($pagenum='')
Returns the page height in units.
getFontSizePt()
Returns the current font size in points unit.
$last_enc_key
Last RC4 key encrypted (cached for optimisation).
SetX($x, $rtloff=false)
Defines the abscissa of the current position.
setPrintFooter($val=true)
Set a flag to print page footer.
$opencell
Boolean flag to indicate if the border of the cell sides that cross the page should be removed.
getAllSpotColors()
Returns the array of spot colors.
SetDrawColorArray($color, $ret=false)
Defines the color used for all drawing operations (lines, rectangles and cell borders).
registrationMarkCMYK($x, $y, $r)
Paints a CMYK registration mark.
commitTransaction()
Delete the copy of the current TCPDF object used for undo operation.
hyphenateText($text, $patterns, $dictionary=array(), $leftmin=1, $rightmin=2, $charmin=1, $charmax=8)
Returns text with soft hyphens.
Rect($x, $y, $w, $h, $style='', $border_style=array(), $fill_color=array())
Draws a rectangle.
$embeddedfiles
Array of files to embedd.
setCellHeightRatio($h)
Set the height of the cell (line height) respect the font height.
$original_lMargin
Original left margin value.
_outCurve($x1, $y1, $x2, $y2, $x3, $y3)
Append a cubic Bezier curve to the current path.
getFontSpacing()
Get the amount to increase or decrease the space between characters in a text.
$lispacer
Spacer string for LI tags.
CheckBox($name, $w, $checked=false, $prop=array(), $opt=array(), $onvalue='Yes', $x='', $y='', $js=false)
Creates a CheckBox field.
setPrintHeader($val=true)
Set a flag to print page header.
$listnum
HTML PARSER: current list nesting level.
setTimeStamp($tsa_host='', $tsa_username='', $tsa_password='', $tsa_cert='')
Enable document timestamping (requires the OpenSSL Library).
setSpacesRE($re='/[^\S\xa0]/')
Set regular expression to detect withespaces or word separators.
Button($name, $w, $h, $caption, $action, $prop=array(), $opt=array(), $x='', $y='', $js=false)
Creates a button field.
$print_header
Boolean flag to print/hide page header.
setDestination($name, $y=-1, $page='', $x=-1)
Add a Named Destination.
$svgdir
Directory used for the last SVG image.
setHeaderTemplateAutoreset($val=true)
Set a flag to automatically reset the xobject template used by Header() method at each page.
setExtraXMP($xmp)
Set additional XMP data to be added on the default XMP data just before the end of "x:xmpmeta" tag.
getNumPages()
Get the total number of insered pages.
$htmlvspace
Count the latest inserted vertical spaces on HTML.
replaceChar($oldchar, $newchar)
Replace a char if is defined on the current font.
Skew($angle_x, $angle_y, $x='', $y='')
Skew.
SetAuthor($author)
Defines the author of the document.
$fgcolor
Current foreground color.
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.
setPage($pnum, $resetmargins=false)
Move pointer at the specified document page and update page dimensions.
endLayer()
End the current PDF layer.
setPageRegions($regions=array())
Set no-write regions on page.
pixelsToUnits($px)
Converts pixels to User's Units.
$FontSizePt
Current font size in points.
$header_xobjid
ID of the stored default header template (-1 = not set).
PageNo()
Returns the current page number.
Annotation($x, $y, $w, $h, $text, $opt=array('Subtype'=> 'Text'), $spaces=0)
Puts a markup annotation on a rectangular area of the page.
$start_transaction_page
Store page number when startTransaction() is called.
$PageAnnots
Array of Annotations in pages.
_OEvalue()
Compute OE value (used for encryption)
$customlistindent
HTML PARSER: custom indent amount for lists.
_putannotsobjs()
Output annotations objects for all pages.
GetLineWidth()
Returns the current the line width.
_putheader()
Output PDF File Header (7.5.2).
setHeader()
This method is used to render the page header.
$compress
Compression flag.
checkPageBreak($h=0, $y='', $addpage=true)
Add page if needed.
$footerpos
Array used to store footer positions of each page.
$emptypagemrk
Array used to store page positions to track empty pages (keys are the page numbers).
$barcode
Barcode to print on page footer (only if set).
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,...
StartTransform()
Starts a 2D tranformation saving current graphic state.
setColorArray($type, $color, $ret=false)
Set the color array for the specified type ('draw', 'fill', 'text').
$check_page_regions
Boolean value true when page region check is active.
_encrypt_data($n, $s)
Encrypt the input string.
setTextRenderingMode($stroke=0, $fill=true, $clip=false)
Set Text rendering mode.
stringRightTrim($str, $replace='')
Right trim the input string.
AcceptPageBreak()
Whenever a page break condition is met, the method is called, and the break is issued or not dependin...
$strokecolor
Current stroke color.
$header_font
Default font used on page header.
$tocpage
Boolean flag true when we are on TOC (Table Of Content) page.
_outSaveGraphicsState()
Outputs the "save graphics state" operator 'q'.
setDocCreationTimestamp($time)
Set the document creation timestamp.
_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.
setPageFormat($format, $orientation='P')
Change the format of the current page.
getBarcode()
Get current barcode.
MirrorP($x='', $y='')
Point reflection mirroring.
$FontSize
Current font size in user unit.
_Uvalue()
Compute U value (used for encryption)
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.
SetDocInfoUnicode($unicode=true)
Turn on/off Unicode mode for document information dictionary (meta tags).
getPage()
Get current document page number.
$radio_groups
List of radio group objects IDs.
$starting_page_number
Starting page number.
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.
TranslateY($t_y)
Translate graphic object vertically.
setFontSpacing($spacing=0)
Set the amount to increase or decrease the space between characters in a text.
setFontBuffer($font, $data)
Set font buffer content.
$last_enc_key_c
Last RC4 computed key.
getTextShadow()
Return the text shadow parameters array.
$current_column
Current column number.
$pdfa_mode
If true set the document to PDF/A mode.
$default_form_prop
Deafult Javascript field properties.
_outRect($x, $y, $w, $h, $op)
Append a rectangle to the current path as a complete subpath, with lower-left corner (x,...
setPageUnit($unit)
Set the units of measure for the document.
swapMargins($reverse=true)
Swap the left and right margins.
RoundedRectXY($x, $y, $w, $h, $rx, $ry, $round_corner='1111', $style='', $border_style=array(), $fill_color=array())
Draws a rounded rectangle.
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.
getScaleFactor()
Returns the scale factor (number of points in user unit).
Polycurve($x0, $y0, $segments, $style='', $line_style=array(), $fill_color=array())
Draws a poly-Bezier curve.
$pdflayers
Array of PDF layers data.
$links
Array of internal links.
_outPoint($x, $y)
Begin a new subpath by moving the current point to coordinates (x, y), omitting any connecting line s...
setVisibility($v)
Set the visibility of the successive elements.
SetTextColor($col1=0, $col2=-1, $col3=-1, $col4=-1, $ret=false, $name='')
Defines the color used for text.
$bufferlen
Length of the buffer in bytes.
$form_obj_id
List of form annotations IDs.
SetMargins($left, $top, $right=-1, $keepmargins=false)
Defines the left, top and right margins.
$HREF
HTML PARSER: array to store current link and rendering styles.
$xobjects
Array of XObjects.
Ellipse($x0, $y0, $rx, $ry='', $angle=0, $astart=0, $afinish=360, $style='', $line_style=array(), $fill_color=array(), $nc=2)
Draws an ellipse.
Gradient($type, $coords, $stops, $background=array(), $antialias=false)
Output gradient.
$gradients
Array for storing gradient information.
$wPt
Current width of page in points.
$docinfounicode
If true set the document information dictionary in Unicode.
_putencryption()
Put encryption on PDF document.
$header_xobj_autoreset
If true reset the Header Xobject template at each page.
_puttruetypeunicode($font)
Adds unicode fonts.
SVGTransform($tm)
Apply SVG graphic transformation matrix.
Link($x, $y, $w, $h, $link, $spaces=0)
Puts a link on a rectangular area of the page.
$InHeader
Flag set when processing page header.
$transfmatrix
Array of transformation matrix.
setCellPaddings($left='', $top='', $right='', $bottom='')
Set the internal Cell paddings.
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).
getGroupPageNo()
Return the current page in the group.
SkewX($angle_x, $x='', $y='')
Skew horizontally.
$subject
Document subject.
$pages
Array containing pages.
setSVGStyles($svgstyle, $prevsvgstyle, $x=0, $y=0, $w=1, $h=1, $clip_function='', $clip_params=array())
Apply the requested SVG styles (*** TO BE COMPLETED ***)
replaceBuffer($data)
Replace the buffer content.
$img_rb_y
The right-bottom corner Y coordinate of last inserted image.
_putdests()
Insert Named Destinations.
getCharBBox($char)
Returns the glyph bounding box of the specified character in the current font in user units.
$pageobjects
Array of object IDs for each page.
stringTrim($str, $replace='')
Trim the input string.
$header_logo
Header image logo.
$CurOrientation
Current page orientation (P = Portrait, L = Landscape).
$xobjid
Current XObject ID.
_Ovalue()
Compute O value (used for encryption)
$numfonts
Counts the number of fonts.
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.
PieSector($xc, $yc, $r, $a, $b, $style='FD', $cw=true, $o=90)
Draw the sector of a circle.
$start_transaction_y
Store Y position when startTransaction() is called.
$booklet
Booklet mode for double-sided pages.
$radiobutton_groups
List of radio buttons parent objects.
$tsa_timestamp
Boolean flag to enable document timestamping with TSA.
$n_dests
Object ID for Named Destinations.
writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=false, $align='')
Allows to preserve some HTML formatting (limited support).
SetTitle($title)
Defines the title of the document.
_putshaders()
Output gradient shaders.
_out($s)
Output a string to the document.
setFontSubBuffer($font, $key, $data)
Set font buffer content.
getFontBuffer($font)
Get font buffer content.
$svg_tag_depth
Depth of the svg tag, to keep track if the svg tag is a subtag or the root tag.
_textstring($s, $n=0)
Format a text string for meta information.
$currpagegroup
Current page group number.
getHTMLFontUnits($val, $refsize=12, $parent_size=12, $defaultunit='pt')
Convert HTML string containing font size value to points.
_putxobjects()
Output Form XObjects Templates.
$signature_max_length
Digital signature max length.
getGroupPageNoFormatted()
Returns the current group page number formatted as a string.
getDocCreationTimestamp()
Returns document creation timestamp in seconds.
addJavascriptObject($script, $onload=false)
Adds a javascript object and return object ID.
GetNumChars($s)
Returns the numbero of characters in a string.
getPageRegions()
Return an array of no-write page regions.
getFormDefaultProp()
Return the default properties for form fields.
SetSubject($subject)
Defines the subject of the document.
$gdgammacache
Cache array for computed GD gamma values.
$viewer_preferences
PDF viewer preferences.
$fonts
Array of used fonts.
isRTLTextDir()
Return the current temporary RTL status.
getFontSize()
Returns the current font size.
getCSSPadding($csspadding, $width=0)
Get the internal Cell padding from CSS attribute.
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.
$k
Scale factor (number of points in user unit).
SetLink($link, $y=0, $page=-1)
Defines the page and position a link points to.
$img_rb_x
The right-bottom (or left-bottom for RTL) corner X coordinate of last inserted image.
$textstrokewidth
Text stroke width in doc units.
getFontAscent($font, $style='', $size=0)
Return the font ascent value.
getFontFamily()
Returns the current font family name.
$bMargin
Page break margin.
getFontSubsetting()
Return the default option for font subsetting.
getAliasRightShift()
Returns the string alias used right align page numbers.
setViewerPreferences($preferences)
Set the viewer preferences dictionary controlling the way the document is to be presented on the scre...
$cntmrk
Array used to store content positions inside the pages buffer (keys are the page numbers).
$font_subsetting
Boolean flag: if true enables font subsetting by default.
MirrorL($angle=0, $x='', $y='')
Reflection against a straight line through point (x, y) with the gradient angle (angle).
$svgstyles
Array of SVG properties.
$AutoPageBreak
Automatic page breaking.
$htmlLinkColorArray
Default color for html links.
convertSVGtMatrix($tm)
Convert SVG transformation matrix to PDF.
SetY($y, $resetx=true, $rtloff=false)
Moves the current abscissa back to the left margin and sets the ordinate.
$svgtextmode
SVG text properties.
_putEmbeddedFiles()
Embedd the attached files.
_datastring($s, $n=0)
Format a data string for meta information.
setDocModificationTimestamp($time)
Set the document modification timestamp.
addTOCPage($orientation='', $format='', $keepmargins=false)
Adds a new TOC (Table Of Content) page to the document.
$linestyleCap
PDF string for CAP value of the last line.
$footer_margin
Minimum distance between footer and bottom page margin.
setBarcode($bc='')
Set document barcode.
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(...
setFontStretching($perc=100)
Set the percentage of character stretching.
setPageOrientation($orientation, $autopagebreak='', $bottommargin='')
Set page orientation.
ScaleX($s_x, $x='', $y='')
Horizontal Scaling.
$h
Current height of page in user unit.
SetDisplayMode($zoom, $layout='SinglePage', $mode='UseNone')
Defines the way the document is to be displayed by the viewer.
Arrow($x0, $y0, $x1, $y1, $head_style=0, $arm_size=5, $arm_angle=15)
Draws a grahic arrow.
$rasterize_vector_images
Boolean flag: if true convert vector images (SVG, EPS) to raster image using GD or ImageMagick librar...
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.
$listordered
HTML PARSER: array of boolean values, true in case of ordered list (OL), false otherwise.
$TextColor
Commands for text color.
$textindent
Text indentation value (used for text-indent CSS attribute).
setHeaderMargin($hm=10)
Set header margin.
setExtGState($gs)
Add an extgstate.
resetColumns()
Remove columns and reset page margins.
fixHTMLCode($html, $default_css='', $tagvs='', $tidy_options='')
Cleanup HTML code (requires HTML Tidy library).
getAliasNumPage()
Returns the string alias used for the page number.
getCellPaddings()
Get the internal Cell padding array.
GetY()
Returns the ordinate of the current position.
Footer()
This method is used to render the page footer.
$bgcolor
Current background color.
$imgscale
Adjusting factor to convert pixels to user units.
$overline
Overlining flag.
unhtmlentities($text_to_convert)
Reverse function for htmlentities.
$bordermrk
Array used to store positions inside the pages buffer (keys are the page numbers).
$numpages
Counts the number of pages.
addTOC($page='', $numbersfont='', $filler='.', $toc_name='TOC', $style='', $color=array(0, 0, 0))
Output a Table of Content Index (TOC).
SetTextColorArray($color, $ret=false)
Defines the color used for text.
$maxselcol
Maximum page and column selected.
$thead
Table header content to be repeated on each new page.
getSignatureAppearanceArray($x=0, $y=0, $w=0, $h=0, $page=-1, $name='')
Get the array that defines the signature appearance (page and rectangle coordinates).
getFontsList()
Fill the list of available fonts ($this->fontlist).
$PageBreakTrigger
Threshold used to trigger page breaks.
_destroy($destroyall=false, $preserve_objcopy=false)
Unset all class variables except the following critical variables.
$state
Current document state.
SetDefaultMonospacedFont($font)
Defines the default monospaced font.
getMargins()
Returns an array containing current margins:
$num_columns
Number of colums.
setEqualColumns($numcols=0, $width=0, $y='')
Set multiple columns of the same size.
_beginpage($orientation='', $format='')
Initialize a new page.
getCellMargins()
Get the internal Cell margin array.
_generateencryptionkey()
Compute encryption key.
serializeTCPDFtagParameters($data)
Serialize an array of parameters to be used with TCPDF tag in HTML code.
$inxobj
Boolean value true when we are inside an XObject.
setHeaderFont($font)
Set header font.
SetAbsXY($x, $y)
Set the absolute X and Y coordinates of the current pointer.
Rotate($angle, $x='', $y='')
Rotate object.
applyTSA($signature)
NOT YET IMPLEMENTED Request TSA for a timestamp.
$re_space
Array of $re_spaces parts.
_putresourcedict()
Output Resources Dictionary.
getRTL()
Return the RTL status.
_endpage()
Mark end of page.
$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).
SetTextSpotColor($name, $tint=100)
Defines the spot color used for text.
setFooterFont($font)
Set footer font.
fitBlock($w, $h, $x, $y, $fitonpage=false)
Set the block dimensions accounting for page breaks and page/column fitting.
addHtmlLink($url, $name, $fill=false, $firstline=false, $color='', $style=-1, $firstblock=false)
Output anchor link.
_dolinethroughw($x, $y, $w)
Line through for rectangular text area.
getInternalPageNumberAliases($a='')
Return an array containing variations for the basic page number alias.
getHeaderMargin()
Returns header margin in user units.
$offsets
Array of object offsets.
Clip($x, $y, $w, $h)
Set a rectangular clipping area.
$doc_creation_timestamp
Document creation date-time.
setLIsymbol($symbol='!')
Set the default bullet to be used as LI bullet symbol.
replaceRightShiftPageNumAliases($page, $aliases, $diff)
Replace right shift page number aliases with spaces to correct right alignment.
getRawCharWidth($char)
Returns the length of the char in user unit for the current font.
$svggradients
Array of SVG gradients.
setImageScale($scale)
Set the adjusting factor to convert pixels to user units.
SetBooklet($booklet=true, $inner=-1, $outer=-1)
Set the booklet mode for double-sided pages.
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...
_outLine($x, $y)
Append a straight line segment from the current point to the point (x, y).
_outRestoreGraphicsState()
Outputs the "restore graphics state" operator 'Q'.
$x
Current horizontal position in user unit for cell positioning.
getPageGroupAlias()
Return the alias for the total number of pages in the current page group.
$fontlist
List of available fonts on filesystem.
$column_start_page
Starting page for columns.
setSpotColor($type, $name, $tint=100)
Set the spot color for the specified type ('draw', 'fill', 'text').
$cell_height_ratio
Default cell height ratio.
getAllInternalPageNumberAliases()
Return an array containing all internal page aliases.
SVGPath($d, $style='')
Draws an SVG path.
$numimages
Counts the number of pages.
$epsmarker
String used to mark the beginning and end of EPS image blocks.
$signature_data
Digital signature data.
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.
$newpagegroup
Array of page numbers were a new page group was started (the page numbers are the keys of the array).
SetKeywords($keywords)
Associates keywords with the document, generally in the form 'keyword1 keyword2 .....
_outCurveY($x1, $y1, $x3, $y3)
Append a cubic Bezier curve to the current path.
$LayoutMode
Layout display mode.
SetFont($family, $style='', $size=null, $fontfile='', $subset='default', $out=true)
Sets the font used to print character strings.
$header_margin
Minimum distance between header and top page margin.
write2DBarcode($code, $type, $x='', $y='', $w='', $h='', $style='', $align='', $distort=false)
Print 2D Barcode.
setSignatureAppearance($x=0, $y=0, $w=0, $h=0, $page=-1, $name='')
Set the digital signature appearance (a cliccable rectangle area to get signature properties)
$outlines
Outlines for bookmark.
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.
getLastH()
Get the last cell height.
getGDgamma($img, $c)
Get the GD-corrected PNG gamma value from alpha color.
$encrypted
IBoolean flag indicating whether document is protected.
if(!file_exists(getcwd().'/ilias.ini.php')) if(isset( $_GET["client_id"]))
registration confirmation script for ilias
if(@file_exists(dirname(__FILE__).'/lang/eng.php')) $preferences
echo;exit;}function LogoutNotification($SessionID) { global $ilDB; $q="SELECT session_id, data FROM usr_session WHERE expires > (\w+)\|/" PREG_SPLIT_NO_EMPTY PREG_SPLIT_DELIM_CAPTURE
if((!isset($_SERVER['DOCUMENT_ROOT'])) OR(empty($_SERVER['DOCUMENT_ROOT']))) $_SERVER['DOCUMENT_ROOT']
const K_TCPDF_THROW_EXCEPTION_ERROR
If true and PHP version is greater than 5, then the Error() method throw new exception instead of ter...
const PDF_FONT_NAME_MAIN
Default main font name.
const K_TCPDF_CALLS_IN_HTML
If true allows to call TCPDF methods using HTML syntax IMPORTANT: For security reason,...
const K_THAI_TOPCHARS
Set to true to enable the special procedure used to avoid the overlappind of symbols on Thai language...
const K_CELL_HEIGHT_RATIO
Height of cell respect font height.
const K_BLANK_IMAGE
Installation path (/var/www/tcpdf/).
const K_SMALL_RATIO
Reduction factor for small font.
const K_PATH_CACHE
Cache directory for temporary files (full path).
const K_PATH_IMAGES
Installation path (/var/www/tcpdf/).