dotfiles/scripts/.local/bin/pdf-clean.sh

15 lines
320 B
Bash
Raw Normal View History

2022-07-05 13:18:25 +00:00
#!/usr/bin/env dash
2022-07-05 13:43:37 +00:00
set -e
2022-07-05 13:18:25 +00:00
pdftk "$1" dump_data_utf8 output meta.txt
sed -i 's/^InfoValue:.*$/InfoValue:/g' meta.txt
pdftk "$1" update_info meta.txt output "$1.clean.pdf"
exiftool -q -all:all= "$1.clean.pdf"
qpdf --linearize --replace-input "$1.clean.pdf"
rm -f meta.txt "$1.clean.pdf_original"
echo "$1.clean.pdf"