How to use "Export As" option for SVG conversion in Illustrator Script

Viewed 34

I am trying to write a script for illustrator that will export my Ai into SVG. But my problem is when i use the exportFile() function its just export the files like how a File > Save as > SVG option would save the file. But what I am really trying to figure out is how I can use the File > Export > Export as > SVG to save my files.

I am using this file as my test file, and using Save as option gives me around 1.5MB of file size and Export as gives me around 800KB. I need this exact SVG options when converting the fileenter image description here

and this is the code I am using right now

var exportOptions = new ExportOptionsSVG();

exportOptions.cssProperties = SVGCSSPropertyLocation.STYLEATTRIBUTES;
exportOptions.optimizeForSVGViewer = true;
exportOptions.embedRasterImages = true;

app.activeDocument.exportFile(File("~"), ExportType.SVG, exportOptions);

Can anyone please help me with how I can get this done? Or any other useful ways or tips would be really appreciated. Thanks in advance.

0 Answers
Related