• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

All InDesign Versions--determining version before opening

Explorer ,
Aug 16, 2011 Aug 16, 2011

Copy link to clipboard

Copied

At one point I scan a variable number of documents for information.  This involves opening the document, going through it, and closing the document.

If I open a CS3 document in CS5, no problem.  But if I open a CS5 document in CS3, InDesign crashes.

I know that I can open each document using STDIO and read the 31st byte (I believe it's that one) to determine a version, but is there any better way?  Please remember that this needs to work on both platforms, so reading the Mac type isn't a good solution.

TIA!

John

TOPICS
SDK

Views

888

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 17, 2011 Aug 17, 2011

Copy link to clipboard

Copied

That *is* the proper way, but the value is not a single byte but a 4-byte long word instead. So before you can read it, you must check fObjectStreamEndian to determine whether the file uses little or big endianness.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 17, 2011 Aug 17, 2011

Copy link to clipboard

Copied

Good morning Sir/Madam:

First of all, thanks for the contribution. Though I may respectfully disagree with you, I still greatly appreciate the fact that you went out of your way to contribute to this discussion.

Though I do not like this method, I have been using it (i.e. opening the file using basic IO and querying byte 30) for at least eight years. I consider it cumbersome and inelegant. Nevertheless, ever since I have been using it, the values around byte 30 remain looking pretty much like this:

0F 00 00 06 00 00 00 (This is for CS4 Win)

0F 00 00 05 00 00 00 (This is for CS3 Win)

0F 00 00 06 00 00 00 (This is for CS4 Mac)

0F 00 00 05 00 00 00 (This is for CS3 Mac)

I selected these four files randomly from my hard drive on both the Mac and my XP computer.

If you can refer me to a source of some kind that I can study, such kindness would be appreciated.

R,

John

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 17, 2011 Aug 17, 2011

Copy link to clipboard

Copied

JADarnell wrote:

Good morning Sir/Madam:

First of all, thanks for the contribution.  Though I may respectfully disagree with you, I still greatly appreciate the fact that you went out of your way to contribute to this discussion.

I'm a Sir

How come you think you disagree? There is nothing strange about some value in the header being designated as "the official version number". Adobe likes to keep this information well under wraps in the SDK, but perhaps there is a reason for that. In any case, the variable names I used come from a document on XMP:

http://wwwimages.adobe.com/www.adobe.com/content/dam/Adobe/en/devnet/xmp/pdfs/XMPSpecificationPart3....

-- see page 38 for their (somewhat abbreviated) structure of INDD files headers. The long word starting at position 29 (where the first byte is number 0) is not specified in there but has been confirmed as the actual version number.

In this header you also find the Object Stream Endianness specification, and (from memory) you need that to successfully parse files older than CS3.

Originally, the endianness of long words in InDesign files depended on the platform they were created with, but Adobe decided somewhere along the line it would be smarter to just make the endianness a part of the "official" specs. To read older files you still need the code, though. It's very well possible your Mac/Win files are just not old enough. My personal code for this works with INDD files for as long back as I care to look -- *at least* back to InDesign 2.0 (and then only because I cannot find older files).

Then again, I admit all of the above is my personal conjecture. If you still want to disagree, you're free to examine the files yourself and devise something that works better.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 17, 2011 Aug 17, 2011

Copy link to clipboard

Copied

LATEST

Sir:

Thanks for that reference! It has answered a few more questions that I didn't know I needed answering (grin). A bit dense, but then most computer specs are, I've found.

Take care.

John

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines