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:
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?
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
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?
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")
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
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!
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
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/
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Also, to give credit where credit is due, I believe this is based on Jongware's old website.
Copy link to clipboard
Copied
Exactly @femkeblanco Jongware's was the first I ever saw.
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.
Copy link to clipboard
Copied
Oops! @Mike Bro thanks for the useful post! - Mark
Copy link to clipboard
Copied
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 )
Copy link to clipboard
Copied
Glad to see you found your own answer Ben