Skip to content

Instantly share code, notes, and snippets.

@anandkunal
Created March 8, 2010 07:51
Show Gist options
  • Save anandkunal/324979 to your computer and use it in GitHub Desktop.
Save anandkunal/324979 to your computer and use it in GitHub Desktop.
total_pages = 68;
full_document_path = "~/Project/Assets/catalog.pdf";
full_output_path = "~/Project/Assets/jpg/";
function open_document(page) {
FileReference = new File(full_document_path);
PDFOpenOptions = new PDFOpenOptions();
PDFOpenOptions.page = page;
PDFOpenOptions.resolution = 72;
app.open(FileReference, PDFOpenOptions);
}
function save_document(page) {
jpgFile = new File(full_output_path + page + ".jpeg");
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.quality = 12;
app.activeDocument.saveAs(jpgFile, jpgSaveOptions, true, Extension.LOWERCASE);
}
function close_document() {
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}
for (i=1; i<=total_pages; i++) {
open_document(i);
save_document(i);
close_document();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment