0

my goal is to change texts in an indesign file via an external program(Java).

We get our flyers as .indd files, due to changes in our pricing model we would like to change the prices, without editing the indd files manually(service provider would have to do that, $$$).

I've build a program in Java to identify the locations to be changes, prices and text are in plaintext in the file. But when I try to change the prices from 19.9 to 22.9, the .indd file can't be opened due to a database error. :-( Might be a checksum or so).

My question: Is there a way without Indesing to edit an .indd file. I've found the SDK from Adobe but you can't use it without a InD Server or Software. Is there any new software to do these changes, earlier post suggest no possibility,...

Thank you!

MTH_DE

MTH_DE
  • 1
  • 1
  • InDesign has a pure XML file format .idml: http://www.indesignsecrets.com/downloads/Anatomy_of_IDML.pdf – PeterMmm Mar 26 '14 at 12:51
  • Hi peter, you are right but we don't/can't use the idml, cause its all done in *.indd, no chance on that track. – MTH_DE Mar 26 '14 at 15:16

3 Answers3

4

There is no documented way to edit an InDesign document without InDesign. Its internal file format is proprietary ("manufactured and sold only by the owner of the patent, formula, brand name, or trademark associated with the product").

The InDesign SDK does not target the actual file data, as it's meant to help developing plugins that run inside InDesign itself. It only documents the internal state of ID while running.

IDML provides an XML representation of an InDesign document, and that can be edited with the usual toolkits. However, an IDML file still needs to be read in, parsed, and formatted using InDesign itself. Also, IDML provides for content markup and editing, but the result of any changes in that content or formatting can only be seen after opening the file with InDesign. For example, while you can replace a short text with a much longer, or a small font with a larger, you can not 'see' whether it will fit in the originally allocated space or not.


Disclaimer: the following is conjecture of my own. Use At Your Own Risk, Et Cetera.

With the above said: yes, you are correct. The message about 'a database error' is indeed what you get after manually editing an InDesign file. (Note for future posts: please, never state that "an error" was reported. Always state the exact error text!)

ID files are stored in a relational database format, where the actual data has been split up into 4K large "pages". Each page contains a 4-byte checksum at the very end, at offset 0xFF8, which seems to be a variant of Adler-32. I've found it's not easy to calculate it, but you can set the checksum to all zero's, which seems to indicate that it's not used. Your file will open as usual in InDesign, and after saving you will see the checksum updated.


Note that manually editing binary files is, very emphatically, not recommended. You cannot insert or delete text, only overwrite it. Text may not be stored sequentially, or in the code page you expect it to be. Not all text you can find in the binary may be visible, or even used at all, in InDesign itself; also, in reverse, not all text you can see in your document while in InDesign may be stored as such in the binary.

Jongware
  • 22,200
  • 8
  • 54
  • 100
0

I am using IDMLLib to achieve same, and it works fine for me.

Yogesh Prajapati
  • 4,770
  • 2
  • 36
  • 77
  • Well, it looks like you would need to pay for the licence for IDMLLib, which OP wants to avoid, plus, as he stated he gets, the files as .indd and does not have InDesign to convert to idml. – Nicolai Kant Dec 08 '15 at 18:29
  • sorry if out topic but do you know id idmllib is still a living project ? Last time I checked it didn't look so? – Loic Dec 14 '15 at 13:19
  • The IDMLLib project is quite a bit behind the InDesign versioning. I just attempted to use it for a project that I am working on, but when I used their "saveAs" function, I received this error: UnsupportedOperationException: Only 6.0, 7.0, 7.5 and 8.0 are allowed DomVersions. The current dom version of IDML from the most recent adobe InDesign (at the time of this writing) is 11.2. – user1209809 Mar 01 '16 at 20:11
  • Right user1209809, in that case you have to use proper dom version and there are other limitations are there with idmllib. so need to do more r & d before purchasing a license. – Yogesh Prajapati Mar 03 '16 at 04:46
0

Actually, you have two options from Adobe to achieve this - the Adobe InDesign Plug-ins SDK, and the Adobe InDesign Scripting SDK.

Creating an 'InDesign Plug-in' for this would be overkill, but the scripting SDK allows you to write what is basically javascript to interact with documents; I'd recommend creating a template document that has unique placeholders instead of prices, to make the switches less error-prone, then do something like this:

myContents = app.activeDocument.contents;
app.activeDocument.contents = myContents.replace(/19.9/g, "22.9");

https://forums.adobe.com/thread/967166

CodeShane
  • 6,480
  • 1
  • 18
  • 24