• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

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

Explorer ,
Jun 23, 2014 Jun 23, 2014

Copy link to clipboard

Copied

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.

TOPICS
Scripting

Views

456

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Beginner ,
May 08, 2024 May 08, 2024

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 08, 2024 May 08, 2024

Copy link to clipboard

Copied

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 08, 2024 May 08, 2024

Copy link to clipboard

Copied

I'm using the `app.activeDocument.exportFile()` API. `ExportOptionsSVG` does not seem to have a "responsive" option that I can set to `false`?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 08, 2024 May 08, 2024

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 08, 2024 May 08, 2024

Copy link to clipboard

Copied

Thank you for the link.

Still struggeling to use `app.activeDocument.exportFile()` together with `ExportType.WOSVG` and `ExportOptionsWebOptimizedSVG` though. 

Getting a "opperation not supported on this object" error.

Example code:
```

var exportOptions = new ExportOptionsWebOptimizedSVG();
exportOptions.svgResponsive = false;
exportOptions.artboardRange = 1;

var fileSpec = new File('test.svg');

app.activeDocument.exportFile(fileSpec, ExportType.WOSVG, exportOptions);
``` 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 13, 2024 May 13, 2024

Copy link to clipboard

Copied

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...

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
May 13, 2024 May 13, 2024

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines