I periodically want to remove annotations from PDFs for all kinds of reasons. For example, I want to give the PDF to a student without all my comments and highlights. Or, more recently, I want to re-OCR the PDF but I’d already highlighted the original.
There’s a perl program that does this easily called rewritepdf.pl, which is a part of CAM:PDF.
On arch, you can install this library using yay
(or your preferred package manager):
yay -S perl-cam-pdf
The incantation for removing annotations is:
rewritepdf.pl -C in.pdf out.pdf
Voila!