Is there a way to remove all PDF annotations (including highlights, comments, notes, arrows) in bulk (e.g., via command line)?
Asked
Active
Viewed 1,169 times
1 Answers
6
The following series of commands solved my problem:
pdftk original.pdf output uncompressed.pdf uncompress
LANG=C sed -n '/^\/Annots/!p' uncompressed.pdf > stripped.pdf
pdftk stripped.pdf output final.pdf compress
Rafael Beirigo
- 820
- 6
- 10
-
1Thanks! 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
-
2A 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