Reputation: 57
I am using SvgConverter to add a simple SVG to a PDF. I receive the following error message:
Exception in thread "main" com.itextpdf.styledxmlparser.exceptions.StyledXMLParserException: The passed value (@null) is not a number
Here is the SVG content itself:
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="100" cy="50" r="40" stroke="black" stroke-width="2" fill="red" />
</svg>
Upvotes: 2
Views: 499
Reputation: 2392
Your SVG file does not contain a width
and height
attribute in its root element, nor a viewbox
. That is (technically) not compliant with the SVG specification.
However, this kind of declaration of the svg
element is relatively common in the wild, so we have already fixed the issue and it will be supported in the upcoming release of iText Core, which is due in a few weeks (for future reference: Oct 2018).
Edit: if you want to test sooner, then you can build iText from source (https://github.com/itext/itext7) because the fix has been in the develop
branch for a few weeks.
Upvotes: 3