Graphics Programs Reference
In-Depth Information
Note that the byte offsets are stored with leading zeros to ensure each entry is the same
length. Thus, we can read the cross-reference table with random access too.
Trailer
The first line of the trailer is just the trailer keyword. This is followed by the trailer
dictionary , which contains at least the /Size entry (which gives the number of entries
in the cross-reference table) and the /Root entry (which gives the object number of the
document catalog , which is the root element of the graph of objects in the body).
There follows a line with just the startxref keyword, a line with a single number (the
byte offset of the start of the cross-reference table within the file), and then the line %
%EOF , which signals the end of the PDF file.
Here's the trailer from Example 3-1 :
trailer Trailer keyword
<< The trailer dictinonary
/Root 5 0 R
/Size 6
>>
startxref startxref keyword
459 Byte offset of cross-reference table
%%EOF End-of-file marker
The trailer is read from the end of the file backwards: the end-of-file marker is found,
the byte offset of the cross-reference table extracted, and then the trailer dictionary
parsed. The trailer keyword marks the upper extent of the trailer.
Lexical Conventions
A PDF file is a sequence of 8 bit bytes. Using the rules we describe in this chapter, these
characters can be grouped into tokens (such as keywords and numbers), and the file
parsed.
Some general rules apply to the main body of the file, and frequently to the various
other languages in a PDF file. There are three kinds of characters: regular characters ,
whitespace characters , and delimiters . The whitespace characters are listed in Ta-
ble 3-1 . The delimiters are ( ) < > [ ] { } / % , and are used to define arrays, diction-
aries and so on. All other characters are regular characters, with no special meaning.
Search WWH ::




Custom Search