Importing SVG into Illustrator with proper viewBox size

When I try to open an svg file with Illustrator, Illustrator defaults to whatever artboard size was last used when a file was open. As such, the svg, if not the same size as the previous artboard, is then placed and auto-resized into that artboard.

Is there a workaround for this that does not involve opening a fake document with the artboard size of the svg, then closing that doc and File > Open the actual svg?

Note: I do not want to save the svg from Illustrator with the “preserve Illustrator editing capabilities” in the save as svg dialog.

You can test this with any svg, but here’s a super simple one that is 320 x 240:

<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0)  -->
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
     viewBox="0 0 320 240" enable-background="new 0 0 320 240" xml:space="preserve">
<rect width="320" height="240"/>
<text transform="matrix(1 0 0 1 98.6523 133)" fill="#FFFFFF" font-family="'ArialMT'" font-size="48">Why?</text>
</svg>

Answer

I found a kind of solution for this. When you save your SVG from Illustrator, you must uncheck the “responsive” option.

Illustrator doesn’t care about the viewBox property but does care about the width/height properties. When “responsive” is checked, the SVG element doesn’t have these properties, and that’s why it doesn’t take it into account when reopening the SVG.

Attribution
Source : Link , Question Author : stevedebrun , Answer Author : Lauren-Clear-Monica-Ipsum

Leave a Comment