Problems with pageRange.allPages reliability...
Fair warning: I'm fairly new to this.
For some reason the code below isn't reliably exporting pages. My 4 page documents are set up as two sets of facing 8.5x11s (I'm creating spreads from pages 1-2 and 3-4). When I first run this script on a 4 page document, it will usually only export the first spread, pages 1 and 2. But then if I reopen the doc and run it again, it'll export both spreads, all 4 pages, 95% of the time. What have I done wrong to make this code so unreliable? Is there a particular reason that pageRange.allPages doesn't reliably export all pages? I'm having a hard time believing that it's the preset, but I could be wrong.
//Send To Print
var myPDFExportPreset = app.pdfExportPresets.item("TO-PRINT");
app.pdfExportPreferences.pageRange.allPages;
app.activeDocument.exportFile(ExportFormat.pdfType, File(printLoc +"/" + myDocumentName.substr(myDocument.name.indexOf("_") + 1) + ".pdf"), false, myPDFExportPreset);
Thanks!
