Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 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!

like image 950
aren55555 Avatar asked Sep 08 '11 18:09

aren55555


1 Answers

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.

like image 93
MatsT Avatar answered Oct 13 '22 01:10

MatsT