SVG in <img> do not render

0 votes
asked Dec 6, 2020 in Bug by Marius

Simple example:

rectangle "<img:>"

This raises an IllegalStateException: cannot find height

It also happens with other SVG files, e.g.

Best regards!

2 Answers

0 votes
answered Jan 26 by Martin

The SVG file may be missing the height and width in the opening <svg> tag:

It reads <svg id="Layer_1" data-name="Layer 1" xmlns="" viewBox="0 0 40 40">, so maybe should read <svg id="Layer_1" data-name="Layer 1" xmlns="" viewBox="0 0 40 40" width="128" height="128"> or whatever you want the default size to be. Just a guess, though, as I can't get SVGs to render at all myself (which is how I found this bug report).

0 votes
answered Feb 2 by plantuml (257,940 points)
This should be fixed in last release V1.2021.1

We are now also using viewBox when available.

Tell us if you find other issues!
commented Feb 4 by Marius
Thank you. The posted snippet works. But if I try it with the second URL from my original post, it fails with this error:

(Cannot decode SVG: