17.06.2013 Views

XMP Specification Part 3: Storage in Files - Adobe

XMP Specification Part 3: Storage in Files - Adobe

XMP Specification Part 3: Storage in Files - Adobe

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

struct MasterPage {<br />

// 16 byte GUID identify<strong>in</strong>g this as an InDesign database<br />

// Must be: 0606EDF5-D81D-46e5-BD31-EFE7FE74B71D<br />

char fGUID [16];<br />

// 8 bytes; type of database (for example "DOCUMENT")<br />

char fMagicBytes [8];<br />

// Endian of object streams, 1=little endian, 2=big endian<br />

char fObjectStreamEndian;<br />

// Irrelevant stuff<br />

char fIrrelevant1 [239];<br />

// Master page sequence number. The master page with<br />

// the larger value is the current master page<br />

LittleEndianUnsignedInt64 fSequenceNumber;<br />

// More irrelevant stuff<br />

char fIrrelevant2 [8];<br />

// The number of pages <strong>in</strong> the file. fFilePages * 4096<br />

// is the absolute file offset <strong>in</strong> bytes of where any<br />

// contiguous data storage would beg<strong>in</strong> (provided this<br />

// master page is the current master page).<br />

LittleEndianUnsignedInt32 fFilePages;<br />

// More irrelevant stuff<br />

char fIrrelevant3 [3812];<br />

};<br />

Table 13 describes the fields <strong>in</strong> a master page.<br />

Table 13 — Master page fields<br />

fGUID The first 16 bytes of each master page (and thus the first 16 bytes of the file)<br />

are set to a GUID that identifies the file as an InDesign database.<br />

The ID value of the master page is:<br />

0606EDF5-D81D-46e5-BD31-EFE7FE74B71D<br />

You must check for this value. If it is not present, someth<strong>in</strong>g has changed <strong>in</strong><br />

an <strong>in</strong>compatible way <strong>in</strong> the file format and you can make no further<br />

assumptions. You can search the entire file to f<strong>in</strong>d <strong>XMP</strong> metadata, but you<br />

cannot add additional metadata beyond any padd<strong>in</strong>g provided <strong>in</strong> the packet.<br />

fMagicBytes Conta<strong>in</strong>s an 8-byte sequence identify<strong>in</strong>g the type of database file.<br />

This can be useful if you want this <strong>in</strong>formation and cannot get it from the file<br />

extension or type and creator. The 8 characters "DOCUMENT" designate a<br />

database that conta<strong>in</strong>s an InDesign document and would normally have a<br />

.<strong>in</strong>dd extension.<br />

fObjectStreamEndian The byte order (big-endian or little-endian) <strong>in</strong> which <strong>in</strong>tegers <strong>in</strong> an object<br />

stream are written, which depends on the creation platform of the database.<br />

You must use this byte-order to <strong>in</strong>terpret the packet-length value if you<br />

enlarge <strong>XMP</strong> packets and rewrite the file format; see 2.4.2.2, “Rewrit<strong>in</strong>g <strong>XMP</strong><br />

data beyond the packet padd<strong>in</strong>g”.<br />

You do not need it to f<strong>in</strong>d or <strong>in</strong>terpret the <strong>XMP</strong> data; all <strong>in</strong>teger values <strong>in</strong> the<br />

storage structures themselves are uniformly little-endian.<br />

38 ©<strong>Adobe</strong> Systems Incorporated, 2010

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!