Programmatically Inserting Data into an InDesign Document
I have to use Adobe InDesign for creating documents. We basically need to have a couple variables throughout the doc开发者_C百科ument (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!
There is no (legal) way to do this in Ruby/Python. Theoretically it is possible to edit InDesign documents directly using any language but:
- It's nowhere near as easy as just making some text modifications, you would have to figure out more about the format, and
- It's in direct violation of the InDesign license agreement meaning you could face legal action if Adobe finds out.
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.
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.
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.
精彩评论