开发者

Exporting pages as png with InDesign Server

Is there a way to export a page as a png with InDesign server?

The following code works for a text frame. How do I do the same for the complete page contents?

var theDocument = app.documents.add();
var thePage = theDocument.pages[0];
var theTextFrame = thePage.textFrames.add();
theTextFrame.geometricBounds = [5,5,40,40];
theTextFrame.contents = TextFrameContents.placeholderText;
theTextFrame.exportFile(ExportFormat.pngFormat, File(开发者_高级运维"c:\\test.png"));


if you can export as JPG, something like this should work:

//set which page you want to export:
app.jpegExportPreferences.pageString='1';

//export that page from the document:
var myFile = new File('C:/test.jpg');
theDocument.exportFile(ExportFormat.JPG, myFile);

I'm not sure if setting the jpegExportPreferences.pageString would still work or not with exporting as a PNG, but you might be able to test that. Hopefully this at least gets you on the right track!

Note that if you want to export as a PNG, use this export format:

ExportFormat.PNG_Format

EDIT:

Looking at this article from the Adobe Forums, it states that InDesign can export as PNG but doesn't include any options, so it has limitations other than specifying the format. So, if the above code example won't help, maybe try something like this:

app.activeDocument.selection[0].exportFile(ExportFormat.PNG_FORMAT, File(new File("c:\\test.png")));

Hope this helps!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜