summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/pdfreview/pdfshrink.sh
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/doc/latex/pdfreview/pdfshrink.sh')
-rwxr-xr-xMaster/texmf-dist/doc/latex/pdfreview/pdfshrink.sh44
1 files changed, 17 insertions, 27 deletions
diff --git a/Master/texmf-dist/doc/latex/pdfreview/pdfshrink.sh b/Master/texmf-dist/doc/latex/pdfreview/pdfshrink.sh
index 6e273ee5e89..41f31f0d237 100755
--- a/Master/texmf-dist/doc/latex/pdfreview/pdfshrink.sh
+++ b/Master/texmf-dist/doc/latex/pdfreview/pdfshrink.sh
@@ -1,34 +1,24 @@
#!/bin/bash
-
-# this script is part of the pdf-annotation LaTeX package by M. Palmer
-# like all files in the package, it is covered by the LPPL.
-
-# this assumes ghostscript is installed as 'gs - change as needed
-ghostscript="gs"
-
-script_name=`basename "$0"`
+INPUTPDF="$1"
if [ -z $1 ]; then
- echo "Usage: $script_name inputfile.pdf [quality [outputfile]]"
+ echo "Usage: pdfshrink inputfile.pdf [quality [outputfile]]"
exit 1
fi
-input_pdf=$1
-
# values for 'quality' argument:
-#
-# 'prepress' is highest quality
-# 'printer' or 'default' are 300dpi, both quite good
-# 'ebook' is 150 dpi; still reasonable on screen
-# 'screen' is 72dpi - looks poor
+#
+# 'prepress' is highest quality,
+# 'ebook' is only 150 dpi
+# 'screen' is 72dpi - looks very poor
+# 'printer' and 'default' are good compromises
-if [ ! -f $input_pdf ]; then
- echo "file $input_pdf not found"
+if [ ! -f "$INPUTPDF" ]; then
+ echo "file $INPUTPDF not found"
exit 1
fi
-# let quality default to 'default'
quality=${2-default}
if [ $quality = 'default' ]; then
@@ -37,24 +27,24 @@ else
suffix=$quality
fi
-output_pdf=${3-${1%.pdf}-${suffix}}
-output_pdf=${output_pdf%.pdf}.pdf
+OUTPUTPDF="${3-${1%.pdf}-${suffix}}"
+OUTPUTPDF="${OUTPUTPDF%.pdf}.pdf"
-echo "converting $input_pdf to $output_pdf using quality '$quality'"
+echo "converting $INPUTPDF to $OUTPUTPDF using quality '$quality'"
-$ghostscript \
- -sDEVICE=pdfwrite \
+gs -sDEVICE=pdfwrite \
-dCompatibilityLevel=1.4 \
-dHaveTransparency=true \
-dFastWebView=true \
+ -dPrinted=false \
-dPDFSETTINGS=/$quality \
-dEmbedAllFonts=true \
-dSubsetFonts=true \
-dNOPAUSE \
-dQUIET \
-dBATCH \
- -sOutputFile="$output_pdf" \
- "$input_pdf"
+ -sOutputFile="$OUTPUTPDF" \
+ "$INPUTPDF" 2> /dev/null
-chmod 644 "$output_pdf"
+chmod 644 "$OUTPUTPDF"
echo "done"