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.
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;
//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)
Thanks Harbs. We are looking at full automation and so removing the pages manually is not an option. But I did find a script at InTools http://in-tools.com/article/scripts-blog/script-of-the-day-jan-24-2010/ that helps with automating the removal of empty pages. This script appears to be a nice workaround for server side usage. I used it on my document with multiple column text frames and it is removing the empty page as expected. If there is a better way to do this, let me know. Thanks.