SVGFigure does not set width and height element if created directly
See original GitHub issueWidth and height aren’t correctly set in the XML if transform.SVGFigure
is created directly:
import svgutils
svgutils.transform.SVGFigure("10cm", "16cm").to_str()
prints
b'<?xml version=\'1.0\' encoding=\'ASCII\' standalone=\'yes\'?>\n<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1"/>\n'
This code is used in the tutorial:
Therefore I expect that this is not an intended behavior.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (1 by maintainers)
Top Results From Across the Web
How to use the svgutils.transform.SVGFigure function in ... - Snyk
import svgutils.transform as sg import sys #create new SVG figure fig = sg. ... SVGFigure(self.width, self.height) element.append(self) svgstr ...
Read more >SVG element width and height set in html but appearing as 0 0 ...
One of the reasons why SVG file is rendered on front-end with zero height and width is missing <svg> tag attributes "height" and...
Read more >Source code for svgutils.transform
If y is not provided, it is assumed equal to x (according to the W3 ... Element(SVG+"svg", nsmap=NSMAP) self.root.set("version", "1.1") if width: self.width...
Read more >How to Scale SVG | CSS-Tricks
If you use an <object> , <embed> , or <iframe> to embed your SVG, setting height and width on the <svg> won't change...
Read more >Scaling Issues
The SVG files produced by svglite do not include width and height ... The scaling straightforward but requires some understanding of the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I observed this both on 0.3.4 and master (4abf7fb)
indeed we don’t set the SVG tag attributes when width or height is an integer/string