svgwrite
svgwrite copied to clipboard
Specifying height, width in constructor doesn't work
Code example from https://svgwrite.readthedocs.io/en/master/overview.html
Drawing(height='10cm', width='20cm') # drawing area of 10cm x 20cm
doesn't work correctly.
It produces <svg baseProfile="full" height="100%" version="1.1" width="100%"
...
I run pip install --upgrade svgwrite
(is says 1.3.1)
I searched the docs and the only thing that worked for me is passing 'size' directly to init
dwg = svgwrite.Drawing(height='10cm', width='20cm')
dwg.saveas('test2.svg')
dwg = svgwrite.Drawing(size=('20cm', '10cm'))
dwg.saveas('test3.svg')
test3 has the correct height, width: <svg baseProfile="full" height="10cm" version="1.1" width="20cm"
That example code was broken 9 years ago a45ca4d4f6861207232deb4a2b8d1a00247bc555 and now you can use:
dwg = svgwrite.Drawing(height='10cm', width='20cm', size=None)
This behavior seems to be fix now, I can't reproduce with the last svgwrite version 1.4.2