SECTION 2.2
41
Other General Properties
formation such as the number of pages in the document can be written into the
file after all pages have been generated.
A PDF file that is generated in a single pass is generally not ordered for most effi-
cient viewing, particularly when accessing the contents of the file over a network.
When generating a PDF file that is intended to be viewed many times, it is worth-
while to perform a second pass to optimize the order in which objects occur in
the file. PDF specifies a particular file organization,
Linearized PDF,
which is doc-
umented in Appendix F. Other optimizations are also possible, such as detecting
duplicated sequences of graphics objects and collapsing them to a single shared
sequence that is specified only once.
2.2.5 Random Access
A PDF file should be thought of as a flattened representation of a data structure
consisting of a collection of objects that can refer to each other in any arbitrary
way. The order of the objects’ occurrence in the PDF file has no semantic signifi-
cance. In general, an application should process a PDF file by following references
from object to object, rather than by processing objects sequentially. This is par-
ticularly important for interactive document viewing or for any application in
which pages or other objects in the PDF file are accessed out of sequence.
To support such random access to individual objects, every PDF file contains a
cross-reference table
that can be used to locate and directly access pages and other
important objects within the file. The cross-reference table is stored at the end of
the file, allowing applications that generate PDF files in a single pass to store it
easily and those that read PDF files to locate it easily. By using the cross-reference
table, the time needed to locate a page or other object is nearly independent of the
length of the document, allowing PDF documents containing hundreds or thou-
sands of pages to be accessed efficiently.
2.2.6 Security
PDF has two security features that can be used, separately or together, in any doc-
ument:
•
The document can be
encrypted
so that only authorized users can access it.
There is separate authorization for the owner of the document and for all other