Copy link to clipboard
Copied
hello !
so yes AT LEAST adobe wake up and now include a much more debuged SVG export from illustrator
so now fonts are referenced correctly, bold /italic are working, colored text is better, and SVG size is down !
the famous useless [header enable-background=] and [xml:space="preserve"] are gone
text styles are defined ONCE at the beginning
text special caracters are handled better
how to use them from Menu :
-the old svg : file -> save as -> svg
-the new svg (web) : file -> export -> svg
thanks to ExtendScript toolkit, i was able to parse the function and method for this new export.
option "ExportOptionWebOptimizedSVG" has many methods.
NB : svgResponsive is now present, so easy to disable it. this method does not exist in the old svg...
to use the new SVG export in script, use the usual fonction doc.exportFile(targetFile, ExportType.WOSVG, options);
here are detail about this new export type:
ExportType.WOSVG (Read Only)
Data Type: int, Value: 10
Adobe Illustrator 19 Type Library
Web Optimized SVG export file format.
all the methods are bellow :
here is a real sample, that export in the old svg format. you have to adapt it to the new one :
/** Returns the options to be used for the generated files.
@return ExportOptionsSVG object
*/
function getOptions(images)
{
// Create the required options object
var options = new ExportOptionsSVG();
// See ExportOptionsSVG in the JavaScript Reference for available options
// Set the options you want below:
// For example, uncomment to set the compatibility of the generated svg to SVG Tiny 1.1
options.DTD = SVGDTDVersion.SVG1_1;
// For example, uncomment to embed raster images
options.embedRasterImages = images;
options.compressed = false;
options.coordinatePrecision = 1;
options.documentEncoding = SVGDocumentEncoding.ASCII; //obligatoire, pas utf8!!!
options.fontSubsetting = SVGFontSubsetting.None;
options.fontType = SVGFontType.SVGFONT;
options.cssProperties = SVGCSSPropertyLocation.PRESENTATIONATTRIBUTES;
options.sVGAutoKerning = true;
options.sVGTextOnPath = false;
return options;
}
// Get the SVG options to be used.
options = this.getOptions(this.resDial[0]);
// You can tune these by changing the code in the getOptions() function.
// Get the file to save the document as svg into
//alert("linkedname " +linkedname);
targetFile = this.getTargetFile(linkedname, '.svg', destFolder);
// Save as SVG
//alert("targetFile " +targetFile);
sourceDoc.exportFile(targetFile, ExportType.SVG, options);
other thing : can someone explain me how to run a javascript in debug mode with this "extendScript tool"... does not work anymore with illustrator 2015!
fred
Copy link to clipboard
Copied
Thanks for sharing! As for the debug in the toolkit, I have had some mixed results - I believe on windows in CC2015, my ESTK completely stops when it is told to do any $ debugging such as $.writeln() and when there's a breakpoint. But I think it still does work on Mac, but then there's the problem of the ESTK being laggy and nearly unusable starting with OS Yosemite.