以编程方式将数据插入到 InDesign 文档中
我必须使用 Adobe InDesign 来创建文档。我们基本上需要在整个文档中有几个需要填写的变量(公司名称、项目名称等)。
我想知道是否有一种方法可以采用现有模板,并可能使用我的语言以编程方式填充这些变量熟悉(Ruby、Python 等)。我尝试使用文本编辑器打开 Adobe InDesign 文件 - 但是当我使用 Notepad++ 进行修改,然后在 InDesign 中打开该文件时,它告诉我该文件已损坏。
如果您对以编程方式构建 InDesign 文档有任何见解或了解任何教程,我们将不胜感激。
PS 我尝试查看 Adobe 的 ExtendScript,但没有找到太多适用于 InDesign 的文档。
感谢您的帮助!
I have to use Adobe InDesign for creating documents. We basically need to have a couple variables throughout the document (company name, project name, etc) that need to be filled in.
I was wondering if there is a way to take an existing template and maybe programmatically fill these in using a language I'm comfortable with (Ruby, Python, etc). I have tried to open the Adobe InDesign file using a text editor - but when I make modifications using Notepad++ and then open the file in InDesign, it tells me the file is corrupted.
If you have any insight with programmatically building InDesign documents or know of any tutorials that would be much appreciated.
P.S. I tried to check out Adobe's ExtendScript but wasn't finding much documentation applying to InDesign.
Thanks for the help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在 Ruby/Python 中没有(合法)方法可以做到这一点。理论上,可以使用任何语言直接编辑 InDesign 文档,但是:
ExtendScript 非常适合做这样的小事情。如果您打开 ExtendScript Toolkit 并将目标设置为 InDesign,您可以轻松浏览和搜索整个 API。对简单文本变量进行搜索/替换并不难。
另一种方法是将文档导出为
.idml
语言,这样在 InDesign 之外进行编辑更容易且合法。There is no (legal) way to do this in Ruby/Python. Theoretically it is possible to edit InDesign documents directly using any language but:
ExtendScript is perfect for doing small things like this. If you open up ExtendScript Toolkit and set the target to InDesign you can browse and search the entire API easily. Doing search/replace for simple text variables is not hard at all.
An alternative would be exporting the documents to the
.idml
language which is easier and legal to edit outside of InDesign.您可以使用 Indesign 的 DataMerge 功能 --> https://helpx.adobe.com/indesign/using/data-merge。 html
我认为这正是您正在寻找的。
或者您可以使用 Indesign API。查看 Extendscript-Toolkit,尤其是 ObjectModell-Viewer。
You can use the DataMerge-feature of Indesign --> https://helpx.adobe.com/indesign/using/data-merge.html
I think this is exactly what you are looking for.
Or you can use the Indesign API. Have a look at Extendscript-Toolkit especially the ObjectModell-Viewer.
您需要将 .indd 文件转换为 .idml 并将其解压缩。
在/Stories/Story_*.idml中,您可以找到所有文本变量。
如果没有 Adobe 产品,就没有简单的方法可以更改 .indd 中的文本变量。
You need to convert your .indd file to .idml and unzi it.
In /Stories/Story_*.idml you may found all text variables.
And no easy ways to change text variables in .indd without Adobe products.