Image with data URI containing SVG does not render

0 votes
asked Dec 11, 2020 in Bug by Peter

When I use image in a description that has SVG image encoded in data URI, PlantUML renders "(cannot decode)" instead of the image:

  • using PNG in data URI works: <img:data:image/png;base64,...>
  • using SVG in external file works: <img:file.svg> (PlantUML Web Server - view as SVG)
  • using SVG in data URI does not work: <img:data:image/svg+xml;base64,...> (view as SVG)

The data URI is encoded correctly and is displayed correctly when using in web browser. The SVG content is same as in the case with external file, so PlantUML should be able to render it correctly.

Could you please look into this?

Example:

@startuml
rectangle "<img:data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjwhRE9DVFlQRSBzdmcgUFVCTElDICItLy9XM0MvL0RURCBTVkcgMS4xLy9FTiIgImh0dHA6Ly93d3cudzMub3JnL0dyYXBoaWNzL1NWRy8xLjEvRFREL3N2ZzExLmR0ZCI+DQo8c3ZnIHZlcnNpb249IjEuMSIgaWQ9InNoYXBlcyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgeD0iMHB4IiB5PSIwcHgiDQoJIHdpZHRoPSIzMDkuMjg2cHgiIGhlaWdodD0iMjk1cHgiIHZpZXdCb3g9IjAgMCAzMDkuMjg2IDI5NSIgZW5hYmxlLWJhY2tncm91bmQ9Im5ldyAwIDAgMzA5LjI4NiAyOTUiIHhtbDpzcGFjZT0icHJlc2VydmUiPg0KDQo8ZGVmcz4NCiAgPHN0eWxlIHR5cGU9InRleHQvY3NzIj4NCiAgDQogICBAbWVkaWEgc2NyZWVuIGFuZCAobWluLXdpZHRoOjUwMHB4KSB7DQoJCSNzdGFyIHsNCgkJCXN0cm9rZS13aWR0aDogMTBweDsNCgkJCXN0cm9rZTogI2U1ZmYxZjsNCgkJCWZpbGw6ICMwMDA7DQoJCQlmaWxsLW9wYWNpdHk6IC45Ow0KCQkJdHJhbnNpdG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CTE1Mi40MjksNS41NTYgMTk3Ljc4OCw5Ny41NTIgMjk5LjI4NiwxMTIuMzQgMjI1LjgxLDE4My45MDcgIi8+DQo8L3N2Zz4NCg==>"
@enduml

1 Answer

0 votes
answered Dec 11, 2020 by plantuml (241,100 points)
 
Best answer
Thanks for the feedback !

This is fixed in last beta http://beta.plantuml.net/plantuml.jar

Tell us if you find other issue.

PS: Your SVG file is really nice :-)
commented Dec 12, 2020 by Peter
Wow, what can I say - awesome!

I verified it works with beta, which makes my tool work without extra step of generating separate files in temporary directory.

Thanks!
...