Remove author metadata from PDF annotations in preview?
I have the exact same problem. While you should anonymize yourself in the prefs, I don't fully trust that method, so:
- Make a copy of the annotated PDF file
- Drag and drop to open in a text editor like TextWrangler, or hex editor like HexEdit (Don't worry about any binary-looking weird characters)
- Search for your name and replace with the exact same number of Xs or I usually throw in a space among the Xs so it looks like a different name.
- Save the file in place
- Open in Preview and mouse over the annotations to see the anonymized version
In Preview, go to preferences
In the PDF tab
Select show or Not show the name in the Annotations !
MetaClean is a powerful tool to view, remove and edit metadata of Microsoft Office (Word, Excel, PowerPoint and Visio), OpenOffice (word processors, spreadsheets and presentations) and PDF (versions 1.0 and higher) documents.
http://adarsus.com/en/metaclean.html
Microsoft Windows, Linux, Unix and Mac OS X Platforms
Regarding the second answer, this does not necessarily work if the .pdf was created using a different application, even if it is modified in Preview. Always use the Inspector in Preview to make sure the Author metadata is anonymized, and if not, change it as the first answer suggests using a text editor (TextEdit works fine).
For example, I often "print" web pages to .pdf in Safari, particularly news stories. If I open one of those in Preview and look using Inspector, my name shows up, even though I have "Add name to annotations" unchecked in Preview preferences as the second answer suggests. It stays there even if I annotate the document in Preview and save it.
I assume this is because it was added when I printed to .pdf from Safari. Safari preferences do not have a way to change user ID or anonymize saved documents in its preferences, as far as I can tell, so it reverts to System-level account information and adds my name from there when saving.
Again, always use the Inspector in Preview to make sure the Author metadata is anonymized before sending out a sensitive document.
(This should answer keflavich's question in response to Answer 2. In Preview [as opposed to common office applications or other groupware], your name is not associated with your annotations but with the document as a whole.)
Here's my complete method:
export LC_CTYPE=C
qpdf --qdf --object-streams=disable file.pdf
sed -i "" "s/\/T \(UrCaseSensitiveUsername\)//g;" file.pdf
gs -sDEVICE=pdfwrite -dNOPAUSE -dQUIET -dBATCH -sOutputFile=out.pdf file.pdf # To correct errors
qpdf --replace-input --object-streams=generate --recompress-flate --compression-level=9 out.pdf # To recompress
If you don't like calling GhostScript, you may instead use
sed -i "" "s/UrCaseSensitiveUsername/_________________/g;" file.pdf
where _________________
is the string composed of underscores having the same length as UrCaseSensitiveUsername
.