SVG output is wrong size
I have to create SVG files for work, and they MUST have specific dimensions. I've been using Ai 2023 with zero problems. When I "View SVG Code" the width, height, and viewBox values are all correctly set to the size of the artboard.
I've been avoiding upgrading for obvious reasons, but the other day I decided to try out Ai 2026. Thank GOD I installed a new instance and kept 2023! I had to generate an SVG and the size is WRONG. It appears to be using the OBJECT size, not the ARTBOARD size as it should.
I tried changing CSS Properties, the only one that produces the CORRECT dimensions is "Style Attributes (Entity References) -- WHICH WILL BE REMOVED IN THE FUTURE.
I'm on Windows 10, in case that matters.
Attached are text files with code produced, and screenshots of the options.
-
OK, this is odd. According to the team, in version 30.6 an issue was introduced with incorrect viewBox parameters — but this should have been fixed in 30.7 (and it works as it should in 30.5)....
Could you please record a small video with you trying to reproduce it, with the Help > About Illustrator briefly shown, with the clear steps taken? -
So it’s 900×450, right? X goes before Y :)
Indeed, I created my test objects smaller than the artboard. But Even when I create one to have the exact width as the artboard or a wider one even, the height of the SVG remains correct.(Edited by admin) -
Sketch
commented
@Egor
Had a thought. Did you use an object smaller than your artboard?
My artboard is 450x900. The object on it was 900 wide, but only 200 something tall. So the SVG was taking the size of the object instead of the artboard as it should. -
Sketch
commented
@Egor
I am already running 30.7. That is the version I installed that introduced the problem. -
@Sketch, it seems like the latest 30.7 doesn’t have the problem — at least I failed to have the wrong size when tried the same settings. Can you update and check, please?
-
I can reproduce this in GA 30.6, but not in the latest Beta 30.8.0.54 with the options shared: the width and the height of the <svg> hugs a test object within the file in GA, but follows the artboard in Beta.
In both cases the Use Artboards option in the Save a Copy dialog is disabled. -
Sketch
commented
AI file attached. Had to remove the object layer as it contains private info.
-
@Sketch, can you please also share the original .ai file you used to generate these?