How to resize an SVG document?

Jul 23, 2009 at 12:33 PM

Hi there,

is it possible (and if so, how?) to resize (scale) an SVG document?

Cheerio,

 

Golo

Coordinator
Jul 23, 2009 at 12:53 PM

Golo,

The best way to do this would be to apply a scale transform to the root element:

<svg ... transform="scale(2)" ...>
    ....

Or using the API after the document has been loaded:

var svgDoc = SvgDocument.Open("path");
svgDoc.Transforms.Add(new SvgScale(2));

The scale factor can be positive or negative.

If you do this watch out for width and height though, as the system isn't yet automatically adjusting them based on scaling. So if you scale up or down apply the same scaling to the Width & Height properties of the document.

Scriv

Jul 23, 2009 at 2:08 PM

Hi Scriv,

great, thanks for helping so fast :-)!

Your solution worked perfectly, except one little caveat: You have to insert a

svgDoc.Transforms = new SvgTransformsCollection();

in between.

Cheerio,

Golo