Sometimes it is necessary to check, remove or modify the metadata of PDF files. Here is a quick post to show how it can be done in the terminal on Ubuntu
Checking PDF metadata
Most PDF viewers have an option for showing the metadata of PDF files. This can also be done in the terminal using the “pdfinfo” command-line tool. First, we need to install the “poppler-utils” package:
sudo apt install poppler-utils
Once installed, you can check the metadata by using the following command:
pdfinfo file.pdf
This will display detailed information about the PDF file, including metadata such as title, author, creation date, modification date, etc.
Removing the metadata
There are many ways of editing the PDF metadata, but I have found that using the image metadata tool “exiftool” is the easiest. This can be installed like this:
sudo apt install libimage-exiftool-perl
Then you can remove all the metadata using this command:
exiftool -overwrite_original -all:all="" file.pdf
I see in a comment that it may be possible to revert this unless you also “linearize” the file:
qpdf --linearize file.pdf
That should ensure that the “history” is removed.