I have a SVG file with viewBox=”-155.7 -99 510 510″. I believe this offset the paths in Mac OS X preview by -155.7 -99. when I open the SVG in Illustrator, the paths are not offset at all. how do I export this svg such that:
- viewBox=”0 0 510 510″
- and all the paths have added off set of -155.7 -99
I have tried changing the position of the artboard but the origin of viewbox is never 0,0.
I did a little research on SVG’s and apparently the viewbox is not a element that is exportable via Illustrator. The viewbox element is only compatible with certain programs that chose to use this element or manipulate it. Sadly, Illustrator is not one of them.
If you saved the SVG from Illustrator without “Preserve Illustrator Editing Capabilities” you can reverse the process. Whatever changes you make in the data of the SVG file will then be reflected in Illustrator but through repositioning and resizing both the Artboard and Layers to create a pseudo-viewbox.
For now all you can do is design work in Illustrator and all extra code for offset and positioning of the viewbox within the file data. You can make a pseudo-viewbox by simply changing the Artboards Width + Height/X + Y position and then changing the objects Size and Position attributes as well. But there will never be a true viewbox attribute unless they release an update to Illustrator with editable viewbox features.
Some reading on the SVG Format in Illustrator: Adobe Illustrator Save in SVG Format