【发布时间】:2018-09-18 14:04:54
【问题描述】:
我正在尝试与 InDesign Server 进行非常基本的数据合并,但一直出现崩溃。
我以./InDesignServer -port 18383 开头的服务器没有问题。
我用./sampleclient ./scripts/test.jsx 调用脚本
.jsx 看起来像这样:
var source = File("/Users/me/Desktop/InDesign Server/example/example.indd")
var destination = File("/Users/me/Desktop/InDesign Server/example/example.pdf")
var sourceData = File("/Users/me/Desktop/InDesign Server/example/example.csv")
var doc = app.open(source);
doc.dataMergeProperties.selectDataSource(sourceData);
doc.dataMergeProperties.dataMergePreferences.recordNumber = 1;
doc.dataMergeProperties.mergeRecords(); // <-- Crashes here
var myPDFExportPreset = app.pdfExportPresets.item(0);
app.documents.item(0).exportFile(ExportFormat.pdfType, destination, false, myPDFExportPreset);
app.documents.item(0).close(SaveOptions.no);
doc.close(SaveOptions.no);
InDesign Server 响应:
Tue Sep 18 09:48:21 2018 INFO [javascript] Executing Script
./InDesignServer: line 13: 30363 Segmentation fault: 11 "$installed_name" "$@"
然后崩溃。该脚本在 InDesign CC Desktop 中运行良好。服务器似乎在 .mergeRecords() 调用上崩溃。任何想法为什么?
编辑:我已将代码修改为 1) 文件路径中没有空格 2) 在执行合并之前检查我的对象是否全部存在。
var source = File("/Users/me/Desktop/example/example.indd");
var destination = File("/Users/me/Desktop/example/example.pdf");
var sourceData = File("/Users/me/Desktop/example/example.csv");
var doc = app.open(source);
doc.dataMergeProperties.selectDataSource(sourceData);
if (source.exists && destination.exists && sourceData.exists) {
try {
app.consoleout("Performing merge...");
doc.dataMergeProperties.mergeRecords(); // <-- Crashes here
} catch (err) {
app.consoleout(err);
}
} else {
app.consoleout("Something doesn't exist...");
}
它记录“正在执行合并...”,因此我的文件路径确实指向存在的文件。更重要的是,它充满了崩溃,并且不报告任何错误。
编辑 2:
需要注意的是,这是启动 sampleclient 的终端窗口从 IDS 得到的错误:Error -1 fault: SOAP-ENV:Client [no subcode]
"End of file or no input: Operation interrupted or timed out"
Detail: [no detail]
【问题讨论】:
-
可能是文件路径的问题。如果 sourceData 存在,请在脚本中测试。我在服务器上指定了完整路径。
-
检查是否需要转义路径中的空格字符。使用前检查所有对象是否有效
-
文件路径没问题。首先,我切换到 HFS(不是 POSIX),仍然在桌面上工作,仍然崩溃服务器。我在那里放了一个 if(),source.exists && destination.exists && sourceData.exists,它通过了这些测试,控制台输出“所有文件都存在”。 @NicolaiKant 你的文件是如何定位的,你使用的是什么类型的路径?
-
尝试包含完整路径,例如“/Macintosh HD/Users/me/Desktop/example/example.indd”。另外,尝试数据合并一个小文件,可能会在大文件上超时
-
没有骰子。我添加了 /Macintosh HD/ - 它在桌面上仍然可以正常工作,但会使服务器崩溃。我只是有一个带有 4 行单帧的文档。 CSV 只有 3 行 4 列和一些文本。我已经在 3 台不同的计算机(3 个单独的安装)上对此进行了测试,所有计算机都发生了相同的崩溃。 17行代码的一个令人费解的问题……
标签: adobe-indesign extendscript mailmerge indesign-server