svgwrite icon indicating copy to clipboard operation
svgwrite copied to clipboard

Specifying height, width in constructor doesn't work

Open szikra opened this issue 4 years ago • 2 comments

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"

szikra avatar Oct 05 '19 10:10 szikra

That example code was broken 9 years ago a45ca4d4f6861207232deb4a2b8d1a00247bc555 and now you can use: dwg = svgwrite.Drawing(height='10cm', width='20cm', size=None)

intact avatar Nov 26 '19 19:11 intact

This behavior seems to be fix now, I can't reproduce with the last svgwrite version 1.4.2

brodokk avatar Apr 18 '22 06:04 brodokk