Previous Next


                                          99
SECTION 3.4                                                              File Structure



  it is not possible to overwrite the contents of the original file in this manner. In-
  cremental updates can be used to save changes to documents in these contexts.
• Once a document has been signed (see Section 2.2.6, “Security”), all changes
  made to the document must be saved using incremental updates, since altering
  any existing bytes in the file invalidates existing signatures.

In an incremental update, any new or changed objects are appended to the file, a
cross-reference section is added, and a new trailer is inserted. The resulting file
has the structure shown in Figure 3.3. A complete example of an updated file is
shown in Section G.6, “Updating Example.”

The cross-reference section added when a file is updated contains entries only for
objects that have been changed, replaced, or deleted. Deleted objects are left
unchanged in the file, but are marked as deleted by means of their cross-reference
entries. The added trailer contains all the entries (perhaps modified) from the
previous trailer, as well as a Prev entry giving the location of the previous cross-
reference section (see Table 3.13 on page 97). As shown in Figure 3.3, a file that
has been updated several times contains several trailers; each trailer is terminated
by its own end-of-file (%%EOF) marker.

Because updates are appended to PDF files, a file can have several copies of an
object with the same object identifier (object number and generation number).
This can occur, for example, if a text annotation (see Section 8.4, “Annotations”)
is changed several times and the file is saved between changes. Because the text
annotation object is not deleted, it retains the same object number and generation
number as before. An updated copy of the object is included in the new update
section added to the file. The update’s cross-reference section includes a byte
offset to this new copy of the object, overriding the old byte offset contained in
the original cross-reference section. When a consumer application reads the file,
it must build its cross-reference information in such a way that the most recent
copy of each object is the one accessed in the file.

In versions of PDF earlier than 1.4, it was not possible to use an incremental
update to alter the version of PDF to which the document conforms, since the
version was specified only in the header at the beginning of the file (see Section
3.4.1, “File Header”). In PDF 1.4, it is possible for a Version entry in the
document’s catalog dictionary (see Section 3.6.1, “Document Catalog”) to
override the version specified in the header, which enables the version to be
altered using an incremental update.

Previous Next