使用 InDesign Server 将页面导出为 png
有没有办法使用 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"));
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"));
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您可以导出为JPG,类似这样的东西应该可以工作:
我不确定设置
jpegExportPreferences.pageString
是否仍然可以导出为PNG,但是你也许可以测试一下。希望这至少能让您走上正轨!请注意,如果您想导出为 PNG,请使用以下导出格式:
编辑:
查看 这篇来自 Adobe 论坛的文章,它指出 InDesign 可以导出为 PNG,但不包含任何选项,因此它除了指定格式之外还有其他限制。因此,如果上面的代码示例没有帮助,也许可以尝试这样的事情:
希望这有帮助!
if you can export as JPG, something like this should work:
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:
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:
Hope this helps!