0

I have one Adobe Indesign indd file which I need to merge data (MailMerge).
I use Adobe InDesign Server 5.5 to run below InDesign script.

var _Path_INDD = "/c/ServerTestFiles/Dummy/Template.indd";
var _Path_CSV = "/c/ServerTestFiles/Dummy/Input.csv";
var _Path_PDF = "/c/ServerTestFiles/Dummy/Output.pdf";

var myDocument = app.open(File(_Path_INDD), OpenOptions.OPEN_COPY);     
var myDataSource = File(_Path_CSV);     
myDocument.dataMergeProperties.selectDataSource(myDataSource);
myDocument.dataMergeProperties.mergeRecords();
app.documents.item(0).exportFile(ExportFormat.pdfType, File(_Path_PDF),     app.pdfExportPresets.item("[Press Quality]"));

It run and give me PDF file as I wanted.

But my problem is performance. It takes 10 seconds to generate a PDF file by using single line of CSV file. So If my CSV is 100k lines, then it will be take more than 10 days to finish that process.

It is so funny. But I still don't know how to make more faster performance when it come to InDesign script.

Could anyone give me suggestion please?

Mark Amery
  • 143,130
  • 81
  • 406
  • 459
Frank Myat Thu
  • 4,448
  • 9
  • 67
  • 113
  • Since you posted this to other groups like performance and pdf-generation I will offer a comment. Stop using a monolithic, non-performing application like InDesign which is not really meant to run on a server and implement a solution for server-side rendering of documents like this. I would suggest that if this is a simple mail merge, then you could do so in an XSL FO rendering solution at 100-200 pages/second. 10 minutes to format the letters, not 10 days. – Kevin Brown Aug 24 '13 at 05:49

1 Answers1

0

I tested this script (with a bit fix) on CS5 Jp version (not ID Server) / OSX 10.7

here is a question, taking 10sec include data merging? or only exporting pdf? can you use asynchronousExportFile() method? this exports pdf X4 faster for me.

// ~> DATA MERGING HERE

var s1 = new Date().getTime();
myDocument.exportFile(ExportFormat.pdfType, File(_Path_PDF), false, app.pdfExportPresets.item("[プレス品質]"));
$.writeln(new Date().getTime() - s1); // -> 399

var s2 = new Date().getTime();
myDocument.asynchronousExportFile(ExportFormat.pdfType, File(_Path_PDF2), false, app.pdfExportPresets.item("[プレス品質]"));
$.writeln(new Date().getTime() - s2); // -> 108
milligramme
  • 404
  • 3
  • 9
  • Thank you for your suggestion, I do appreciate. – Frank Myat Thu Aug 23 '13 at 04:51
  • But I have one issue after when i use `asynchronousExportFile` function.I got error which say `Error number: 54 Uncaught JavaScript exception: ReferenceError: app.documents.item().asynchronous ExportFile is not a function` – Frank Myat Thu Aug 23 '13 at 04:53