svg2pdf incorrect width and height output -
I have an svg file with attributes width="1929" height="2572" which I created as a bytestring or as a file
cairosvg.svg2pdf(svgstr, write_to="svg_0.pdf")
svg_0.pdf comes out with 'width': 1446.75, 'height': 1929
I looked thru the code and I noticed that the svg2pdf(dpi=96) default, cairosvg UNITS['pt'] will scale to 72dpi. If my svg has no mention of dpi, or units, why should it be assumed that one wishes to scale ?
fix to the unit assumption is to just pass dpi=72
Hi!
svg_0.pdf comes out with 'width': 1446.75, 'height': 1929
The size of a PDF page is stored in inches, so it’s not possible to give a PDF size in pixels without using an arbitrary DPI value.
96 is the default value CairoSVG uses, because that’s the one used in CSS (1 inch = 96 px). You have to set 72 if you want 72. :smile: