Copy link to clipboard
Copied
I'm creating an HTML Panel Extension and want to query the Illustrator Canvas path data. The end goal is to automatically create an SVG of the illustrator file and port this onto the web. The Javascript API doesn't have an option to save an SVG file, so I'd like to find a way to access the algorithm used for saving an SVG file.
The user should not have to save out an svg file. It would be preferable to send the SVG data from .JSX to HTML/JS. If anyone can point me in the right direction or offer sample files, it'd be very much appreciated!
Hi,
you could export art to svg using extendscript.
Here is a sample (.jsx):
...
saveAsSVG: function (filePath) {
try {
var svgFile = new File(filePath);
var exportOptions = new ExportOptionsSVG();
exportOptions.embedRasterImages = ....;
exportOptions.embedAllFonts = ...;
exportOptions.fontSubsetting = SVGFontSubsetting.GLYPHSUSED;
exportOptions.fontType = SVGFontType.SVGFONT;
app.activeDocument.exportFile(svgFile, ExportType.SVG, exportOptions);
} catch (ex) {
Copy link to clipboard
Copied
Hi,
you could export art to svg using extendscript.
Here is a sample (.jsx):
saveAsSVG: function (filePath) {
try {
var svgFile = new File(filePath);
var exportOptions = new ExportOptionsSVG();
exportOptions.embedRasterImages = ....;
exportOptions.embedAllFonts = ...;
exportOptions.fontSubsetting = SVGFontSubsetting.GLYPHSUSED;
exportOptions.fontType = SVGFontType.SVGFONT;
app.activeDocument.exportFile(svgFile, ExportType.SVG, exportOptions);
} catch (ex) {
//do whatever you want!
}
}
you could even save selection or asset as svg.
Thomas.
Copy link to clipboard
Copied
Hi,
You mentioned that it can be used to save a selection, but how?
This example is exporting the whole document and I can't find any option for the selection...
Find more inspiration, events, and resources on the new Adobe Community
Explore Now