Menu

#1088 SVG list-style causes SVG Error, worked in previous versions

v1.0_(example)
open
nobody
None
1
2021-04-27
2015-09-18
Liam Vans
No

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.

Discussion

  • Liam Vans

    Liam Vans - 2015-09-18

    Here's the SVG file

     
  • Alexander Papst

    Alexander Papst - 2015-10-21

    Hi, can you check if https://sourceforge.net/p/tcpdf/bugs/1092/ solves the issue for you?

     
  • Liam Vans

    Liam Vans - 2015-10-21

    Nope, but the bug is related to the public static function fileGetContents()

     

    Last edit: Liam Vans 2015-10-21
  • Liam Vans

    Liam Vans - 2015-10-27

    It's been well over a month now, any idea when this bug will be fixed?

     
  • Liam Vans

    Liam Vans - 2015-11-19

    Two months.... Is Nicola still alive?

     
  • Liam Vans

    Liam Vans - 2016-02-10

    5 months later, still no activity?!

     
  • rmcrn

    rmcrn - 2016-08-10

    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);
        }
    }
    
     
  • Swapnil Jain

    Swapnil Jain - 2021-04-27

    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

Log in to post a comment.