]> Sergey Matveev's repositories - dotfiles.git/blobdiff - bin/bin/my-ps2pdf
HI flag
[dotfiles.git] / bin / bin / my-ps2pdf
index 4f34bdb3180ddb3de7d9407869d6ee63ab50076d..01e37bd7e9f393d01786161003d61715ae7df66f 100755 (executable)
@@ -5,7 +5,7 @@
 # removes all empty metainformation fields, removed fields
 # with uuid:s, removes Format (that is application/pdf).
 
-set -e
+setopt ERR_EXIT
 opts=(
     -dQUIET
     -dBATCH
@@ -15,7 +15,7 @@ opts=(
     -dPDFSETTINGS=/default
     -dPDFA=1
     -dCompatibilityLevel=1.4
-    -dPDFACompatibilityPolicy=3 # that will skip some errors about XMP
+    -sPDFACompatibilityPolicy=3 # that will skip some errors about XMP
     -dAutoRotatePages=/None
     -dOptimize=true
     -sColorConversionStrategy=RGB # advised for PDF/A
@@ -38,7 +38,9 @@ exiftool $1.pdf | while read l ; do
 done
 for i ({1..${#toremove}}) toremove[$i]=-${toremove[$i]}=
 exiftool -zip -overwrite_original -quiet \
-    -tagsFromFile $1 -Producer\>Creator \
-    ${=toremove} $1.pdf
-qpdf --linearize --compress-streams=y $1.pdf $1.pdf.pdf
+    -tagsFromFile $1 -Creator\<Producer $1.pdf
+exiftool -zip -overwrite_original -quiet \
+    -tagsFromFile $1 -Producer\>Creator ${=toremove} $1.pdf
+[[ -z $LINEARIZE ]] || LINEARIZE=--linearize
+qpdf $LINEARIZE --compress-streams=y $1.pdf $1.pdf.pdf
 mv $1.pdf.pdf $1.pdf