2 Replies Latest reply on Nov 1, 2012 4:57 AM by Anand.

    InDesign server crashes every time when calling deleteEmptyPages in script

    Anand.

      We are evaluting InDesign Server CS6 on a Windows server environment. We have an idml file, sample xml file that is tagged to specific frames inside the idml file and a script file for execution on the server. This script opens the idml file using the app.open api, imports the xml file and export the ID file to a PDF. Because we have table content with variable row count, we are using the smart text reflow functionality. Setting the text preferences with smart text reflow appears to be working but we also want to delete the empty second page when the content is less than a page. So, we also tried using the deleteEmptyPages property document's textPreferences. When this is set to true and the script is executed on the ID server using the sampleclient, the server crashes with the following message. When I do the same thing in the InDesign UI using the preferences options, it works as expected.

      id-1.JPG

      id-2.JPG

      The script looks like below - is this the right way to do it?

       

      var myInddFile = app.scriptArgs.get("idfile"); //"X:/IDFiles/AutoFlow.indd";

      var myXmlFile = app.scriptArgs.get("xmlfile"); //"X:/IDFiles/deleteme.xml";

      var myOutputOptions = "[Smallest File Size]";

      var myPDFPreset = app.pdfExportPresets.itemByName(myOutputOptions);

       

      var myDoc = app.open (File(myInddFile), OpenOptions.OPEN_COPY);

      myDoc.xmlImportPreferences.ignoreWhitespace = true;

      myDoc.textPreferences.smartTextReflow = true;

      //myDoc.textPreferences.addPages = AddPageOptions.END_OF_STORY;

      //myDoc.textPreferences.limitToMasterTextFrames = true;

       

      myDoc.importXML (File(myXmlFile));

       

      //uncommenting this line causes the ID server to crash

      //myDoc.textPreferences.deleteEmptyPages = true;

       

      var myOutputFile = app.scriptArgs.get("outputfile");//File("X:/IDFiles/sampleX.pdf")

      myDoc.exportFile (ExportFormat.PDF_TYPE,myOutputFile, myPDFPreset)