N°7175 Update tecnickcom/tcpdf from 6.4.4 to 6.6.5

This commit is contained in:
Pierre Goiffon
2024-01-30 16:58:01 +01:00
parent 0e91c75dc2
commit 0a9c5250f8
108 changed files with 722 additions and 210 deletions

View File

@@ -1,13 +1,13 @@
<?php
//============================================================+
// File name : tcpdf.php
// Version : 6.4.4
// Version : 6.6.5
// Begin : 2002-08-03
// Last Update : 2021-12-31
// Last Update : 2023-09-06
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - info@tecnick.com
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
// -------------------------------------------------------------------
// Copyright (C) 2002-2021 Nicola Asuni - Tecnick.com LTD
// Copyright (C) 2002-2023 Nicola Asuni - Tecnick.com LTD
//
// This file is part of TCPDF software library.
//
@@ -104,7 +104,7 @@
* Tools to encode your unicode fonts are on fonts/utils directory.</p>
* @package com.tecnick.tcpdf
* @author Nicola Asuni
* @version 6.3.2
* @version 6.6.5
*/
// TCPDF configuration
@@ -128,7 +128,7 @@ require_once(dirname(__FILE__).'/include/tcpdf_static.php');
* TCPDF project (http://www.tcpdf.org) has been originally derived in 2002 from the Public Domain FPDF class by Olivier Plathey (http://www.fpdf.org), but now is almost entirely rewritten.<br>
* @package com.tecnick.tcpdf
* @brief PHP class for generating PDF documents without requiring external extensions.
* @version 6.3.2
* @version 6.6.5
* @author Nicola Asuni - info@tecnick.com
* @IgnoreAnnotation("protected")
* @IgnoreAnnotation("public")
@@ -574,12 +574,14 @@ class TCPDF {
/**
* Minimum distance between header and top page margin.
* @protected
* @var float
*/
protected $header_margin;
/**
* Minimum distance between footer and bottom page margin.
* @protected
* @var float
*/
protected $footer_margin;
@@ -2024,9 +2026,6 @@ class TCPDF {
$this->header_xobj_autoreset = false;
$this->custom_xmp = '';
$this->custom_xmp_rdf = '';
// Call cleanup method after script execution finishes or exit() is called.
// NOTE: This will not be executed if the process is killed with a SIGTERM or SIGKILL signal.
register_shutdown_function(array($this, '_destroy'), true);
}
/**
@@ -2464,7 +2463,7 @@ class TCPDF {
*/
public function getCellHeight($fontsize, $padding=TRUE) {
$height = ($fontsize * $this->cell_height_ratio);
if ($padding) {
if ($padding && !empty($this->cell_padding)) {
$height += ($this->cell_padding['T'] + $this->cell_padding['B']);
}
return round($height, 6);
@@ -2530,7 +2529,7 @@ class TCPDF {
/**
* Returns the page width in units.
* @param int|null $pagenum page number (empty = current page)
* @return int page width.
* @return int|float page width.
* @author Nicola Asuni
* @public
* @since 1.5.2
@@ -2546,7 +2545,7 @@ class TCPDF {
/**
* Returns the page height in units.
* @param int|null $pagenum page number (empty = current page)
* @return int page height.
* @return int|float page height.
* @author Nicola Asuni
* @public
* @since 1.5.2
@@ -2562,7 +2561,7 @@ class TCPDF {
/**
* Returns the page break margin.
* @param int|null $pagenum page number (empty = current page)
* @return int page break margin.
* @return int|float page break margin.
* @author Nicola Asuni
* @public
* @since 1.5.2
@@ -2588,9 +2587,9 @@ class TCPDF {
/**
* Defines the left, top and right margins.
* @param float $left Left margin.
* @param float $top Top margin.
* @param float $right Right margin. Default value is the left one.
* @param int|float $left Left margin.
* @param int|float $top Top margin.
* @param int|float|null $right Right margin. Default value is the left one.
* @param boolean $keepmargins if true overwrites the default page margins
* @public
* @since 1.0
@@ -2613,7 +2612,7 @@ class TCPDF {
/**
* Defines the left margin. The method can be called before creating the first page. If the current abscissa gets out of page, it is brought back to the margin.
* @param float $margin The margin.
* @param int|float $margin The margin.
* @public
* @since 1.4
* @see SetTopMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins()
@@ -2628,7 +2627,7 @@ class TCPDF {
/**
* Defines the top margin. The method can be called before creating the first page.
* @param float $margin The margin.
* @param int|float $margin The margin.
* @public
* @since 1.5
* @see SetLeftMargin(), SetRightMargin(), SetAutoPageBreak(), SetMargins()
@@ -2643,7 +2642,7 @@ class TCPDF {
/**
* Defines the right margin. The method can be called before creating the first page.
* @param float $margin The margin.
* @param int|float $margin The margin.
* @public
* @since 1.5
* @see SetLeftMargin(), SetTopMargin(), SetAutoPageBreak(), SetMargins()
@@ -2657,7 +2656,7 @@ class TCPDF {
/**
* Set the same internal Cell padding for top, right, bottom, left-
* @param float $pad internal padding.
* @param int|float $pad internal padding.
* @public
* @since 2.1.000 (2008-01-09)
* @see getCellPaddings(), setCellPaddings()
@@ -2673,10 +2672,10 @@ class TCPDF {
/**
* Set the internal Cell paddings.
* @param float|null $left left padding
* @param float|null $top top padding
* @param float|null $right right padding
* @param float|null $bottom bottom padding
* @param int|float|null $left left padding
* @param int|float|null $top top padding
* @param int|float|null $right right padding
* @param int|float|null $bottom bottom padding
* @public
* @since 5.9.000 (2010-10-03)
* @see getCellPaddings(), SetCellPadding()
@@ -2709,10 +2708,10 @@ class TCPDF {
/**
* Set the internal Cell margins.
* @param float|null $left left margin
* @param float|null $top top margin
* @param float|null $right right margin
* @param float|null $bottom bottom margin
* @param int|float|null $left left margin
* @param int|float|null $top top margin
* @param int|float|null $right right margin
* @param int|float|null $bottom bottom margin
* @public
* @since 5.9.000 (2010-10-03)
* @see getCellMargins()
@@ -2745,7 +2744,7 @@ class TCPDF {
/**
* Adjust the internal Cell padding array to take account of the line width.
* @param string|array|int $brd Indicates if borders must be drawn around the cell. The value can be a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul> or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
* @param string|array|int|bool $brd Indicates if borders must be drawn around the cell. The value can be a number:<ul><li>0: no border (default)</li><li>1: frame</li></ul> or a string containing some or all of the following characters (in any order):<ul><li>L: left</li><li>T: top</li><li>R: right</li><li>B: bottom</li></ul> or an array of line styles for each border group - for example: array('LTRB' => array('width' => 2, 'cap' => 'butt', 'join' => 'miter', 'dash' => 0, 'color' => array(0, 0, 0)))
* @return void|array array of adjustments
* @public
* @since 5.9.000 (2010-10-03)
@@ -3375,7 +3374,7 @@ class TCPDF {
/**
* Set header margin.
* (minimum distance between header and top page margin)
* @param int $hm distance in user units
* @param float $hm distance in user units
* @public
*/
public function setHeaderMargin($hm=10) {
@@ -3395,7 +3394,7 @@ class TCPDF {
/**
* Set footer margin.
* (minimum distance between footer and bottom page margin)
* @param int $fm distance in user units
* @param float $fm distance in user units
* @public
*/
public function setFooterMargin($fm=10) {
@@ -4105,6 +4104,7 @@ class TCPDF {
* @param float $fontsize Font size in points. The default value is the current size.
* @param boolean $getarray if true returns an array of characters widths, if false returns the total length.
* @return float[]|float total string length or array of characted widths
* @phpstan-return ($getarray is true ? float[] : float) total string length or array of characted widths
* @author Nicola Asuni
* @public
* @since 1.2
@@ -4121,6 +4121,7 @@ class TCPDF {
* @param float $fontsize Font size in points. The default value is the current size.
* @param boolean $getarray if true returns an array of characters widths, if false returns the total length.
* @return float[]|float total string length or array of characted widths
* @phpstan-return ($getarray is true ? float[] : float) total string length or array of characted widths
* @author Nicola Asuni
* @public
* @since 2.4.000 (2008-03-06)
@@ -4283,7 +4284,7 @@ class TCPDF {
// all fonts must be embedded
$family = 'pdfa'.$family;
}
$tempstyle = strtoupper($style);
$tempstyle = strtoupper($style === null ? '' : $style);
$style = '';
// underline
if (strpos($tempstyle, 'U') !== false) {
@@ -4350,6 +4351,22 @@ class TCPDF {
}
// include font file
if (!TCPDF_STATIC::empty_string($fontfile) AND (@TCPDF_STATIC::file_exists($fontfile))) {
$type=null;
$name=null;
$desc=null;
$up=-null;
$ut=null;
$cw=null;
$cbbox=null;
$dw=null;
$enc=null;
$cidinfo=null;
$file=null;
$ctg=null;
$diff=null;
$originalsize=null;
$size1=null;
$size2=null;
include($fontfile);
} else {
$this->Error('Could not include font definition file: '.$family.'');
@@ -5151,6 +5168,7 @@ class TCPDF {
*/
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') {
// replace 'NO-BREAK SPACE' (U+00A0) character with a simple space
$txt = is_null($txt) ? '' : $txt;
$txt = str_replace(TCPDF_FONTS::unichr(160, $this->isunicode), ' ', $txt);
$prev_cell_margin = $this->cell_margin;
$prev_cell_padding = $this->cell_padding;
@@ -5526,12 +5544,12 @@ class TCPDF {
$xdk = $xdx * $k;
// print text
$s .= sprintf('BT %F %F Td [(%s)] TJ ET', $xdk, (($this->h - $basefonty) * $k), $txt2);
if (isset($uniblock)) {
if (isset($uniblock)) { // @phpstan-ignore-line
// print overlapping characters as separate string
$xshift = 0; // horizontal shift
$ty = (($this->h - $basefonty + (0.2 * $this->FontSize)) * $k);
$spw = (($w - $txwidth - $this->cell_padding['L'] - $this->cell_padding['R']) / ($ns?$ns:1));
foreach ($uniblock as $uk => $uniarr) {
foreach ($uniblock as $uk => $uniarr) { // @phpstan-ignore-line
if (($uk % 2) == 0) {
// x space to skip
if ($spacewidth != 0) {
@@ -6395,7 +6413,7 @@ class TCPDF {
// calculate maximum width for a single character on string
$chrw = $this->GetArrStringWidth($chars, '', '', 0, true);
array_walk($chrw, array($this, 'getRawCharWidth'));
$maxchwidth = max($chrw);
$maxchwidth = ((is_array($chrw) || $chrw instanceof Countable) && count($chrw) > 0) ? max($chrw) : 0;
// get array of chars
$uchars = TCPDF_FONTS::UTF8ArrayToUniArray($chars, $this->isunicode);
// get the number of characters
@@ -6495,14 +6513,16 @@ class TCPDF {
$shy = false;
// account for margin changes
if ((($this->y + $this->lasth) > $this->PageBreakTrigger) AND ($this->inPageBody())) {
$this->AcceptPageBreak();
if ($this->rtl) {
$this->x -= $margin['R'];
} else {
$this->x += $margin['L'];
if ($this->AcceptPageBreak())
{
if ($this->rtl) {
$this->x -= $margin['R'];
} else {
$this->x += $margin['L'];
}
$this->lMargin += $margin['L'];
$this->rMargin += $margin['R'];
}
$this->lMargin += $margin['L'];
$this->rMargin += $margin['R'];
}
$w = $this->getRemainingWidth();
$wmax = ($w - $this->cell_padding['L'] - $this->cell_padding['R']);
@@ -6700,14 +6720,16 @@ class TCPDF {
}
// account for margin changes
if ((($this->y + $this->lasth) > $this->PageBreakTrigger) AND ($this->inPageBody())) {
$this->AcceptPageBreak();
if ($this->rtl) {
$this->x -= $margin['R'];
} else {
$this->x += $margin['L'];
if ($this->AcceptPageBreak())
{
if ($this->rtl) {
$this->x -= $margin['R'];
} else {
$this->x += $margin['L'];
}
$this->lMargin += $margin['L'];
$this->rMargin += $margin['R'];
}
$this->lMargin += $margin['L'];
$this->rMargin += $margin['R'];
}
$w = $this->getRemainingWidth();
$wmax = $w - $this->cell_padding['L'] - $this->cell_padding['R'];
@@ -6854,6 +6876,8 @@ class TCPDF {
}
// resize the block to be contained on the remaining available page or column space
if ($fitonpage) {
// fallback to avoid division by zero
$h = $h == 0 ? 1 : $h;
$ratio_wh = ($w / $h);
if (($y + $h) > $this->PageBreakTrigger) {
$h = $this->PageBreakTrigger - $y;
@@ -7099,8 +7123,6 @@ class TCPDF {
} elseif ($type == 'jpg') {
$type = 'jpeg';
}
$mqr = TCPDF_STATIC::get_mqr();
TCPDF_STATIC::set_mqr(false);
// Specific image handlers (defined on TCPDF_IMAGES CLASS)
$mtd = '_parse'.$type;
// GD image handler function
@@ -7202,7 +7224,6 @@ class TCPDF {
// unable to process image
return false;
}
TCPDF_STATIC::set_mqr($mqr);
if ($ismask) {
// force grayscale
$info['cs'] = 'DeviceGray';
@@ -7230,7 +7251,7 @@ class TCPDF {
} elseif ($palign == 'R') {
$ximg = $this->w - $this->rMargin - $w;
} else {
$ximg = $x;
$ximg = $this->rtl ? $x - $w : $x;
}
if ($ismask OR $hidden) {
@@ -7614,7 +7635,7 @@ class TCPDF {
* Send the document to a given destination: string, local file or browser.
* In the last case, the plug-in may be used (if present) or a download ("Save as" dialog box) may be forced.<br />
* The method first calls Close() if necessary to terminate the document.
* @param string $name The name of the file when saved. Note that special characters are removed and blanks characters are replaced with the underscore character.
* @param string $name The name of the file when saved
* @param string $dest Destination where to send the document. It can take one of the following values:<ul><li>I: send the file inline to the browser (default). The plug-in is used if available. The name given by name is used when one selects the "Save as" option on the link generating the PDF.</li><li>D: send to the browser and force a file download with the name given by name.</li><li>F: save to a local server file with the name given by name.</li><li>S: return the document as a string (name is ignored).</li><li>FI: equivalent to F + I option</li><li>FD: equivalent to F + D option</li><li>E: return the document as base64 mime multi-part email attachment (RFC 2045)</li></ul>
* @return string
* @public
@@ -7632,10 +7653,7 @@ class TCPDF {
$dest = $dest ? 'D' : 'F';
}
$dest = strtoupper($dest);
if ($dest[0] != 'F') {
$name = preg_replace('/[\s]+/', '_', $name);
$name = preg_replace('/[^a-zA-Z0-9_\.-]/', '', $name);
}
if ($this->sign) {
// *** apply digital signature to the document ***
// get the document content
@@ -7706,7 +7724,8 @@ class TCPDF {
header('Pragma: public');
header('Expires: Sat, 26 Jul 1997 05:00:00 GMT'); // Date in the past
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
header('Content-Disposition: inline; filename="'.basename($name).'"');
header('Content-Disposition: inline; filename="' . rawurlencode(basename($name)) . '"; ' .
'filename*=UTF-8\'\'' . rawurlencode(basename($name)));
TCPDF_STATIC::sendOutputData($this->getBuffer(), $this->bufferlen);
} else {
echo $this->getBuffer();
@@ -7737,7 +7756,8 @@ class TCPDF {
header('Content-Type: application/pdf');
}
// use the Content-Disposition header to supply a recommended filename
header('Content-Disposition: attachment; filename="'.basename($name).'"');
header('Content-Disposition: attachment; filename="' . rawurlencode(basename($name)) . '"; ' .
'filename*=UTF-8\'\'' . rawurlencode(basename($name)));
header('Content-Transfer-Encoding: binary');
TCPDF_STATIC::sendOutputData($this->getBuffer(), $this->bufferlen);
break;
@@ -8429,7 +8449,7 @@ class TCPDF {
$annots .= ' /Name /Note';
}
$hasStateModel = isset($pl['opt']['statemodel']);
$hasState = isset($pl['opt']['state']);
$hasState = isset($pl['opt']['state']);
$statemodels = array('Marked', 'Review');
if (!$hasStateModel && !$hasState) {
break;
@@ -8867,8 +8887,6 @@ class TCPDF {
$this->_newobj();
$this->_out('<< /Type /Encoding /BaseEncoding /WinAnsiEncoding /Differences ['.$diff.'] >>'."\n".'endobj');
}
$mqr = TCPDF_STATIC::get_mqr();
TCPDF_STATIC::set_mqr(false);
foreach ($this->FontFiles as $file => $info) {
// search and get font file to embedd
$fontfile = TCPDF_FONTS::getFontFullPath($file, $info['fontdir']);
@@ -8922,7 +8940,6 @@ class TCPDF {
$this->_out($out);
}
}
TCPDF_STATIC::set_mqr($mqr);
foreach ($this->fontkeys as $k) {
//Font objects
$font = $this->getFontBuffer($k);
@@ -9191,6 +9208,7 @@ class TCPDF {
foreach ($this->imagekeys as $file) {
$info = $this->getImageBuffer($file);
// set object for alternate images array
$altoid = null;
if ((!$this->pdfa_mode) AND isset($info['altimgs']) AND !empty($info['altimgs'])) {
$altoid = $this->_newobj();
$out = '[';
@@ -9238,7 +9256,7 @@ class TCPDF {
$out .= ' /Decode [1 0 1 0 1 0 1 0]';
}
$out .= ' /BitsPerComponent '.$info['bpc'];
if (isset($altoid) AND ($altoid > 0)) {
if ($altoid > 0) {
// reference to alternate images dictionary
$out .= ' /Alternates '.$altoid.' 0 R';
}
@@ -9913,7 +9931,7 @@ class TCPDF {
}
$out .= ' >> >>';
}
$font = $this->getFontBuffer('helvetica');
$font = $this->getFontBuffer((($this->pdfa_mode) ? 'pdfa' : '') .'helvetica');
$out .= ' /DA (/F'.$font['i'].' 0 Tf 0 g)';
$out .= ' /Q '.(($this->rtl)?'2':'0');
//$out .= ' /XFA ';
@@ -11698,7 +11716,7 @@ class TCPDF {
if ($this->state != 2) {
return;
}
if (!(false === strpos($style, 'F')) AND isset($fill_color)) {
if (!(false === strpos($style, 'F')) AND is_array($fill_color)) {
$this->setFillColorArray($fill_color);
}
$op = TCPDF_STATIC::getPathPaintOperator($style);
@@ -11728,7 +11746,7 @@ class TCPDF {
if ($this->state != 2) {
return;
}
if (!(false === strpos($style, 'F')) AND isset($fill_color)) {
if (!(false === strpos($style, 'F')) AND is_array($fill_color)) {
$this->setFillColorArray($fill_color);
}
$op = TCPDF_STATIC::getPathPaintOperator($style);
@@ -11771,7 +11789,7 @@ class TCPDF {
if (TCPDF_STATIC::empty_string($ry) OR ($ry == 0)) {
$ry = $rx;
}
if (!(false === strpos($style, 'F')) AND isset($fill_color)) {
if (!(false === strpos($style, 'F')) AND is_array($fill_color)) {
$this->setFillColorArray($fill_color);
}
$op = TCPDF_STATIC::getPathPaintOperator($style);
@@ -11990,7 +12008,7 @@ class TCPDF {
}
$nc += 4;
}
if (!(false === strpos($style, 'F')) AND isset($fill_color)) {
if (!(false === strpos($style, 'F')) AND is_array($fill_color)) {
$this->setFillColorArray($fill_color);
}
$op = TCPDF_STATIC::getPathPaintOperator($style);
@@ -12193,7 +12211,7 @@ class TCPDF {
return;
}
// Rounded
if (!(false === strpos($style, 'F')) AND isset($fill_color)) {
if (!(false === strpos($style, 'F')) AND is_array($fill_color)) {
$this->setFillColorArray($fill_color);
}
$op = TCPDF_STATIC::getPathPaintOperator($style);
@@ -15072,9 +15090,7 @@ class TCPDF {
// translate
$this->_out(sprintf('%F %F %F %F %F %F cm', 1, 0, 0, 1, $dx, $dy + ($this->hPt - (2 * $y * $k) - ($y2 - $y1))));
// scale
if (isset($scale_x)) {
$this->_out(sprintf('%F %F %F %F %F %F cm', $scale_x, 0, 0, $scale_y, $x1 * (1 - $scale_x), $y2 * (1 - $scale_y)));
}
$this->_out(sprintf('%F %F %F %F %F %F cm', $scale_x, 0, 0, $scale_y, $x1 * (1 - $scale_x), $y2 * (1 - $scale_y)));
// handle pc/unix/mac line endings
$lines = preg_split('/[\r\n]+/si', $data, -1, PREG_SPLIT_NO_EMPTY);
$u=0;
@@ -16017,14 +16033,14 @@ class TCPDF {
*/
protected function getCSSBorderStyle($cssborder) {
$bprop = preg_split('/[\s]+/', trim($cssborder));
$count = count($bprop);
if ($count > 0 && $bprop[$count - 1] === '!important') {
unset($bprop[$count - 1]);
--$count;
}
$border = array(); // value to be returned
switch (count($bprop)) {
case 3: {
$width = $bprop[0];
$style = $bprop[1];
$color = $bprop[2];
break;
}
switch ($count) {
case 2: {
$width = 'medium';
$style = $bprop[0];
@@ -16037,12 +16053,18 @@ class TCPDF {
$color = 'black';
break;
}
default: {
case 0: {
$width = 'medium';
$style = 'solid';
$color = 'black';
break;
}
default: {
$width = $bprop[0];
$style = $bprop[1];
$color = $bprop[2];
break;
}
}
if ($style == 'none') {
return array();
@@ -16352,6 +16374,7 @@ class TCPDF {
break;
}
default: {
$parentSize = $this->getHTMLUnitToUnits($parent_size, $refsize, $defaultunit, true);
$size = $this->getHTMLUnitToUnits($val, $parent_size, $defaultunit, true);
}
}
@@ -17359,6 +17382,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
++$key;
}
}
if ($key == $maxel) break;
if ($dom[$key]['tag'] AND isset($dom[$key]['attribute']['pagebreak'])) {
// check for pagebreak
if (($dom[$key]['attribute']['pagebreak'] == 'true') OR ($dom[$key]['attribute']['pagebreak'] == 'left') OR ($dom[$key]['attribute']['pagebreak'] == 'right')) {
@@ -17732,7 +17756,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$pend = '';
}
}
if ((isset($plalign) AND ((($plalign == 'C') OR ($plalign == 'J') OR (($plalign == 'R') AND (!$this->rtl)) OR (($plalign == 'L') AND ($this->rtl)))))) {
if ((((($plalign == 'C') OR ($plalign == 'J') OR (($plalign == 'R') AND (!$this->rtl)) OR (($plalign == 'L') AND ($this->rtl)))))) {
// calculate shifting amount
$tw = $w;
if (($plalign == 'J') AND $this->isRTLTextDir() AND ($this->num_columns > 1)) {
@@ -18338,7 +18362,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$dom[$trid]['cellpos'][($cellid - 1)]['bgcolor'] = $dom[$parentid]['bgcolor'];
}
// store border info
if (isset($tdborder) AND !empty($tdborder)) {
if (!empty($tdborder)) {
$dom[$trid]['cellpos'][($cellid - 1)]['border'] = $tdborder;
}
$prevLastH = $this->lasth;
@@ -18574,7 +18598,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$strrest = $this->Write($this->lasth, $dom[$key]['value'], '', $wfill, '', false, 0, true, $firstblock, 0, $wadj);
// restore default direction
if ($reverse_dir AND ($wadj == 0)) {
$this->x = $xws;
$this->x = $xws; // @phpstan-ignore-line
$this->rtl = !$this->rtl;
$reverse_dir = false;
}
@@ -18683,7 +18707,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$pend = '';
}
}
if ((isset($plalign) AND ((($plalign == 'C') OR (($plalign == 'R') AND (!$this->rtl)) OR (($plalign == 'L') AND ($this->rtl)))))) {
if ((((($plalign == 'C') OR (($plalign == 'R') AND (!$this->rtl)) OR (($plalign == 'L') AND ($this->rtl)))))) {
// calculate shifting amount
$tw = $w;
if ($this->lMargin != $prevlMargin) {
@@ -18990,6 +19014,9 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
// data stream
$imgsrc = '@'.base64_decode(substr($imgsrc, 1));
$type = '';
} else if (preg_match('@^data:image/([^;]*);base64,(.*)@', $imgsrc, $reg)) {
$imgsrc = '@'.base64_decode($reg[2]);
$type = $reg[1];
} elseif ( $this->allowLocalFiles && substr($imgsrc, 0, 7) === 'file://') {
// get image type from a local file path
$imgsrc = substr($imgsrc, 7);
@@ -19703,7 +19730,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
$table_el = $dom[($dom[$key]['parent'])];
}
// for each row
if (count($table_el['trids']) > 0) {
if (!empty($table_el['trids'])) {
unset($xmax);
}
foreach ($table_el['trids'] as $j => $trkey) {
@@ -22034,7 +22061,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
public function setTextRenderingMode($stroke=0, $fill=true, $clip=false) {
// Ref.: PDF 32000-1:2008 - 9.3.6 Text Rendering Mode
// convert text rendering parameters
if ($stroke < 0) {
if ($stroke < 0 || !is_numeric($stroke)) {
$stroke = 0;
}
if ($fill === true) {
@@ -23883,9 +23910,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value:
}
$firstcmd = false;
} // end foreach
if (!empty($op)) {
$this->_out($op);
}
$this->_out($op);
return array($xmin, $ymin, ($xmax - $xmin), ($ymax - $ymin));
}