Forum Bugs

Big svg image is not converted

arjana
Hello,

We are trying to convert an html with an image which source is a a big svg file ~20mb. We are using a java wrapper, and the image simply does not appear in the output pdf, an alt text is displayed when used.

When trying conversion via the command line, the following is shown:

E:\Projects\princexml\src\main\resources>"c:\Program Files (x86)\Prince\engine\bin\prince.exe" no_diagram.html -o no_diagram.pdf --page-size A1
prince: big_diagram.svg:190408: error: Huge input lookup
prince: big_diagram.svg: warning: could not load SVG image

Prince version: 15.2

Is there a limitation on an image size or there may be issues with a specific image?

The svg uses several embedded images, I tried to remove the biggest of them, and the image was exported.

Arjana

Edited by arjana

arjana
Here is an updated link to one of big input html files with an embedded svg image, we managed to reproduce the issue with various large images, both embedded or external:
https://www.dropbox.com/scl/fi/nf0fmxhjbfs2qj32xr6vj/large-image.html?rlkey=f5bwa0mj9rl1d6awdnzpmw7ap&dl=0
mikeday
We have addressed this issue in the latest build, please let us know if you experience any further issues with large XML documents.

(Please note that when running Prince on Linux it may be necessary to pass the new --xml-parse-huge option on the command-line to enable this behaviour. Prince uses libxml2 and it caps the size of XML documents to protect against the "billion laughs" entity attack where a small document can expand when parsed to consume an unexpectedly large amount of memory. A better mechanism to protect against this attack was added in libxml2 version 2.11.0 which allows Prince to safely enable the option by default, however in the meantime please exercise care when using this option with untrusted XML input that could potentially consume more memory than anticipated).
arjana
Thank you, I tried conversion on Windows and Linux and it worked.
arjana
Can there be any negative impact if we set this new -xml-parse-huge option for all OS? Or is it simply ignored if set for Windows or Mac?
mikeday
It will have no effect on Windows or Mac as it will already be enabled by default on these platforms.
arjana
Thank you for the answer
mikeday
The new behaviour and --xml-parse-huge option have been backported to Prince 15.4.