Add pdf-clean.sh

This commit is contained in:
Sam A. 2022-07-05 15:18:25 +02:00
parent b423a60d33
commit 26f3d3a3f8
Signed by: samsapti
GPG key ID: CBBBE7371E81C4EA

12
scripts/.local/bin/pdf-clean.sh Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env dash
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"