CHAPTER 3
190
Syntax
3.10.6 Maintenance of File Specifications
The techniques described in this section can be used to maintain the integrity of
the file specifications within a PDF file during the following types of operations:
•
Updating the relevant file specification when a referenced file is renamed
•
Determining the complete collection of files that must be copied to a mirror
site
•
When creating new links to external files, discovering existing file specifica-
tions that refer to the same files and sharing them
•
Finding the file specifications associated with embedded files to be packed or
unpacked
It is not possible, in general, to find all file specification strings in a PDF file
because there is no way to determine whether a given string is a file specification
string. It is possible, however, to find all file specification
dictionaries,
provided
that they meet the following conditions:
•
They are indirect objects.
•
They contain a
Type
entry whose value is the name
Filespec
.
An application can locate all of the file specification dictionaries by traversing the
PDF file’s cross-reference table (see Section 3.4.3, “Cross-Reference Table”) and
finding all dictionaries with
Type
keys whose value is
Filespec
. For this reason, it
is highly recommended that all file specifications be expressed in dictionary form
and meet the conditions stated above. Note that any file specification dictionary
specifying embedded files (that is, one that contains an
EF
entry)
must
satisfy
these conditions (see Table 3.41 on page 182).
Note:
It may not be possible to locate file specification dictionaries that are direct
objects, since they are neither self-typed nor necessarily reachable by any standard
path of object references.
Files may be embedded in a PDF file either directly, using the
EF
entry in a file
specification dictionary, or indirectly, using related files arrays specified in the
RF
entry. If a file is embedded indirectly, its name is given by the string that precedes
the embedded file stream in the related files array. If it is embedded directly, its
name is obtained from the value of the corresponding entry in the file