在Illustrator CS6中,我想将所有选择导出到每个SVG文件。 我的序列是这样的。
documents.addDocument()
方法i
个选项复制到临时文档。document.exportFile()
方法导出为SVG文件。document.close()
方法关闭临时文档。但是当到达序列4时,Illustrator崩溃了。 有什么问题?
var sel = activeDocument.selection;
var arr = new Array;
for(var i=0;i<sel.length;i++)
{
arr.push(sel[i]);
}
var preset = new DocumentPreset;
var option = new ExportOptionsSVG;
option.compressed = false;
option.fontType = SVGFontType.OUTLINEFONT;
for(var i=0;i<arr.length;i++)
{
doc = app.documents.addDocument(i,preset); //sequence 1
var item = arr[i].duplicate(); //sequence 2
item.move(doc,ElementPlacement.PLACEATEND);
expFile = new File("C:\\Users\\user\\Documents\\font project\\svg\\" + i);
doc.exportFile(expFile,ExportType.SVG,option); //sequence 3
doc.close(); //sequence 4 and it occurs crashes
}
*导出目录存在且为空。
答案 0 :(得分:0)
我刚刚在Illustrator CC 2017中运行您的代码,它运行正常。可能是旧版本的Illustrator有一些问题。为什么不切换到最新版本的Illustrator?现在我没有CS6,但我也会尝试使用CS6并让你知道。