aren55555 aren55555 - 25 days ago 4x
Ruby Question

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 document (company name, project name, etc) that need to be filled in.

I was wondering if there is a way to take an exisitng template and maybe progrmatically 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 programatically building InDesign documents or know of any tutorials that would be much appreciated.

PS. 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:

  1. It's nowhere near as easy as just making some text modifications, you would have to figure out more about the format, and
  2. 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.