InDesign Server Crashing on Data Merge

898 Views Asked by At

I'm trying to do a very basic data merge with InDesign Server and keep getting a crash. I begin the server with ./InDesignServer -port 18383 starts with no problems. I call the script with ./sampleclient ./scripts/test.jsx The .jsx looks like this:

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 responds with:

Tue Sep 18 09:48:21 2018 INFO   [javascript] Executing Script
./InDesignServer: line 13: 30363 Segmentation fault: 11  "$installed_name" "$@"

And crashes. This script runs perfectly fine in InDesign CC Desktop. Server appears to crash on the .mergeRecords() call. Any ideas why?

Edit: I've modified the code to 1) Have no spaces in the file path 2) check that my objects all exist before performing the merge.

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...");
}

It logs "Performing merge..." so my file paths do in fact point to files that exist. What's more, it full on crashes, and does not report any errors.

Edit 2: It should be noted, this is the error the Terminal window which launched sampleclient gets from IDS: Error -1 fault: SOAP-ENV:Client [no subcode] "End of file or no input: Operation interrupted or timed out" Detail: [no detail]

2

There are 2 best solutions below

1
On BEST ANSWER

The folks at Adobe took notice, and fixed this issue for the 2019 release of InDesign Server. The same script, with a similar merging document, no longer produces the error.

So, for a solution, update to 2019.

More information: Adobe Forums Post

0
On

Found a solution, if others find themselves in my situation. Still a mystery why mergeRecords() seems broken in Server.

doc.dataMergeProperties.exportFile()

Props to Colecandoo: https://forums.adobe.com/thread/2478708

My code is now:

var source = File("/Users/me/Desktop/example/example.indd");
var destination = File("/Users/me/Desktop/example/example.pdf");
var sourceData = File("Macintosh HD:Users:me:Desktop:example:example.csv");

var doc = app.open(source);
var myExport = File(doc.filePath + "/" + doc.name.split(".indd")[0] + ".pdf");  
doc.dataMergeProperties.dataMergePreferences.recordNumber = 3;
with (doc.dataMergeProperties.dataMergePreferences) {
   recordSelection = RecordSelection.ONE_RECORD;    
            }
   app.dataMergeOptions.removeBlankLines = true;  
                doc.dataMergeProperties.exportFile(myExport, "[High Quality Print]", ); 

Still takes some tweaking, but it's performing the merge - this is what I needed.