diff options
author | Karl Berry <karl@freefriends.org> | 2019-02-23 22:17:01 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-02-23 22:17:01 +0000 |
commit | c714634364a1153c6b21311a21d79fc932181ecc (patch) | |
tree | 164cbec9f2831360c71ad42790b34432eac0b7e0 /Master/texmf-dist/doc/latex/pdfreview/pdfshrink.sh | |
parent | 28403cf284b6470974feb06d05fa84b83efcbe0c (diff) |
pdfreview (22feb19)
git-svn-id: svn://tug.org/texlive/trunk@50100 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/pdfreview/pdfshrink.sh')
-rwxr-xr-x | Master/texmf-dist/doc/latex/pdfreview/pdfshrink.sh | 44 |
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" |