aboutsummaryrefslogtreecommitdiffstats
path: root/cli/shrinkpdf.sh
diff options
context:
space:
mode:
authorAaron LI <aly@aaronly.me>2017-12-29 17:22:21 +0800
committerAaron LI <aly@aaronly.me>2017-12-29 17:22:21 +0800
commit5322969e673f283e3d9413d925e9b2abcacde2af (patch)
tree717cfe3453780fe9714d69eeeb917f30c61ad3c2 /cli/shrinkpdf.sh
parent2fc7288e321e637c97c1826a7ccb70b9a041373d (diff)
downloadatoolbox-5322969e673f283e3d9413d925e9b2abcacde2af.tar.bz2
Rename shrinkpdf.sh and mergepdf.sh
Diffstat (limited to 'cli/shrinkpdf.sh')
-rwxr-xr-xcli/shrinkpdf.sh56
1 files changed, 0 insertions, 56 deletions
diff --git a/cli/shrinkpdf.sh b/cli/shrinkpdf.sh
deleted file mode 100755
index 9f68c4c..0000000
--- a/cli/shrinkpdf.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/bin/sh
-#
-# Shrink the size of PDF files by adjust its quality using `gs` (GhostScript).
-#
-# Aaron LI
-# 2013/09/18
-#
-
-case "$1" in
- -[hH]*|--[hH]*)
- printf "usage:\n"
- printf " `basename $0` in=<input.pdf> out=<output.pdf> quality=<screen|ebook|printer|prepress> imgdpi=<img_dpi>\n"
- exit 1
- ;;
-esac
-
-getopt_keyval() {
- until [ -z "$1" ]
- do
- key=${1%%=*} # extract key
- val=${1#*=} # extract value
- keyval="${key}=\"${val}\""
- echo "## getopt: eval '${keyval}'"
- eval ${keyval}
- shift # shift, process next one
- done
-}
-getopt_keyval "$@"
-
-if [ -z "${in}" ] || [ -z "${out}" ]; then
- printf "Error: 'in' or 'out' not specified\n"
- exit 2
-fi
-quality=${quality:-ebook}
-imgdpi=${imgdpi:-120}
-
-printf "# in: ${in}
-# out: ${out}
-# quality: ${quality}
-# imgdpi: ${imgdpi}\n"
-
-gs -dNOPAUSE -dBATCH -dSAFER \
- -sDEVICE=pdfwrite \
- -dCompatibilityLevel=1.4 \
- -dPDFSETTINGS="/${quality}" \
- -dEmbedAllFonts=true \
- -dSubsetFonts=true \
- -dColorImageDownsampleType=/Bicubic \
- -dColorImageResolution=${imgdpi} \
- -dGrayImageDownsampleType=/Bicubic \
- -dGrayImageResolution=${imgdpi} \
- -dMonoImageDownsampleType=/Bicubic \
- -dMonoImageResolution=${imgdpi} \
- -sOutputFile=${out} \
- ${in}
-