Forum How do I...?

SVG height & width

brentl999
Hi,

It is my understanding that when Prince renders SVG that it expect the height and width to "unitless" (e.g. no "in", "em", "cm", etc).
Further the implied unit is Pixels.
If I have this all correct, then my final question is, what translation is done on the provided height and width in order to determine how big to the make the SVG object on the page.

Thanks,
Brent
mikeday
Dimensions in SVG can get complicated. Here is a simple example that creates a 1 inch black square:
<svg width="1in" height="1in" viewBox="0 0 100 100">
<rect x="0" y="0" width="100" height="100"/>
</svg>

The SVG canvas is defined by the viewBox attribute, and then scaled on the page according to the width and height attributes.
brentl999
Okay, I see I have misunderstood things a little bit.

I'll rephrase my question. If the SVG height & width have no units specified (which implies pixels) how does Prince determine how large the rendered image will be?
mikeday
Prince assumes a standard resolution of 96dpi when scaling pixel values, so a width and height of "96" or "96px" is equivalent to one inch.