Indesign (IDML file) Automation using HTML5 and Javascript

3.1k views Asked by At

I’m working on IDML file automation. My requirement is to showcase an IDML template in an HTML5 editor.

I have a simple TextFrame with Hello World text. I saved the file as: sample.idml. Then, I unzipped sample.idml and got a few files. Went to the stories folder and opened: story_d8.xml.

Since I’m a developer, I did this using Java and exposed the file path as a REST call. The biggest stopping point is: the jQuery/AngularJS script is saying: invalid file.

Can someone suggest options to address the points below:

  1. Get Content data using JavaScript (jQuery/AngularJS)

  2. Put "Demo Hello" in the Content and regenerate story_d8.xml (using JavaScript)

  3. Is this the correct approach? Are there alternative to this approach?

2

There are 2 answers

0
PRB On

Old question but I'll answer it for others.

A1) It's plain XML, so you should be able to just stream it out like any other file. Once you get it, you'll need to parse it using jquery. Then you can walk the tree and find the node you are looking for. If you only have one node in each story file, then you could just parse it out yourself using a regular expression. But it sounds like you don't want all of it on the client, just the data in certain fields - so just let Java parse the data out and just send it to the client app.

A2) You could update the XML using JavaScript, but you are going to have to send it back to the midtier in order to save it back into the IDML file anyway, so I'd just send the data to the server and let the server handle it. Java would be fine for that.

A3) Well, without knowing exactly what you are trying to accomplish, I would suggest doing everything you can server-side. You mentioned needing to provide an "HTML5 Editor" for IDML files. That, in itself, is a huge request to do it from scratch, although it is possible. I would suggest you look at one of the several products out there that can maintain IDML files via a web page (using a Flash/Flex client)

A few (very expensive) examples of 3rd party products you can use maintain/view IDML online, could be Adobe InDesign Server SDK or NXPublisher.

My project was to create IDML files based on IDML templates from data someone entered into a webpage. I handled it like this:

  • User entered in form data
  • Data sent to server
  • Server unzips appropriate IDML template file into a new temporary folder
  • Server opens up extracted story files and does a search and replace for predefined keywords (like {{first_name}} inside a <content> tag) and then replaced that text with what the user provided.
  • Repeat over each field
  • Zip up temp folder files into new IDML file
  • Once a day, someone would load up InDesign on the Mac and run a little automation script I wrote that would loop through all the waiting IDML files and create print ready PDF files from them.

I'd be interested to know what your solution was. But if anyone knows of a cheap solution to view/edit IDML online (especially using an HTML5 client) I'd sure like to hear about it. ;)

0
Murray On

I went down this route not so long ago with http://www.treeorgtech.com/ Consider http://idmllib.com/ to read elements - we built our own scripts to read IDML. I read the IDML out into my own DB "format" then used http://www.pdflib.com/ to generate hi-res PDF's I used flex/flash to build an editor.