I'm having issues with individual elements with an imported SVG and was hoping somehow could advise.
I have an SVG created in Illustrator, with several layers, which end up being group elements. When I retrieve the SVG from my server, I get something similar to.
<svg>
<g>
<g>
</svg>
I do not want to place the image as one, so I break it up by the groups, and surround each by their own svg tag and then place on the page.
<svg>
<g>
</svg>
<svg>
<g>
</svg>
This is great, works like I want.
My issue lies, where the paths of each of these items is drawn in the original file. They are all drawn off (0,0) from the Illustrator file, so when I try to place them, they all have a ton of white space area on the left, where the other elements once existed.
I've tried using transform="translate(-50,-50)" or whatever, which does shift the elements, but since they do not have x,y properties, I do not know where to shift them.
Does anyone know of a way to offset a path drawn? Or if there is a way to read the SVG and break it up into each individual element and work with?
When using firebug or chrome, they show me the individual element with correct sizes, but they are placed with lots of white space because of position of the paths drawn in Illustrator.
I've tried contentDocument
, documentElement
and both of these come up as null. Maybe I'm using them wrong?
I'm a heavy Actionscript developer, and now working with Javascript and jQuery so I'm use to x,y coord system and placing elements, but this is not seeming the way it should work :/