Hello Experts: I have a function to create a JPEG file given a page number from a multipage document. The problem is that InDesign Server will actually create JPEG files for all the pages -despite the given page range (I just want to create one). It appends the page number starting on page 2 (and will create the JPEG's desired file name for the first page in the document, and so on)
Here is my sample code:
Somewhere I will initialize the document to use it globally:
app.open(File(inDocumentPath));
currentDocument = app.documents[0];
Here is my current function:
function ExportAsQualityJPG(inSaveAsDocumentPath, inPageNumber)
{
app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.maximum;
app.jpegExportPreferences.resolution = 300;
pageName = currentDocument.pages.item(inPageNumber-1).name;
app.pdfExportPreferences.pageRange = pageName;
// app.jpegExportPreferences.pageString = pageName; --> Does not work
currentDocument.exportFile(ExportFormat.jpg, File(inSaveDocumentPath), app.pdfExportPresets.item("[High Quality Print]"));
}
I will do something like later:
ExportAsQualityJPG("//Documents/InDesign/Page2.jpg", 2);
As I mentioned above, it will actually create images for all pages in the document. For example, if the INDD doc has 3 pages, it will create these images:
Page2.jpg (actual page 1)
Page22.jpg (actual page 2)
Page23.jpg (actual page 3)
Any help or tip would be really appreciated.
Thanks,
G.O.
Here is my sample code:
Somewhere I will initialize the document to use it globally:
app.open(File(inDocumentPath));
currentDocument = app.documents[0];
Here is my current function:
function ExportAsQualityJPG(inSaveAsDocumentPath, inPageNumber)
{
app.jpegExportPreferences.jpegQuality = JPEGOptionsQuality.maximum;
app.jpegExportPreferences.resolution = 300;
pageName = currentDocument.pages.item(inPageNumber-1).name;
app.pdfExportPreferences.pageRange = pageName;
// app.jpegExportPreferences.pageString = pageName; --> Does not work
currentDocument.exportFile(ExportFormat.jpg, File(inSaveDocumentPath), app.pdfExportPresets.item("[High Quality Print]"));
}
I will do something like later:
ExportAsQualityJPG("//Documents/InDesign/Page2.jpg", 2);
As I mentioned above, it will actually create images for all pages in the document. For example, if the INDD doc has 3 pages, it will create these images:
Page2.jpg (actual page 1)
Page22.jpg (actual page 2)
Page23.jpg (actual page 3)
Any help or tip would be really appreciated.
Thanks,
G.O.