【发布时间】:2018-01-06 06:11:41
【问题描述】:
在 Illustrator CS6 中,我想将所有选择导出到每个 SVG 文件。 我的顺序是这样的。
- 制作临时文档,使用
documents.addDocument()方法 - 将
ith 选择复制到临时文档。 - 使用
document.exportFile()方法导出为SVG文件。 - 使用
document.close()方法关闭临时文档。
但 Illustrator 在到达序列 4 时崩溃。 有什么问题?
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
}
*导出目录存在且为空。
【问题讨论】:
标签: scripting adobe-illustrator