如何解决Indesign 导出页面
我正在尝试导出文档页面。我在导出页面甚至导出文档页面的项目时都遇到问题
导出文档页面时:
app = win32com.client.dispatch("InDesign.Application.CS6")
doc = app.Documents(1)
app.jpegExportPreferences.exportResolution = 150
page = doc.Pages(1)
page.Export(1699761735,f'{folder_selected}/test.png')
ERROR
Traceback (most recent call last):
File "c:\Users\Sofia\Desktop\C.py",line 85,in <module>
page.Export(1699761735,f'{folder_selected}/test.png')
File "C:\Users\Sofia\AppData\Local\Programs\Python\python39\lib\site-packages\win32com\client\dynamic.py",line 511,in __getattr__
raise AttributeError("%s.%s" % (self._username_,attr))
AttributeError: <unkNown>.Export
导出页面项目时:
app = win32com.client.dispatch("InDesign.Application.CS6")
doc = app.Documents(1)
app.jpegExportPreferences.exportResolution = 150
page = doc.Pages(1)
items = page.PageItems(1)
items.Export(1699761735,f'{folder_selected}/test.png')
它工作正常,但它导出单个项目,我可以更改项目但我希望导出整个页面。
实际页面:
如果我导出为 PDF,它工作正常。但我想要 JPG 或 PNG 格式。请问有什么解决办法吗?
解决方法
你的意思是这样吗?
import win32com.client
from pathlib import Path
app = win32com.client.Dispatch('InDesign.Application.CS6')
indd_file = Path(r'd:\test.indd')
doc = app.Open(str(indd_file))
app.pngExportPreferences.exportResolution = 150
doc.Export(1699761735,indd_file.parent / (indd_file.stem + ".png"))
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。