-
-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
385dcf4
commit f06e243
Showing
11 changed files
with
993 additions
and
777 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
6.7.5 | ||
6.7.7 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<?php | ||
//============================================================+ | ||
// File name : tcpdf.php | ||
// Version : 6.7.5 | ||
// Version : 6.7.7 | ||
// Begin : 2002-08-03 | ||
// Last Update : 2024-03-18 | ||
// Last Update : 2024-10-26 | ||
// Author : Nicola Asuni - Tecnick.com LTD - www.tecnick.com - [email protected] | ||
// License : GNU-LGPL v3 (http://www.gnu.org/copyleft/lesser.html) | ||
// ------------------------------------------------------------------- | ||
|
@@ -128,7 +128,7 @@ | |
* 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.7.5 | ||
* @version 6.7.7 | ||
* @author Nicola Asuni - [email protected] | ||
* @IgnoreAnnotation("protected") | ||
* @IgnoreAnnotation("public") | ||
|
@@ -8164,7 +8164,7 @@ protected function _putpages() { | |
* @since 5.0.010 (2010-05-17) | ||
*/ | ||
protected function _getannotsrefs($n) { | ||
if (!(isset($this->PageAnnots[$n]) OR ($this->sign AND isset($this->signature_data['cert_type'])))) { | ||
if (!(isset($this->PageAnnots[$n]) OR count($this->empty_signature_appearance)>0 OR ($this->sign AND isset($this->signature_data['cert_type'])))) { | ||
return ''; | ||
} | ||
$out = ' /Annots ['; | ||
|
@@ -8532,7 +8532,7 @@ protected function _putannotsobjs() { | |
} | ||
case 'freetext': { | ||
if (isset($pl['opt']['da']) AND !empty($pl['opt']['da'])) { | ||
$annots .= ' /DA ('.$pl['opt']['da'].')'; | ||
$annots .= ' /DA '.$this->_datastring($pl['opt']['da']); | ||
} | ||
if (isset($pl['opt']['q']) AND ($pl['opt']['q'] >= 0) AND ($pl['opt']['q'] <= 2)) { | ||
$annots .= ' /Q '.intval($pl['opt']['q']); | ||
|
@@ -8789,7 +8789,7 @@ protected function _putannotsobjs() { | |
$annots .= ' /AA << '.$pl['opt']['aa'].' >>'; | ||
} | ||
if (isset($pl['opt']['da']) AND !empty($pl['opt']['da'])) { | ||
$annots .= ' /DA ('.$pl['opt']['da'].')'; | ||
$annots .= ' /DA '.$this->_datastring($pl['opt']['da']); | ||
} | ||
if (isset($pl['opt']['q']) AND ($pl['opt']['q'] >= 0) AND ($pl['opt']['q'] <= 2)) { | ||
$annots .= ' /Q '.intval($pl['opt']['q']); | ||
|
@@ -9939,7 +9939,7 @@ protected function _putcatalog() { | |
$out .= ' >> >>'; | ||
} | ||
$font = $this->getFontBuffer((($this->pdfa_mode) ? 'pdfa' : '') .'helvetica'); | ||
$out .= ' /DA (/F'.$font['i'].' 0 Tf 0 g)'; | ||
$out .= ' /DA ' . $this->_datastring('/F'.$font['i'].' 0 Tf 0 g'); | ||
$out .= ' /Q '.(($this->rtl)?'2':'0'); | ||
//$out .= ' /XFA '; | ||
$out .= ' >>'; | ||
|
@@ -11046,7 +11046,7 @@ public function setProtection($permissions=array('print', 'modify', 'copy', 'ann | |
$this->encryptdata['V'] = 4; | ||
$this->encryptdata['Length'] = 128; | ||
$this->encryptdata['CF']['CFM'] = 'AESV2'; | ||
$this->encryptdata['CF']['Length'] = 128; | ||
$this->encryptdata['CF']['Length'] = 16; | ||
if ($this->encryptdata['pubkey']) { | ||
$this->encryptdata['SubFilter'] = 'adbe.pkcs7.s5'; | ||
$this->encryptdata['Recipients'] = array(); | ||
|
@@ -11057,7 +11057,7 @@ public function setProtection($permissions=array('print', 'modify', 'copy', 'ann | |
$this->encryptdata['V'] = 5; | ||
$this->encryptdata['Length'] = 256; | ||
$this->encryptdata['CF']['CFM'] = 'AESV3'; | ||
$this->encryptdata['CF']['Length'] = 256; | ||
$this->encryptdata['CF']['Length'] = 32; | ||
if ($this->encryptdata['pubkey']) { | ||
$this->encryptdata['SubFilter'] = 'adbe.pkcs7.s5'; | ||
$this->encryptdata['Recipients'] = array(); | ||
|
@@ -13936,8 +13936,8 @@ public function setVisibility($v) { | |
* @since 3.0.000 (2008-03-27) | ||
*/ | ||
protected function addExtGState($parms) { | ||
if ($this->pdfa_mode || $this->pdfa_version >= 2) { | ||
// transparencies are not allowed in PDF/A mode | ||
if (($this->pdfa_mode && $this->pdfa_version < 2) || ($this->state != 2)) { | ||
// transparency is not allowed in PDF/A-1 mode | ||
return; | ||
} | ||
// check if this ExtGState already exist | ||
|
@@ -16440,7 +16440,7 @@ protected function getHtmlDomArray($html) { | |
) | ||
); | ||
|
||
if(empty($html)) { | ||
if($html === '' || $html === null) { | ||
return $dom; | ||
} | ||
// array of CSS styles ( selector => properties). | ||
|
@@ -19010,29 +19010,29 @@ protected function openHTMLTagHandler($dom, $key, $cell) { | |
$this->setLineWidth($hrHeight); | ||
|
||
$lineStyle = array(); | ||
if (isset($tag['fgcolor'])) { | ||
$lineStyle['color'] = $tag['fgcolor']; | ||
} | ||
if (isset($tag['fgcolor'])) { | ||
$lineStyle['color'] = $tag['fgcolor']; | ||
} | ||
|
||
if (isset($tag['fgcolor'])) { | ||
$lineStyle['color'] = $tag['fgcolor']; | ||
} | ||
if (isset($tag['fgcolor'])) { | ||
$lineStyle['color'] = $tag['fgcolor']; | ||
} | ||
|
||
if (isset($tag['style']['cap'])) { | ||
$lineStyle['cap'] = $tag['style']['cap']; | ||
} | ||
if (isset($tag['style']['cap'])) { | ||
$lineStyle['cap'] = $tag['style']['cap']; | ||
} | ||
|
||
if (isset($tag['style']['join'])) { | ||
$lineStyle['join'] = $tag['style']['join']; | ||
} | ||
if (isset($tag['style']['join'])) { | ||
$lineStyle['join'] = $tag['style']['join']; | ||
} | ||
|
||
if (isset($tag['style']['dash'])) { | ||
$lineStyle['dash'] = $tag['style']['dash']; | ||
} | ||
if (isset($tag['style']['dash'])) { | ||
$lineStyle['dash'] = $tag['style']['dash']; | ||
} | ||
|
||
if (isset($tag['style']['phase'])) { | ||
$lineStyle['phase'] = $tag['style']['phase']; | ||
} | ||
if (isset($tag['style']['phase'])) { | ||
$lineStyle['phase'] = $tag['style']['phase']; | ||
} | ||
|
||
$lineStyle = array_filter($lineStyle); | ||
|
||
|
@@ -19055,15 +19055,18 @@ protected function openHTMLTagHandler($dom, $key, $cell) { | |
if ($imgsrc[0] === '@') { | ||
// data stream | ||
$imgsrc = '@'.base64_decode(substr($imgsrc, 1)); | ||
$type = ''; | ||
$type = preg_match('/<svg([^\>]*)>/si', $imgsrc) ? 'svg' : ''; | ||
} else if (preg_match('@^data:image/([^;]*);base64,(.*)@', $imgsrc, $reg)) { | ||
$imgsrc = '@'.base64_decode($reg[2]); | ||
$type = $reg[1]; | ||
} elseif (strpos($imgsrc, '../') !== false) { | ||
// accessing parent folders is not allowed | ||
break; | ||
} elseif ( $this->allowLocalFiles && substr($imgsrc, 0, 7) === 'file://') { | ||
// get image type from a local file path | ||
$imgsrc = substr($imgsrc, 7); | ||
$type = TCPDF_IMAGES::getImageFileType($imgsrc); | ||
} else { | ||
// get image type from a local file path | ||
$imgsrc = substr($imgsrc, 7); | ||
$type = TCPDF_IMAGES::getImageFileType($imgsrc); | ||
} else { | ||
if (($imgsrc[0] === '/') AND !empty($_SERVER['DOCUMENT_ROOT']) AND ($_SERVER['DOCUMENT_ROOT'] != '/')) { | ||
// fix image path | ||
$findroot = strpos($imgsrc, $_SERVER['DOCUMENT_ROOT']); | ||
|
@@ -23170,14 +23173,12 @@ public function ImageSVG($file, $x=null, $y=null, $w=0, $h=0, $link='', $align=' | |
$this->_out(sprintf('%F %F %F %F %F %F cm', $svgscale_x, 0, 0, $svgscale_y, ($e + $svgoffset_x), ($f + $svgoffset_y))); | ||
// creates a new XML parser to be used by the other XML functions | ||
$parser = xml_parser_create('UTF-8'); | ||
// the following function allows to use parser inside object | ||
xml_set_object($parser, $this); | ||
// disable case-folding for this XML parser | ||
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); | ||
// sets the element handler functions for the XML parser | ||
xml_set_element_handler($parser, 'startSVGElementHandler', 'endSVGElementHandler'); | ||
xml_set_element_handler($parser, [$this, 'startSVGElementHandler'], [$this, 'endSVGElementHandler']); | ||
// sets the character data handler function for the XML parser | ||
xml_set_character_data_handler($parser, 'segSVGContentHandler'); | ||
xml_set_character_data_handler($parser, [$this, 'segSVGContentHandler']); | ||
// start parsing an XML document | ||
if (!xml_parse($parser, $svgdata)) { | ||
$error_message = sprintf('SVG Error: %s at line %d', xml_error_string(xml_get_error_code($parser)), xml_get_current_line_number($parser)); | ||
|
@@ -23327,7 +23328,7 @@ protected function setSVGStyles($svgstyle, $prevsvgstyle, $x=0, $y=0, $w=1, $h=1 | |
$text_color = TCPDF_COLORS::convertHTMLColorToDec($svgstyle['text-color'], $this->spot_colors); | ||
$this->setTextColorArray($text_color); | ||
// clip | ||
if (preg_match('/rect\(([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)[\s]*([a-z0-9\-\.]*)\)/si', $svgstyle['clip'], $regs)) { | ||
if (preg_match('/rect\(([a-z0-9\-\.]*+)[\s]*+([a-z0-9\-\.]*+)[\s]*+([a-z0-9\-\.]*+)[\s]*+([a-z0-9\-\.]*+)\)/si', $svgstyle['clip'], $regs)) { | ||
$top = (isset($regs[1])?$this->getHTMLUnitToUnits($regs[1], 0, $this->svgunit, false):0); | ||
$right = (isset($regs[2])?$this->getHTMLUnitToUnits($regs[2], 0, $this->svgunit, false):0); | ||
$bottom = (isset($regs[3])?$this->getHTMLUnitToUnits($regs[3], 0, $this->svgunit, false):0); | ||
|
@@ -23444,8 +23445,8 @@ protected function setSVGStyles($svgstyle, $prevsvgstyle, $x=0, $y=0, $w=1, $h=1 | |
$cy -= $h; | ||
} | ||
$this->_out(sprintf('%F 0 0 %F %F %F cm', ($w * $this->k), ($h * $this->k), ($x * $this->k), ($cy * $this->k))); | ||
if (count($gradient['stops']) > 1) { | ||
$this->Gradient($gradient['type'], $gradient['coords'], $gradient['stops'], array(), false); | ||
if ((is_array($gradient['stops']) || $gradient['stops'] instanceof Countable) && count($gradient['stops']) > 1) { | ||
$this->Gradient($gradient['type'], $gradient['coords'], $gradient['stops']); | ||
} | ||
} elseif ($svgstyle['fill'] != 'none') { | ||
$fill_color = TCPDF_COLORS::convertHTMLColorToDec($svgstyle['fill'], $this->spot_colors); | ||
|
@@ -23639,7 +23640,8 @@ protected function SVGPath($d, $style='') { | |
$params = array(); | ||
if (isset($val[2])) { | ||
// get curve parameters | ||
$rawparams = preg_split('/([\,\s]+)/si', trim($val[2])); | ||
preg_match_all('/-?\d*\.?\d+/', trim($val[2]), $matches); | ||
$rawparams = $matches[0]; | ||
$params = array(); | ||
foreach ($rawparams as $ck => $cp) { | ||
$params[$ck] = $this->getHTMLUnitToUnits($cp, 0, $this->svgunit, false); | ||
|
Oops, something went wrong.