Is there a way to export an artboard as an svg but only the contents of that artboard and nothing else on the canvas/other artboards?
I had a look and seems like other people have has this issue?
Would a solution be to remove all objects/artboards except the contents of the artboard needed first?
Thanks in advance!
// Get the active document
var doc = app.activeDocument;
// Loop through all artboards in the document
for (var i = 0; i < doc.artboards.length; i++) {
var artboard = doc.artboards[i];
// Check if the artboard's name is "Backprint"
if (artboard.name == "Backprint") {
// Set the artboard as the active artboard by its index
doc.artboards.setActiveArtboardIndex(i);
// Get the current document's name
var docName = doc.name.split(".")[0];
// Set the export options
var exportOptions = new ExportOptionsSVG();
exportOptions.embedRasterImages = true;
exportOptions.embedAllFonts = true;
exportOptions.coordinatePrecision = 7;
exportOptions.minify = false;
exportOptions.cssProperties = SVGCSSPropertyLocation.STYLEELEMENTS;
exportOptions.fontType = SVGFontType.SVGFONT;
// Set the file name
var fileName = docName + "_Backprint";
// Get the current file's path
var filePath = doc.path;
// Export the artboard
doc.exportFile(new File(filePath + "/" + fileName), ExportType.SVG, exportOptions);
// Exit the loop
break;
}
}