From 26f3d3a3f85a3490e4f837ef410261f2948f0e2a Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Tue, 5 Jul 2022 15:18:25 +0200 Subject: [PATCH] Add pdf-clean.sh --- scripts/.local/bin/pdf-clean.sh | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 scripts/.local/bin/pdf-clean.sh diff --git a/scripts/.local/bin/pdf-clean.sh b/scripts/.local/bin/pdf-clean.sh new file mode 100755 index 0000000..05d2959 --- /dev/null +++ b/scripts/.local/bin/pdf-clean.sh @@ -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"