Skip to main content
Inspiring
June 23, 2014
Question

"width" and "height" attributes not included on svg export

  • June 23, 2014
  • 2 replies
  • 630 views

Hello,

When exporting svg files through scripting, Illustrator CC includes the viewBox attribute in the <svg> tag – but not width and height. This makes display inconsistent and problematic in web browsers.

Is there a way to include width and height attributes when exporting from Illustrator CC? CS6 did it automatically.

This topic has been closed for replies.

2 replies

Doug A Roberts
Community Expert
Community Expert
May 8, 2024

If you uncheck 'Responsive' in the export options, width and height should be included.

If this doesn't work for you, please share an example file along with the exact export options you used.

Participating Frequently
May 13, 2024

After a long search I've found that my document i'm trying to `exportFile()` is a so called "large scale canvas". And there is a bug in `exportFile()` where it fails on a "large scale canvas" with the error code: "opperation not supported on this object".

Source: https://community.adobe.com/t5/illustrator-discussions/exporting-selected-objects-to-dxf/m-p/9790603#M91377

Participating Frequently
May 13, 2024

Unfortunately there is no way to change the canvas size of a document. I'll have to create a new document and copy paste my artwork to that document in order to use `exportFile()` (with `ExportOptionsWebOptimizedSVG`).

The facts that all this is not properly documented makes it very frustrating scripting anything for adobe applications.

Participating Frequently
May 8, 2024

I have the same issue. Does anyone have a solution for this?