gpt4 book ai didi

indesign-server - 使用InDesign Server将页面导出为png

转载 作者:行者123 更新时间:2023-12-02 04:06:45 24 4
gpt4 key购买 nike

是否可以使用InDesign服务器将页面导出为png?

以下代码适用于文本框架。如何对整个页面内容执行相同操作?

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"));

最佳答案

如果您可以导出为 JPG ,则应该可以执行以下操作:

//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);

我不确定将 jpegExportPreferences.pageString设置是否仍然可以导出为PNG,但是您可以测试一下。希望这至少能使您走上正确的道路!

请注意,如果要导出为PNG,请使用以下导出格式:
ExportFormat.PNG_Format

编辑:

查看 this article from the Adobe Forums,它指出InDesign可以导出为PNG,但不包含任何选项,因此除指定格式外,它还有其他限制。因此,如果上述代码示例无济于事,请尝试执行以下操作:
app.activeDocument.selection[0].exportFile(ExportFormat.PNG_FORMAT, File(new File("c:\\test.png")));

希望这可以帮助!

关于indesign-server - 使用InDesign Server将页面导出为png,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7195570/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com