I just stumbled over a bug, which seems to occur recently (> 7.3.1)
The resulting svg contains <svg:rect> instead of <rect> elements, which are not interpreted properly by browsers. I tried to follow the code snippets provided on the documentation of 7.4.2, since I thought maybe my usage of the package is not suitable with recent versions, but it resulted in improper SVGs as well.
For versions > 7.3.1 I found a workaround, which is not very smart but works:
...
xyz = svg_img.to_string(encoding='unicode')
xyz = xyz.replace("svg:rect", "rect") # just replace svg:rect with rect
...
The result can be interpreted by browsers properly. Resulting SVGs can be checked on validity using this nice tool: https://svg.enshrined.co.uk/
I just stumbled over a bug, which seems to occur recently (> 7.3.1)
The resulting svg contains
<svg:rect>
instead of<rect>
elements, which are not interpreted properly by browsers. I tried to follow the code snippets provided on the documentation of 7.4.2, since I thought maybe my usage of the package is not suitable with recent versions, but it resulted in improper SVGs as well.For versions > 7.3.1 I found a workaround, which is not very smart but works:
The result can be interpreted by browsers properly. Resulting SVGs can be checked on validity using this nice tool: https://svg.enshrined.co.uk/