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

Scripting SVG Export: "Object IDs" and "Responsive" settings

Community Beginner ,
Jan 14, 2022 Jan 14, 2022

Copy link to clipboard

Copied

We're exporting some documents as SVGs using scripting, and are trying to match the export settings we use via the UI. The settings we need are:

Capture.PNG
But using the ExportOptionsSVG settings in our script, it seems that we're unable to set the "Object IDs" or "Responsive" settings to our required values.

Does anyone know if this is possible? We're looking into potentially using dynamic actions from our script, but this seems heavy-handed for what should just be some simple settings!

Also, are these the most up-to-date docs for the various API functions? Or are there some other official docs that we're missing somewhere?

TOPICS
Import and export , Scripting

Views

1.4K

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

correct answers 1 Correct answer

Community Beginner , Jan 14, 2022 Jan 14, 2022

We've made some progress with this. It turns out that there is also ExportOptionsWebOptimizedSVG and ExportType.WOSVG that we can use. This option class does have the svgResponsive property which seems to do what we need. It also seems to be doing "Object IDs = Layer Names" by default.

We pieced this together from some info in this post as well as some related docs for the ExportForScreensOptionsWebOptimizedSVG object buried in this post .

So the question now is, is this a valid approach or is the

...

Votes

Translate

Translate
Adobe
Community Beginner ,
Jan 14, 2022 Jan 14, 2022

Copy link to clipboard

Copied

We've made some progress with this. It turns out that there is also ExportOptionsWebOptimizedSVG and ExportType.WOSVG that we can use. This option class does have the svgResponsive property which seems to do what we need. It also seems to be doing "Object IDs = Layer Names" by default.

We pieced this together from some info in this post as well as some related docs for the ExportForScreensOptionsWebOptimizedSVG object buried in this post .

So the question now is, is this a valid approach or is there some reason we shouldn't be using these undocumented settings?

cc @CarlosCanto here because you published the "What's New in Illustrator Scripting CC2018" post mentioned above. Thoughts?

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 ,
Jan 14, 2022 Jan 14, 2022

Copy link to clipboard

Copied

Working export code for reference:

function exportFileAsSvg(path) {
    const options = new ExportOptionsWebOptimizedSVG();
    options.compressed = false;
    options.coordinatePrecision = 3;
    options.cssProperties = SVGCSSPropertyLocation.PRESENTATIONATTRIBUTES;
    options.fontSubsetting = SVGFontSubsetting.None;
    options.fontType = SVGFontType.SVGFONT;
    options.svgResponsive = false;

    app.activeDocument.exportFile(new File(path), ExportType.WOSVG, options);
}

exportFileAsSvg("X:\\foo.svg")

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 ,
Jan 14, 2022 Jan 14, 2022

Copy link to clipboard

Copied

Hi @Ben Vosper, here's a link to ExportOptionsWebOptimizedSVG and ExportForScreensOptionsWebOptimizedSVG. Bookmark this site for latest API entries (you'll need the current one also—this only has the new stuff).

- Mark

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 ,
Jan 14, 2022 Jan 14, 2022

Copy link to clipboard

Copied

@m1bAmazing, thanks! Are these docs you maintain yourself or are they an offical Adobe resource? Just wondering if they're linked from anywhere!

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 ,
Jan 14, 2022 Jan 14, 2022

Copy link to clipboard

Copied

No I don't maintain them and they aren't official adobe. I only just found the site thanks to CarlosCanto! Thank you Carlos!

 - Mark

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 ,
Jan 14, 2022 Jan 14, 2022

Copy link to clipboard

Copied

I think Charu or Femke posted that link Mark. I posted the official guides at the new https://developer.adobe.com/

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 ,
Jan 14, 2022 Jan 14, 2022

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
Guide ,
Jan 14, 2022 Jan 14, 2022

Copy link to clipboard

Copied

Also, to give credit where credit is due, I believe this is based on Jongware's old website. 

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 ,
Jan 14, 2022 Jan 14, 2022

Copy link to clipboard

Copied

Exactly @femkeblanco Jongware's was the first I ever saw.

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 ,
Jan 15, 2022 Jan 15, 2022

Copy link to clipboard

Copied

you might be correct @femkeblanco, I also remember jongware's being the first, or at least the first I saw.

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 ,
Jan 14, 2022 Jan 14, 2022

Copy link to clipboard

Copied

Oops! @Mike Bro thanks for the useful post! - Mark

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 ,
Mar 30, 2022 Mar 30, 2022

Copy link to clipboard

Copied

LATEST

Just to make it clear for readers here who did not read into the links Mark offers. This was done by Gregor Fellenz.  Currently it's showing the state of the DOM of Illustrator version 25:

https://www.indesignjs.de/extendscriptAPI/illustrator-latest/#about.html

 

Regards,
Uwe Laubender

( ACP )

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 ,
Jan 14, 2022 Jan 14, 2022

Copy link to clipboard

Copied

Glad to see you found your own answer Ben

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