Is there a way to remove all PDF annotations (including highlights, comments, notes, arrows) in bulk (e.g., via command line)?
Asked
Active
Viewed 2,773 times
2 Answers
9
The following series of commands solved my problem:
pdftk in.pdf output - uncompress | sed '/^\/Annots/d' | pdftk - output out.pdf compress
Thanks @Farid Cheragi for the oneliner!

Rafael Beirigo
- 1,552
- 1
- 13
- 11
-
2Thanks! This worked for me, with the following modifications for `macos`: the `sed` command should be `LANG=C LC_ALL=C sed ...` (see [this answer](https://stackoverflow.com/a/23584470/4970632)), and `pdftk` should be downloaded via the `.pkg` file linked in [this answer](https://stackoverflow.com/a/39814799/4970632). – Luke Davis Aug 29 '18 at 06:43
-
3A faster (in-memory) way is to use a shell pipeline: ```sh pdftk in.pdf output - uncompress | sed '/^\/Annots/d' | pdftk - output out.pdf compress ``` – Farid Cheraghi Sep 27 '20 at 21:09
-
@FaridCheraghi it works on macOS M1. Very good – GoingMyWay Oct 01 '21 at 12:45
2
pdfcpu has a subcommand to remove annotations:
pdfcpu annotations remove my.pdf

Frederick Nord
- 1,246
- 1
- 14
- 31