Sanitize PDFs / Delete All Annotations

Hey! Is it possible to batch all highlights, comments and annotations in several PDFs at once? I need to share a bunch of PDFs, but I don’t want to share my own annotations. Deleting one by one is way too tedious.

Any ideas would be greatly appreciated!

Data > Convert > to PDF without Annotations

5 Likes

Can’t believe I missed it. So simple! Thx!

Not sure (didn’t check again) but I think this also removes links.

You’re welcome.

Quick follow up: is there a way to also strip away the OCR text layer? Thanks!

No, there is no built-in tool for this. Why do you want to do this?

Just a way to create more friction for students trying to copy and paste exam info into Google or recent tools like ChatGPT. Not failproof, but worth trying…

Any suggestions on how to script something like this would be appreciated.

Because the students are intelligent enough to use Google but too stupid to use Apple’s text recognition?

PDFPen can remove the OCR layer. I don’t know if its scripting dictionary permits that, too. Otherwise, the PDFDocument class of Apple’s PDFKit framework contains a string property that you can perhaps set to nothing. But given that the “text layer” is mostly invisible text in the PDF, this might not do the trick.
There’s more on that topic in this longish superuser thread: ocr - PDF has an extra blank in all words after running through Ghostscript - Super User
So, to really remove the invisible text from the file, you might have to modify the Tr operator in the PDF (which should be possible with some hardcore scripting).

While it might be fun to figure all that out, I doubt that it will deter the brighter students.

Ha! Got me! In my defense, most of them are Windows users. Also, just having to screenshot the PDF to use Apple’s text recognition or manually type a large string into Google is a time killer. As I said, it is just friction, but definitely not flawless. Exams will have to evolve differently, just as every profession will with this kind of tools.

Thanks for your suggestions! I will try to sort it out. If I ever do, I will post it back here in case someone has this weird use case.

2 Likes