Created
June 3, 2011 09:00
-
-
Save osima/1006079 to your computer and use it in GitHub Desktop.
export page as jpeg and return filename list as json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function(){ | |
| var exportPageAsJpeg = function( myDocument, myPage, myFilePath ){ | |
| app.jpegExportPreferences.pageString = myPage.name; | |
| myDocument.exportFile(ExportFormat.JPG, File(myFilePath), false); | |
| }; | |
| //var basePath = '${basePath}'; | |
| var basePath = Folder.desktop; | |
| var prefix = 'foo-'; | |
| var json = ''; | |
| json = json + '{jpgFilePathList:['; | |
| var myDocument = app.activeDocument; | |
| for(var myPageCounter=0; myPageCounter<myDocument.pages.length; myPageCounter++){ | |
| var myPage = myDocument.pages.item(myPageCounter); | |
| var myFilePath = basePath + '/' + prefix + myPageCounter + '.jpg'; | |
| exportPageAsJpeg( myDocument, myPage, myFilePath ); | |
| json = json + '"' + myFilePath + '",'; | |
| } | |
| json = json + ']}'; | |
| return json; | |
| })(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment