//the export pixel width var targetWidthPixels = 1000; var doc = app.activeDocument; with(doc.viewPreferences){ horizontalMeasurementUnits = MeasurementUnits.INCHES; verticalMeasurementUnits = MeasurementUnits.INCHES; } //get the page width in inches var pw=doc.documentPreferences.pageWidth; //calulate the resolution needed to export the jpeg as 1500px wide //if the page is 8.5" x 11", the output pixel dimensions will be 600px x 776px var resout= targetWidthPixels/pw; //the active page var pg="Print:3"; //set the res preference and page range with(app.jpegExportPreferences){ exportResolution = resout; pageString = pg; antiAlias = true; embedColorProfile = true; jpegColorSpace = JpegColorSpaceEnum.RGB; //add other properties as needed } //export the JPEG doc.exportFile( ExportFormat.jpg, File("target" + doc.name.substring(0,13) + ".jpg"), false );