From b55960021968f8c68556a7fedf9ea0bc263499bc Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Tue, 15 Dec 2020 16:51:44 +0000 Subject: [PATCH] MDL-70294 libraries: upgrade to version 6.3.5 of TCPDF. --- lib/tcpdf/README.md | 2 +- lib/tcpdf/composer.json | 4 +- lib/tcpdf/include/tcpdf_static.php | 28 +++++++++++-- lib/tcpdf/tcpdf.php | 63 +++++++++++++++++------------- 4 files changed, 63 insertions(+), 34 deletions(-) diff --git a/lib/tcpdf/README.md b/lib/tcpdf/README.md index 734b9879faa..db0149f69cb 100644 --- a/lib/tcpdf/README.md +++ b/lib/tcpdf/README.md @@ -6,7 +6,7 @@ * **category** Library * **author** Nicola Asuni -* **copyright** 2002-2019 Nicola Asuni - Tecnick.com LTD +* **copyright** 2002-2020 Nicola Asuni - Tecnick.com LTD * **license** http://www.gnu.org/copyleft/lesser.html GNU-LGPL v3 (see LICENSE.TXT) * **link** http://www.tcpdf.org * **source** https://github.com/tecnickcom/TCPDF diff --git a/lib/tcpdf/composer.json b/lib/tcpdf/composer.json index c16c7428cca..2299c976477 100644 --- a/lib/tcpdf/composer.json +++ b/lib/tcpdf/composer.json @@ -1,6 +1,6 @@ { "name": "tecnickcom/tcpdf", - "version": "6.3.2", + "version": "6.3.5", "homepage": "http://www.tcpdf.org/", "type": "library", "description": "TCPDF is a PHP class for generating PDF documents and barcodes.", @@ -13,7 +13,7 @@ "pdf417", "barcodes" ], - "license": "LGPL-3.0", + "license": "LGPL-3.0-only", "authors": [ { "name": "Nicola Asuni", diff --git a/lib/tcpdf/include/tcpdf_static.php b/lib/tcpdf/include/tcpdf_static.php index 7d2c1f54a3d..0139dbe9bea 100644 --- a/lib/tcpdf/include/tcpdf_static.php +++ b/lib/tcpdf/include/tcpdf_static.php @@ -1,9 +1,9 @@ setImageBuffer($file, $info); } // set alignment + $this->img_rb_x = $x + $w; $this->img_rb_y = $y + $h; + // set alignment - if ($this->rtl) { - if ($palign == 'L') { - $ximg = $this->lMargin; - } elseif ($palign == 'C') { - $ximg = ($this->w + $this->lMargin - $this->rMargin - $w) / 2; - } elseif ($palign == 'R') { - $ximg = $this->w - $this->rMargin - $w; - } else { - $ximg = $x - $w; - } - $this->img_rb_x = $ximg; + if ($palign == 'L') { + $ximg = $this->lMargin; + } elseif ($palign == 'C') { + $ximg = ($this->w + $this->lMargin - $this->rMargin - $w) / 2; + } elseif ($palign == 'R') { + $ximg = $this->w - $this->rMargin - $w; } else { - if ($palign == 'L') { - $ximg = $this->lMargin; - } elseif ($palign == 'C') { - $ximg = ($this->w + $this->lMargin - $this->rMargin - $w) / 2; - } elseif ($palign == 'R') { - $ximg = $this->w - $this->rMargin - $w; - } else { - $ximg = $x; - } - $this->img_rb_x = $ximg + $w; + $ximg = $x; } + if ($ismask OR $hidden) { // image is not displayed return $info['i']; @@ -7799,7 +7788,7 @@ class TCPDF { if (isset($this->imagekeys)) { foreach($this->imagekeys as $file) { if (strpos($file, K_PATH_CACHE) === 0) { - unlink($file); + @unlink($file); } } } @@ -7811,6 +7800,7 @@ class TCPDF { 'bufferlen', 'buffer', 'cached_files', + 'imagekeys', 'sign', 'signature_data', 'signature_max_length', @@ -9640,6 +9630,16 @@ class TCPDF { $xmp .= "\t\t\t\t\t\t".'http://ns.adobe.com/pdf/1.3/'."\n"; $xmp .= "\t\t\t\t\t\t".'pdf'."\n"; $xmp .= "\t\t\t\t\t\t".'Adobe PDF Schema'."\n"; + $xmp .= "\t\t\t\t\t\t".''."\n"; + $xmp .= "\t\t\t\t\t\t\t".''."\n"; + $xmp .= "\t\t\t\t\t\t\t\t".''."\n"; + $xmp .= "\t\t\t\t\t\t\t\t\t".'internal'."\n"; + $xmp .= "\t\t\t\t\t\t\t\t\t".'Adobe PDF Schema'."\n"; + $xmp .= "\t\t\t\t\t\t\t\t\t".'InstanceID'."\n"; + $xmp .= "\t\t\t\t\t\t\t\t\t".'URI'."\n"; + $xmp .= "\t\t\t\t\t\t\t\t".''."\n"; + $xmp .= "\t\t\t\t\t\t\t".''."\n"; + $xmp .= "\t\t\t\t\t\t".''."\n"; $xmp .= "\t\t\t\t\t".''."\n"; $xmp .= "\t\t\t\t\t".''."\n"; $xmp .= "\t\t\t\t\t\t".'http://ns.adobe.com/xap/1.0/mm/'."\n"; @@ -12281,7 +12281,7 @@ class TCPDF { $x = $this->w; } $fixed = false; - if (!empty($page) AND ($page[0] == '*')) { + if (!empty($page) AND (substr($page, 0, 1) == '*')) { $page = intval(substr($page, 1)); // this page number will not be changed when moving/add/deleting pages $fixed = true; @@ -12384,7 +12384,8 @@ class TCPDF { $x = $this->w; } $fixed = false; - if (!empty($page) AND ($page[0] == '*')) { + $pageAsString = (string) $page; + if ($pageAsString && $pageAsString[0] == '*') { $page = intval(substr($page, 1)); // this page number will not be changed when moving/add/deleting pages $fixed = true; @@ -23408,7 +23409,7 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: */ protected function SVGPath($d, $style='') { if ($this->state != 2) { - return; + return; } // set fill/stroke style $op = TCPDF_STATIC::getPathPaintOperator($style, ''); @@ -23428,6 +23429,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: $xmax = 0; $ymin = 2147483647; $ymax = 0; + $xinitial = 0; + $yinitial = 0; $relcoord = false; $minlen = (0.01 / $this->k); // minimum acceptable length (3 point) $firstcmd = true; // used to print first point @@ -23472,6 +23475,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if ($ck == 1) { $this->_outPoint($x, $y); $firstcmd = false; + $xinitial = $x; + $yinitial = $y; } else { $this->_outLine($x, $y); } @@ -23659,8 +23664,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: if ((($ck + 1) % 7) == 0) { $x0 = $x; $y0 = $y; - $rx = abs($params[($ck - 6)]); - $ry = abs($params[($ck - 5)]); + $rx = max(abs($params[($ck - 6)]), .000000001); + $ry = max(abs($params[($ck - 5)]), .000000001); $ang = -$rawparams[($ck - 4)]; $angle = deg2rad($ang); $fa = $rawparams[($ck - 3)]; // large-arc-flag @@ -23747,6 +23752,8 @@ Putting 1 is equivalent to putting 0 and calling Ln() just after. Default value: } case 'Z': { $this->_out('h'); + $x = $x0 = $xinitial; + $y = $y0 = $yinitial; break; } }