ropensci / rsvg

SVG renderer for R based on librsvg2
Other
97 stars 1 forks source link

Huge svg input #6

Closed ytdai closed 4 years ago

ytdai commented 6 years ago

The error is: rsvg_pdf("output_all_sample_kmer.1311.svg", file = "output_all_sample_kmer.1311.pdf") Error in rsvg_format(svg, file, width, height, 2L) : Failed to parse svg: Error domain 1 code 1 on line 2309513 column 1 of data: internal error: Huge input lookup.

jeroen commented 6 years ago

Can you include an example?

ytdai commented 6 years ago

Many thanks for your quick response, I just upload a SVG file and the link is: https://github.com/ytdai/test_files/blob/master/figure.g4.svg

This SVG file is about 61Mb, and rsvg can't convert this file to pdf format.

jeroen commented 6 years ago

Code:

download.file('https://raw.githubusercontent.com/ytdai/test_files/master/figure.g4.svg', 'test.svg')
out <- rsvg::rsvg_raw('test.svg', width = 600, height = 600)

Looks like this is indeed a limitation of librsvg....

ytdai commented 6 years ago

Yes, I think so. Now I use rsvg to transfer svg file to pdf with file size less than 10M. And when the size is over 10M, I use inkscape. inkscape --without-gui --export-pdf=test.pdf test.svg

jeroen commented 4 years ago

The latest version of librsvg is giving a more helpful error:

  Failed to parse svg: XML parse error: cannot load more than 200000 XML elements

There really isn't anything I can do about this, it's a limitation of the c library.