Graphics Programs Reference
In-Depth Information
allow legacy file transfer programs to determine that the file is binary, it is usual to
include some bytes with character codes higher than 127 in the header. For example:
%âãÏÓ
The percent sign indicates another header line, the other few bytes are arbitrary char-
acter codes in excess of 127. So, the whole header in our example is:
%PDF-1.0
%âãÏÓ
Body
The file body consists of a sequence of objects, each preceded by an object number ,
generation number , and the obj keyword on one line, and followed by the endobj key-
word on another. For example:
1 0 obj
<<
/Kids [2 0 R]
/Count 1
/Type /Pages
>>
endobj
Here, the object number is 1, and the generation number is 0 (it almost always is). The
content for object 1 is in between the two lines 1 0 obj and endobj . In this case, it's the
dictionary <</Kids [2 0 R] /Count 1 /Type /Pages>> .
Cross-Reference Table
The cross-reference table lists the byte offset of each object in the file body. This allows
random access to the objects, so that they do not have to be read in order, and an object
which is never used is never read. This means, in particular, that simple operations like
counting the number of pages in a PDF document can be fast, even on large files.
Every object in a PDF file has an object number and a generation number . Generation
numbers are used when a cross reference table entry is reused—we don't consider them
here (they will always be zero).
For our purposes, we can consider the cross-reference table to consist of a header line
indicating the number of entries, then a special entry, then one line for each object in
the file body. In our file:
0 6 Six entries in table, starting at 0
0000000000 65535 f Special entry
0000000015 00000 n Object 1 is at byte offset 15
0000000074 00000 n Object 2 is at byte offset 74
0000000192 00000 n etc...
0000000291 00000 n
0000000409 00000 n Object 5 is at byte offset 409
Search WWH ::




Custom Search