|
1 | 1 | <?php |
2 | 2 | //============================================================+ |
3 | 3 | // File name : tcpdf.php |
4 | | -// Version : 6.10.0 |
| 4 | +// Version : 6.10.1 |
5 | 5 | // Begin : 2002-08-03 |
6 | | -// Last Update : 2025-05-27 |
| 6 | +// Last Update : 2025-11-21 |
7 | 7 | // Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected] |
8 | 8 | // License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) |
9 | 9 | // ------------------------------------------------------------------- |
|
104 | 104 | * Tools to encode your unicode fonts are on fonts/utils directory.</p> |
105 | 105 | * @package com.tecnick.tcpdf |
106 | 106 | * @author Nicola Asuni |
107 | | - * @version 6.10.0 |
| 107 | + * @version 6.10.1 |
108 | 108 | */ |
109 | 109 |
|
110 | 110 | // TCPDF configuration |
|
128 | 128 | * 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> |
129 | 129 | * @package com.tecnick.tcpdf |
130 | 130 | * @brief PHP class for generating PDF documents without requiring external extensions. |
131 | | - * @version 6.10.0 |
| 131 | + * @version 6.10.1 |
132 | 132 | * @author Nicola Asuni - [email protected] |
133 | 133 | * @IgnoreAnnotation("protected") |
134 | 134 | * @IgnoreAnnotation("public") |
@@ -2910,9 +2910,7 @@ public function setCompression($compress=true) { |
2910 | 2910 | $this->compress = false; |
2911 | 2911 | if (function_exists('gzcompress')) { |
2912 | 2912 | if ($compress) { |
2913 | | - if ( !$this->pdfa_mode) { |
2914 | | - $this->compress = true; |
2915 | | - } |
| 2913 | + $this->compress = true; |
2916 | 2914 | } |
2917 | 2915 | } |
2918 | 2916 | } |
@@ -5001,11 +4999,10 @@ protected function _putEmbeddedFiles() { |
5001 | 4999 | $filter = ''; |
5002 | 5000 | if ($this->compress) { |
5003 | 5001 | $data = gzcompress($data); |
5004 | | - $filter = ' /Filter /FlateDecode'; |
| 5002 | + $filter .= ' /Filter /FlateDecode'; |
5005 | 5003 | } |
5006 | | - |
5007 | 5004 | if ($this->pdfa_version == 3) { |
5008 | | - $filter = ' /Subtype /text#2Fxml'; |
| 5005 | + $filter .= ' /Subtype /text#2Fxml'; |
5009 | 5006 | } |
5010 | 5007 |
|
5011 | 5008 | $stream = $this->_getrawstream($data, $filedata['n']); |
@@ -6925,8 +6922,8 @@ protected function fitBlock($w, $h, $x, $y, $fitonpage=false) { |
6925 | 6922 | // fallback to avoid division by zero |
6926 | 6923 | $h = $h == 0 ? 1 : $h; |
6927 | 6924 | $ratio_wh = ($w / $h); |
6928 | | - if (($y + $h) > $this->PageBreakTrigger) { |
6929 | | - $h = $this->PageBreakTrigger - $y; |
| 6925 | + if (($y + $h) > $this->PageBreakTrigger + $this->bMargin) { |
| 6926 | + $h = $this->PageBreakTrigger + $this->bMargin - $y; |
6930 | 6927 | $w = ($h * $ratio_wh); |
6931 | 6928 | } |
6932 | 6929 | if ((!$this->rtl) AND (($x + $w) > ($this->w - $this->rMargin))) { |
@@ -16918,7 +16915,7 @@ protected function getHtmlDomArray($html) { |
16918 | 16915 | $dom[$key]['height'] = $dom[$key]['style']['height']; |
16919 | 16916 | } |
16920 | 16917 | // check for text alignment |
16921 | | - if (isset($dom[$key]['style']['text-align'])) { |
| 16918 | + if (isset($dom[$key]['style']['text-align'][0])) { |
16922 | 16919 | $dom[$key]['align'] = strtoupper($dom[$key]['style']['text-align'][0]); |
16923 | 16920 | } |
16924 | 16921 | // check for CSS border properties |
@@ -23268,8 +23265,11 @@ public function ImageSVG($file, $x=null, $y=null, $w=0, $h=0, $link='', $align=' |
23268 | 23265 | $error_message = sprintf('SVG Error: %s at line %d', xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser)); |
23269 | 23266 | $this->Error($error_message); |
23270 | 23267 | } |
23271 | | - // free this XML parser |
23272 | | - xml_parser_free($parser); |
| 23268 | + |
| 23269 | + // free this XML parser (does nothing in PHP >= 8.0) |
| 23270 | + if (function_exists('xml_parser_free') && PHP_VERSION_ID < 80000) { |
| 23271 | + xml_parser_free($parser); |
| 23272 | + } |
23273 | 23273 |
|
23274 | 23274 | // >= PHP 7.0.0 "explicitly unset the reference to parser to avoid memory leaks" |
23275 | 23275 | unset($parser); |
@@ -23500,7 +23500,8 @@ protected function setSVGStyles($svgstyle, $prevsvgstyle, $x=0, $y=0, $w=1, $h=1 |
23500 | 23500 | $gradient['coords'][4] /= $w; |
23501 | 23501 | } elseif ($gradient['mode'] == 'percentage') { |
23502 | 23502 | foreach($gradient['coords'] as $key => $val) { |
23503 | | - $gradient['coords'][$key] = (intval($val) / 100); |
| 23503 | + $val = floatval($val) / 100; |
| 23504 | + $gradient['coords'][$key] = $val; |
23504 | 23505 | if ($val < 0) { |
23505 | 23506 | $gradient['coords'][$key] = 0; |
23506 | 23507 | } elseif ($val > 1) { |
@@ -24737,7 +24738,7 @@ protected function startSVGElementHandler($parser, $name, $attribs, $ctm=array() |
24737 | 24738 | */ |
24738 | 24739 | protected function endSVGElementHandler($parser, $name) { |
24739 | 24740 | $name = $this->removeTagNamespace($name); |
24740 | | - if ($this->svgdefsmode AND !in_array($name, array('defs', 'clipPath', 'linearGradient', 'radialGradient', 'stop'))) {; |
| 24741 | + if ($this->svgdefsmode AND !in_array($name, array('defs', 'clipPath', 'linearGradient', 'radialGradient', 'stop'))) { |
24741 | 24742 | if (end($this->svgdefs) !== FALSE) { |
24742 | 24743 | $last_svgdefs_id = key($this->svgdefs); |
24743 | 24744 | if (isset($this->svgdefs[$last_svgdefs_id]['attribs']['child_elements'])) { |
|
0 commit comments