Export all pages to JPG
Hi friends
I use to write scripts for Photoshop, Bridge and Illustrator. But it´s my firt time writting scripts to Adobe InDesign (and my first to this forum too). I´m accustomed with the JavaScript referece document of that 3 softwares, so I´m getting a direct help via the "Object Model Viewer" inside Extended Script Toolkit for writting with InDesign.
I want to export all the pages of my document using JPG as file format. So I set the properties to an instance of JPEGExportPreference and would like to use this configuration to export all the pages. Am I right to use the method app.activeDocument.exportFile() ??
Because I did not find a place to declare the method to read my JPG preference. It´s also getting an error page range was not set. Could you analyse my code and see what I´m missing?
Thank you very much:
var myDoc = app.activeDocument;
var fName = myDoc.name.slice (0, myDoc.name.lastIndexOf ("."));
var oFolder = new Folder (myDoc.filePath + "/" + fName + " (Exported)");
if (! oFolder.exists){
oFolder.create();
};
var fOutput = new File (oFolder + "/" + fName + ".jpg");
var opJPG = new JPEGExportPreference();
opJPG.antiAlias = true;
opJPG.embedColorProfile = true;
opJPG.exportResolution = 300;
opJPG.jpegColorSpace = JpegColorSpaceEnum.RGB;
opJPG.jpegExportRange = ExportRangeOrAllPages.EXPORT_ALL;
opJPG.jpegQuality = JPEGOptionsQuality.HIGH;
opJPG.jpegRenderingStyle = JPEGOptionsFormat.BASELINE_ENCODING;
opJPG.simulateOverprint = true;
opJPG.useDocumentBleeds = false;
myDoc.exportFile(ExportFormat.JPG, fOutput, false);
