3 Replies Latest reply on Apr 23, 2015 2:25 PM by Capital Mailing Services

    DataMerge to a pdf not in memory InDesign(cc2014) JavaScript

    Capital Mailing Services

      I am having an issue with the file merging in ram not to a pdf document.


      When I am merging 20 thousand records having it merge in ram not only takes for ever it some times runs out of ram.


      any ideas? This is my Current code.


                    var jobNumber = prompt("what is your job number");

                   // Setting the Folder to get the indesign and the Data File file from.

                  var myTemplateFolder = Folder("~/Documents/hotfolder/template/");

                  var myDataFolder = Folder ("~/Documents/hotfolder/data/");

                  // Retrieving the Indesign FIle

                  var myTemplates = myTemplateFolder.getFiles("*.indd");

                  var myDataSet = myDataFolder.getFiles("*.csv");

                  //Open the Template and Declare its value of myDocument

                  var myDocument = app.open(File( myTemplates ));

                  // Turning on the BackGround Layer For Proofing

                  var myLayer = app.documents.item(0).layers.item("Background");

                  myLayer.visible = false ;

                  //Setting the data source to be merged    


                  // Merging the Records and creating the overset text document to make sure nothing is wrong with the file.     

                  myDocument.dataMergeProperties.mergeRecords(File("~/Documents/hotfolder/output/"+ jobNumber+"-composedoverset.txt"));

                  //close the unmerged document.     


                  //Exporting the merged document as composed file

                  app.activeDocument.exportFile(ExportFormat.pdfType, File("~/Documents/hotfolder/output/"+ jobNumber+"-composed.pdf"),false,"bandwPrinting");

                  //Closing the merged document.