summaryrefslogtreecommitdiff
path: root/localpdf2pdfscreen
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2008-03-17 13:39:17 +0000
committerJonas Smedegaard <dr@jones.dk>2008-03-17 13:39:17 +0000
commit732b9aa2553b4a3709361230861bc5fb3985465c (patch)
tree3493ccb3bf97fe273d0e87c02ff66e948cd4716c /localpdf2pdfscreen
parent2e54df879d685dcefb6771276d43a412db852623 (diff)
Improved default outfile. Show defaults in help. Fix another typo in option parsing.
Diffstat (limited to 'localpdf2pdfscreen')
-rwxr-xr-xlocalpdf2pdfscreen16
1 files changed, 9 insertions, 7 deletions
diff --git a/localpdf2pdfscreen b/localpdf2pdfscreen
index 442eb20..cd88a97 100755
--- a/localpdf2pdfscreen
+++ b/localpdf2pdfscreen
@@ -3,29 +3,31 @@
# /usr/local/bin/localpdf2pdfscreen
# Copyright 2008 Jonas Smedegaard <dr@jones.dk>
#
-# $Id: localpdf2pdfscreen,v 1.4 2008-03-17 13:07:47 jonas Exp $
+# $Id: localpdf2pdfscreen,v 1.5 2008-03-17 13:39:17 jonas Exp $
#
# Downsize PDF file.
#
-# TODO: Use *_lowres.pdf as default outfile
-#
set -e
PRG="$(basename "$0")"
# Default options
-PDFTOPSOPTS="-paper match"
+PDFTOPSOPTS="-preload -paper match"
PS2PDFOPTS="-dPDFSETTINGS=/screen"
showhelp() {
cat <<EOF
Usage: $PRG INFILE [ OUTFILE ] [ pdftops opts ] [ -- ps2pdf opts ]
-If missing, OUTFILE is INFILE.pdf (ie. double pdf extension).
+Defaults:
+ OUTFILE: INFILE with trailing ".pdf" replaced with "_lowres.pdf".
+ pdftops: $PDFTOPSOPTS
+ ps2pdfopts $PS2PDFOPTS
Examples:
$PRG newspaper.pdf newspaper_screenready.pdf
+ $PRG newspaper.pdf -level3 --
EOF
}
@@ -59,7 +61,7 @@ while [ $# -gt 0 ]; do
if [ -z "$infile" ]; then
infile="$1"
elif [ -z "$outfile" ]; then
- outfile="$1" ]
+ outfile="$1"
else
exit1 "Too many parameters"
fi
@@ -70,7 +72,7 @@ done
ps2pdfopts="$@"
# Use defaults if not overridden
-outfile="${outfile:-$infile.pdf}"
+outfile="${outfile:-$(basename "$infile" .pdf)_lowres.pdf}"
pdftopsopts="${pdftopsopts:-$PDFTOPSOPTS}"
ps2pdfopts="${ps2pdfopts:-$PS2PDFOPTS}"