diff options
-rwxr-xr-x | localpdf2ps2pdf | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/localpdf2ps2pdf b/localpdf2ps2pdf index 686d000..7fe0a17 100755 --- a/localpdf2ps2pdf +++ b/localpdf2ps2pdf @@ -11,23 +11,23 @@ set -e PRG="$(basename "$0")" # Default options -PDFTOPSOPTS="-preload -paper match" +PDF2PSOPTS="" PS2PDFOPTS="-dDownsampleColorImages=true -dColorImageResolution=150" showhelp() { cat <<EOF -Usage: $PRG INFILE [ OUTFILE ] [ pdftops opts ] [ -- ps2pdf opts ] +Usage: $PRG INFILE [ OUTFILE ] [ pdf2ps opts ] [ -- ps2pdf opts ] Defaults: OUTFILE: INFILE with trailing ".pdf" replaced with "_lowres.pdf". - pdftops: $PDFTOPSOPTS + pdf2ps: $pdf2psOPTS ps2pdf: $PS2PDFOPTS Examples: - $PRG file.pdf -f 7 -l 9 + $PRG file.pdf dFirstPage=7 -dLastPage=9 $PRG file.pdf -- -dPDFA -dPDFACompatibilityPolicy=1 $PRG file.pdf -- -dPDFSETTINGS=/screen - $PRG file.pdf -level3 -- -dPDFSETTINGS=/prepress + $PRG file.pdf -dLanguageLevel=3 -- -dPDFSETTINGS=/prepress First example above picks pages 7-9. Second example above reduces PDF complexity. @@ -48,7 +48,7 @@ exit1() { infile= outfile= -pdftopsopts= +pdf2psopts= pstopdfopts= while [ $# -gt 0 ]; do case $1 in @@ -61,7 +61,7 @@ while [ $# -gt 0 ]; do break ;; -*) - pdftopsopts="$pdftopsopts $1" + pdf2psopts="$pdf2psopts $1" shift ;; *) @@ -80,14 +80,14 @@ ps2pdfopts="$@" # Use defaults if not overridden outfile="${outfile:-$(basename "$infile" .pdf)_lowres.pdf}" -pdftopsopts="${pdftopsopts:-$PDFTOPSOPTS}" +pdf2psopts="${pdf2psopts:-$PDF2PSOPTS}" ps2pdfopts="${ps2pdfopts:-$PS2PDFOPTS}" [ ! -e "$outfile" ] || exit1 "Output file already exists" tmpfile=$(mktemp -t "$PRG.XXXXXXXXXX") || exit 1 -pdftops $pdftopsopts "$infile" "$tmpfile" || rm "$tmpfile" +pdf2ps $pdf2psopts "$infile" "$tmpfile" || rm "$tmpfile" ps2pdf $ps2pdfopts "$tmpfile" "$outfile" rm "$tmpfile" |