11

I'm attempting to output an SVG from Illustrator. My artboard is 256x256 pixels. The top left of the artboard is at 0,0.

When I export my svg, the viewbox attribute is 0.5 792.5 256 256. Why isn't it 0 0 256 256?

All layers/paths/etc are within the 256x256 box. Nothing is outside of it.

Also, I just created a fresh 256x256 document and copy/pasted all my layers from the old file to the new one and the viewbox was 0 0 256 256 as expected. So what was it about the original file that was throwing in that offset in the viewbox?

Update: I just deleted all the layers except for one, and exported. The viewbox is now: 0.5 536.5 256 256, which still doesn't make sense. Especially since the artboard is empty now.

Here is the AI file if you want to look: https://www.dropbox.com/s/q0u6r46b3j9sefa/sprites-old.ai?dl=0

2
  • post the .ai, if possible. the graphics are irrelevant, you can remove them. ill try to enlighten you, to the best of my abilities.
    – PaulEffect
    Oct 6, 2014 at 10:03
  • I updated the question with a link to the .ai file. Oct 6, 2014 at 17:30

1 Answer 1

15

there's nothing wrong with the .ai you provided. i looked at it, spotted nothing wrong, I tried different export options, even resizing the artboard and moving it around.

I did some reading and it turns out Adobe did a half job when it included svg support. Adobe does not use svg viewboxes and offers no way to actually define a viewboxes coordinates.

What you experienced usually happens when you drag / resize artboards on a document. A number of people found themselves facing this issues and the only workaround seems to be exactly what you did. File -> New.

Another fix would be importing the svgs in Inkscape and exporting from there. But I think the file new is way faster.

I'm sorry I can't help you more, it's really up to Adobe to fix this.

PS: This question has some good answers.

1
  • 2
    That seems to be the conclusion I have come up with as well. Thank you! Oct 6, 2014 at 21:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.