-
-
Save majal/ea3b483e3758a5084948a39b09df9b2d to your computer and use it in GitHub Desktop.
Remove all annotations from a PDF document
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
[[ -z "$1" ]] && echo "Please enter a filename. Exiting..." | |
[[ -z "$1" ]] && exit 1 | |
echo | |
printf "Stripping annotations from $1... " | |
pdftk "$1" output "/tmp/$1 - uncompressed.pdf" uncompress | |
LANG=C sed -n '/^\/Annots/!p' "/tmp/$1 - uncompressed.pdf" > "/tmp/$1 - stripped.pdf" | |
pdftk "/tmp/$1 - stripped.pdf" output "$1 - No Annotations.pdf" compress | |
echo "and saved as $1 - No Annotations.pdf. Done. ;-)" | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment