Graphics Programs Reference
In-Depth Information
Dictionaries
A dictionary represents an unordered collection of key-value pairs . The dictionary maps
the keys to the values—provide a key, and the value is the result of looking it up in the
dictionary. The keys are names, the values may be any PDF object. Dictionaries are
written between << and >> . For example:
<</One 1 /Two 2 /Three 3>>
maps the name /One to the integer 1 , the name /Two to the integer 2 , and the
name /Three to the integer 3 . Dictionaries can, of course, contain other dictionaries.
Nested dictionaries form the bulk of the non-graphical structured data in most PDF
files.
Indirect References
In order to split the PDF content over separate objects (so data may be read only if
required), we connect them together with indirect references . The indirect reference to
object 6 is written as:
6 0 R
Here, 6 is the object number, 0 is the generation number (which we don't consider
here), and R is the indirect reference keyword.
For example, here's a typical dictionary using indirect references:
<< /Resources 10 0 R
/Contents [4 0 R] >>
In this example, objects 10 and 4 are being referenced in the values of a dictionary.
Streams and Filters
Streams are used to store binary data. They are formed of a dictionary followed by a
chunk of binary data. The dictionary lists the length of the data, and optionally other
parameters, according to the particular use to which the stream is put.
Syntactically, a stream consists of a dictionary, followed by the stream keyword, a new-
line (<LF> or <CR><LF>), zero or more bytes of data, another newline, and finally
the endstream keyword. From our example file:
4 0 obj Object 4
<<
/Length 65 Length of the data
>>
stream Stream keyword
1. 0. 0. 1. 50. 700. cm 65 bytes of data, here a graphics stream
BT
/F0 36. Tf
(Hello, World!) Tj
Search WWH ::




Custom Search