The HTML code below:
< ul style="list-style-type:img|svg|4|4|images/square.svg" >
Causes an error "SVG Error: Not well-formed (invalid token) at line 1"
The SVG style worked before, the SVG code is attached.
Here's the SVG file
Hi, can you check if https://sourceforge.net/p/tcpdf/bugs/1092/ solves the issue for you?
Nope, but the bug is related to the public static function fileGetContents()
It's been well over a month now, any idea when this bug will be fixed?
Two months.... Is Nicola still alive?
5 months later, still no activity?!
fix the following Class::Method like this or extend the TCPDF with an simple Wrapper
* @since 6.0.025 * @public static */ public static function fileGetContents($file = '') { if (is_file($file) && is_readable($file)) { try { $content = file_get_contents($file); } catch (RuntimeException $e) { throw $e; } return $content; } ...so on with the regualar body $alt = [$file];
an other solution is to extend TCPDF like this
class JProofTcpdf extends TCPDF { /** * @buggy svg handler in 6.2. * * @param $file * @param string $x * @param string $y * @param int $w * @param int $h * @param string $link * @param string $align * @param string $palign * @param int $border * @param bool $fitonpage * * @return \image|void */ public function ImageSVG($file, $x = '', $y = '', $w = 0, $h = 0, $link = '', $align = '', $palign = '', $border = 0, $fitonpage = false) { if (is_file($file) && is_readable($file)) { $file = '@' . file_get_contents($file); } return parent::ImageSVG($file, $x, $y, $w, $h, $link, $align, $palign, $border, $fitonpage); } }
Please add $file to alt array if (isset($_SERVER['SCRIPT_URI']) && !preg_match('%^(https?|ftp)://%', $file) && !preg_match('%^//%', $file) ) { $urldata = @parse_url($_SERVER['SCRIPT_URI']); return $urldata['scheme'].'://'.$urldata['host'].(($file[0] == '/') ? '' : '/').$file; $alt[]=$file; }
Log in to post a comment.
Here's the SVG file
Hi, can you check if https://sourceforge.net/p/tcpdf/bugs/1092/ solves the issue for you?
Nope, but the bug is related to the public static function fileGetContents()
Last edit: Liam Vans 2015-10-21
It's been well over a month now, any idea when this bug will be fixed?
Two months.... Is Nicola still alive?
5 months later, still no activity?!
fix the following Class::Method like this or extend the TCPDF with an simple Wrapper
an other solution is to extend TCPDF
like this
Please add $file to alt array
if (isset($_SERVER['SCRIPT_URI'])
&& !preg_match('%^(https?|ftp)://%', $file)
&& !preg_match('%^//%', $file)
) {
$urldata = @parse_url($_SERVER['SCRIPT_URI']);
return $urldata['scheme'].'://'.$urldata['host'].(($file[0] == '/') ? '' : '/').$file;
$alt[]=$file;
}
Last edit: Swapnil Jain 2021-04-27