Skip to content

Commit 76debf1

Browse files
authored
Merge pull request #811 from tecnickcom/multimerge
multiple PRs
2 parents c838d7f + 50717eb commit 76debf1

File tree

5 files changed

+41
-10
lines changed

5 files changed

+41
-10
lines changed

CHANGELOG.TXT

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
6.9.5 (2025-05-27)
2+
- Automatically add destinations from HTML code #804
3+
- Wrong default value when $table_el['old_cell_padding'] is missing #807
4+
- Fixed PHP warning when empty hash link for image exists in HTML #809
5+
- Fix for application of alpha component to SVG RGBA fills #810
6+
17
6.9.4 (2025-05-13)
28
- Update donation link.
39

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6.9.4
1+
6.9.5

include/tcpdf_colors.php

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ public static function convertHTMLColorToDec($hcolor, &$spotc, $defcol=array('R'
275275
$color = strtolower($color);
276276
// check for javascript color array syntax
277277
if (strpos($color, '[') !== false) {
278-
if (preg_match('/[\[][\"\'](t|g|rgb|cmyk)[\"\'][\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\]]/', $color, $m) > 0) {
278+
if (preg_match('/[\[][\"\'](t|g|rgba|rgb|cmyk)[\"\'][\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\,]?([0-9\.]*+)[\]]/', $color, $m) > 0) {
279279
$returncolor = array();
280280
switch ($m[1]) {
281281
case 'cmyk': {
@@ -286,7 +286,8 @@ public static function convertHTMLColorToDec($hcolor, &$spotc, $defcol=array('R'
286286
$returncolor['K'] = max(0, min(100, (floatval($m[5]) * 100)));
287287
break;
288288
}
289-
case 'rgb': {
289+
case 'rgb':
290+
case 'rgba': {
290291
// RGB
291292
$returncolor['R'] = max(0, min(255, (floatval($m[2]) * 255)));
292293
$returncolor['G'] = max(0, min(255, (floatval($m[3]) * 255)));
@@ -317,6 +318,25 @@ public static function convertHTMLColorToDec($hcolor, &$spotc, $defcol=array('R'
317318
if (strlen($color) == 0) {
318319
return $defcol;
319320
}
321+
// RGBA ARRAY
322+
if (substr($color, 0, 4) == 'rgba') {
323+
$codes = substr($color, 5);
324+
$codes = str_replace(')', '', $codes);
325+
$returncolor = explode(',', $codes);
326+
// remove alpha component
327+
array_pop($returncolor);
328+
foreach ($returncolor as $key => $val) {
329+
if (strpos($val, '%') > 0) {
330+
// percentage
331+
$returncolor[$key] = (255 * intval($val) / 100);
332+
} else {
333+
$returncolor[$key] = intval($val); /* floatize */
334+
}
335+
// normalize value
336+
$returncolor[$key] = max(0, min(255, $returncolor[$key]));
337+
}
338+
return $returncolor;
339+
}
320340
// RGB ARRAY
321341
if (substr($color, 0, 3) == 'rgb') {
322342
$codes = substr($color, 4);

include/tcpdf_static.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class TCPDF_STATIC {
5555
* Current TCPDF version.
5656
* @private static
5757
*/
58-
private static $tcpdf_version = '6.9.4';
58+
private static $tcpdf_version = '6.9.5';
5959

6060
/**
6161
* String alias for total number of pages.

tcpdf.php

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?php
22
//============================================================+
33
// File name : tcpdf.php
4-
// Version : 6.9.4
4+
// Version : 6.9.5
55
// Begin : 2002-08-03
6-
// Last Update : 2025-04-18
6+
// Last Update : 2025-05-27
77
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected]
88
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html)
99
// -------------------------------------------------------------------
@@ -104,7 +104,7 @@
104104
* Tools to encode your unicode fonts are on fonts/utils directory.</p>
105105
* @package com.tecnick.tcpdf
106106
* @author Nicola Asuni
107-
* @version 6.9.4
107+
* @version 6.9.5
108108
*/
109109

110110
// TCPDF configuration
@@ -128,7 +128,7 @@
128128
* 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>
129129
* @package com.tecnick.tcpdf
130130
* @brief PHP class for generating PDF documents without requiring external extensions.
131-
* @version 6.9.4
131+
* @version 6.9.5
132132
* @author Nicola Asuni - [email protected]
133133
* @IgnoreAnnotation("protected")
134134
* @IgnoreAnnotation("public")
@@ -17427,6 +17427,9 @@ public function writeHTML($html, $ln=true, $fill=false, $reseth=false, $cell=fal
1742717427
}
1742817428
}
1742917429
if ($key == $maxel) break;
17430+
if ($dom[$key]['tag'] AND $dom[$key]['opening'] AND !empty($dom[$key]['attribute']['id'])) {
17431+
$this->setDestination($dom[$key]['attribute']['id']);
17432+
}
1743017433
if ($dom[$key]['tag'] AND isset($dom[$key]['attribute']['pagebreak'])) {
1743117434
// check for pagebreak
1743217435
if (($dom[$key]['attribute']['pagebreak'] == 'true') OR ($dom[$key]['attribute']['pagebreak'] == 'left') OR ($dom[$key]['attribute']['pagebreak'] == 'right')) {
@@ -19151,7 +19154,7 @@ protected function openHTMLTagHandler($dom, $key, $cell) {
1915119154
$imglink = '';
1915219155
if (isset($this->HREF['url']) AND !TCPDF_STATIC::empty_string($this->HREF['url'])) {
1915319156
$imglink = $this->HREF['url'];
19154-
if ($imglink[0] == '#' AND is_numeric($imglink[1])) {
19157+
if ($imglink[0] == '#' AND isset($imglink[1]) AND is_numeric($imglink[1])) {
1915519158
// convert url to internal link
1915619159
$lnkdata = explode(',', $imglink);
1915719160
if (isset($lnkdata[0])) {
@@ -20012,7 +20015,7 @@ protected function closeHTMLTagHandler($dom, $key, $cell, $maxbottomliney=0) {
2001220015
}
2001320016
}
2001420017
if (!$in_table_head) { // we are not inside a thead section
20015-
$this->cell_padding = isset($table_el['old_cell_padding']) ? $table_el['old_cell_padding'] : null;
20018+
$this->cell_padding = isset($table_el['old_cell_padding']) ? $table_el['old_cell_padding'] : array('T' => 0, 'R' => 0, 'B' => 0, 'L' => 0);
2001620019
// reset row height
2001720020
$this->resetLastH();
2001820021
if (($this->page == ($this->numpages - 1)) AND ($this->pageopen[$this->numpages])) {
@@ -23479,6 +23482,8 @@ protected function setSVGStyles($svgstyle, $prevsvgstyle, $x=0, $y=0, $w=1, $h=1
2347923482
$fill_color = TCPDF_COLORS::convertHTMLColorToDec($svgstyle['fill'], $this->spot_colors);
2348023483
if ($svgstyle['fill-opacity'] != 1) {
2348123484
$this->setAlpha($this->alpha['CA'], 'Normal', $svgstyle['fill-opacity'], false);
23485+
} elseif (preg_match('/rgba\(\d+%?,\s*\d+%?,\s*\d+%?,\s*(\d+(?:\.\d+)?)\)/i', $svgstyle['fill'], $rgba_matches)) {
23486+
$this->setAlpha($this->alpha['CA'], 'Normal', $rgba_matches[1], false);
2348223487
}
2348323488
$this->setFillColorArray($fill_color);
2348423489
if ($svgstyle['fill-rule'] == 'evenodd') {

0 commit comments

Comments
 (0)