The technical term of the PDF feature you are talking about is 'incremental update'. Now can you discover, if a PDF document was incrementally updated, and thusly contains different document versions?
Using a command line tool, pdfresurrect
There is a command line tool, pdfresurrect
, which can do what you want. First, it can list the number of different versions contained in a PDF document. Example:
kp@mbp:> pdfresurrect -q incrupd.pdf
incrupd.pdf: 2
Second, it can reveal a few more details about the changes between the versions:
kp@mbp:> pdfresurrect incrupd.pdf
incrupd.pdf: --A-- Version 1 -- Object 0 (Stream)
incrupd.pdf: --A-- Version 1 -- Object 1 (Catalog)
incrupd.pdf: --A-- Version 1 -- Object 2 (Unknown)
incrupd.pdf: --A-- Version 1 -- Object 3 (Pages)
incrupd.pdf: --A-- Version 1 -- Object 4 (Page)
incrupd.pdf: --A-- Version 1 -- Object 5 (Stream)
incrupd.pdf: --A-- Version 1 -- Object 6 (ExtGState)
incrupd.pdf: --A-- Version 1 -- Object 7 (Font)
incrupd.pdf: --A-- Version 1 -- Object 8 (Unknown)
incrupd.pdf: --A-- Version 1 -- Object 9 (Unknown)
incrupd.pdf: --D-- Version 2 -- Object 0 (Stream)
incrupd.pdf: --M-- Version 2 -- Object 5 (Stream)
---------- incrupd.pdf ----------
Versions: 2
Version 1 -- 10 objects
Version 2 -- 2 objects
Third, it can write all versions to disk (creating a subdirectory in the current one), so you can inspect them one by one:
kp@mbp:> pdfresurrect -w incrupd.pdf
kp@mbp:> ls -ltr incrupd-versions/
total 24
-rw-r--r-- 1 kurtpfeifle staff 695 Dec 3 10:44 incrupd-versions.summary
-rw-r--r-- 1 kurtpfeifle staff 3713 Dec 3 10:44 incrupd-version-2.pdf
-rw-r--r-- 1 kurtpfeifle staff 3857 Dec 3 10:44 incrupd-version-1.pdf
Fourth, it can scrub the previous versions from the PDF document and keep only the latest:
kp@mbp:> pdfresurrect -s incrupd.pdf
kp@mbp:> ls -l incrupd*.pdf
-rw-r--r--@ 1 kurtpfeifle staff 3491 Dec 3 10:43 incrupd.pdf
-rw-r--r-- 1 kurtpfeifle staff 3201 Dec 3 10:49 incrupd-scrubbed.pdf
Using a text editor
If you know how to handle a text editor when it comes to (partially) binary files, you can also proceed like this:
- Backup your PDF.
- Open the backup PDF in the editor.
- Go to the end of the file.
- Search for the last occurrence of
%%EOF
. (In a well-behaved PDF, this should be right at the end, without any garbage following after.)
- Search for the last-but-one occurence of
%%EOF
.
- Delete everything after the last-but-one
%%EOF
up to the very end of the file.
- Save the file under a new name (preferrably containing
-version2.pdf
).
Congratulations -- you've just restored the previous version of the PDF document. :-)
Continue above procedure to restore even older versions...