diff options
Diffstat (limited to 'localpdf2pdfscreen')
-rwxr-xr-x | localpdf2pdfscreen | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/localpdf2pdfscreen b/localpdf2pdfscreen new file mode 100755 index 0000000..9f5fc0d --- /dev/null +++ b/localpdf2pdfscreen @@ -0,0 +1,37 @@ +#!/bin/sh + +set -e + +PRG="$0" + +showhelp() { + cat <<EOF +Usage: $PRG INFILE [ OUTFILE ] + +If missing, OUTFILE is INFILE.pdf (ie. double pdf extension). + +Examples: + $PRG newspaper.pdf newspaper_screenready.pdf + +EOF +} + +exit1() { + echo >&2 "ERROR: $1" + exit 1 +} + +if [ $# -eq 0 ]; then + showhelp + exit1 "Not enough parameters" +fi + + +infile="$1" +tmpfile=$(mktemp -t "$PRG.XXXXXXXXXX") || exit 1 +outfile="${2:-$infile.pdf}" + +[ ! -e "$outfile" ] || exit1 "Output file already exists" + +pdftops -paper match "$infile" "$tmpfile" +ps2pdf -dPDFSETTINGS=/screen "$tmpfile" "$outfile" |