DynaPDF Manual - Page 82
Previous Page 81 Index Next Page 83

Incremental Updates
Page 82 of 874
Incremental Updates
An incremental update is a special way of storing changes to an existing PDF file. New contents
or modified objects are appended the file, leaving the previous contents fully intact.
This makes it theoretically possible to restore the original file but in practice this is not that easy
because the end offset of the initial PDF file is not known since it is not stored in the file.
Digitally signed PDF files are an exception because the corresponding signature field contains
the exact byte offsets which make up the document. This makes it possible to go back to the
state of the document that was digitally signed. It is also the one and only way to digitally sign
a PDF file multiple times without invalidating existing signatures.
However, incremental updates have also their drawbacks, since not every change that is
thinkable is possible in practice.
What is allowed and what is prohibited?
Since every change of existing objects need to be recorded, the main challenge is to figure out
which objects were changed or deleted.
The PDF import algorithm was not designed to merge one or more PDF files without building a
new file from scratch. In addition, functions which change more or less the entire PDF file like
CheckConformance() or Optimize() are prohibited since it would be way too complicated to
store such massive changes on the object structure as an incremental update.
Prohibited functions:
• CheckConformance()
// Returns with a warning
• CloseAndSignFileEx()
// Returns with a fatal error
• CloseAndsignFileExt() // Fatal error if Encrypt is true
• CloseFileEx()
// Forwarded to CloseFile()
• FlushPages()
// Silently ignored
• FlushPagesEx()
// Silently ignored
• Optimize()
// Returns with a warning
• ImportPage()
// Returns with a warning
• ImportPageEx()
// Returns with a warning
Note that it is not possible to change the encryption settings. If the file is already encrypted then
it will be stored with the original encryption settings. Therefore, functions which change the
encryption settings cannot be used.
Prohibited PDF file types:
• PDF Collections -> GetInIsCollection()
• Pure XFA Forms
-> GetInIsXFAForm() // See description below
Next topic: Incremental updates in practice