You also need to know the (standard) function that PDF documents can use: it is called incremental updating.
If the document has been updated, a new modified version can be created by saving the original data (including the last line of %%EOF ) and adding any modified or added objects, supplemented by a new end of the file with additional sections xref and trailer plus additional final %%EOF .
There may be several incremental updates in the PDF.
Thus, the first %%EOF can be displayed long before the "last 1024 bytes of the file."
The advantage (or disadvantage - depends on your specific point of view) of this "incremental update" function: you can restore the previous version of the PDF file by simply deleting all the lines that follow the second, but the last %%EOF (you can continue this process until will not reach the first version of the file).
There is also a pdfresurrect command line pdfresurrect
- which can report the number of incremental updates that have been applied to the PDF,
- which can retrieve previous versions, and
- which can smooth the story and create a new PDF file that contains only the latest version.
Is this "incremental update" feature much useful in real PDF files?
First : it is used whenever a PDF has a digital / electronic signature.
Second : this is the standard way for Adobe Acrobat to save a PDF file whenever you just click the Save button. (If you want to avoid incremental document updates, use Save as... instead!). One of the few exceptions when a simple Save click will no longer incrementally update the file with the latest versions of Acrobat, but generates a completely new PDF file after you delete the full pages (it seems that too many Adobe clients complained about previous versions, because any incremental the update will increase the file size - it was too annoying that deleting the pages gave them large PDF files and did not actually delete the pages either).
Therefore, be careful with information leaks that occur unintentionally and accidentally, because you are not aware of the action of Acrobat described in the second paragraph above.
Update
Recently, I created a PDF file with manual encoding for a PDF workshop (video) at the TROOPERS15 conference , which can be used to study the details of this function:
- 114_incrementally-updated.pdf (8.3 kB on GitHub)
(I would recommend backing up the file after downloading it. Then just delete each line after the first %%EOF , save the file and look at the now visible content ...)
Kurt pfeifle
source share