diff options
author | Jonas Smedegaard <dr@jones.dk> | 2024-01-05 03:28:36 +0100 |
---|---|---|
committer | Jonas Smedegaard <dr@jones.dk> | 2024-01-05 03:28:36 +0100 |
commit | dd2db3ad3dfdd3bb74775b87701c28e0b923da72 (patch) | |
tree | d39130c5f76da11ef4dd39f7679179308777f009 /localpdf2pdfscreen | |
parent | 237216476456202bbd7b209ae819981993e51636 (diff) |
rename localpdf2pdfscreen -> localpdf2ps2pdf, optimize for consumer print by default, and improve help output
Diffstat (limited to 'localpdf2pdfscreen')
-rwxr-xr-x | localpdf2pdfscreen | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/localpdf2pdfscreen b/localpdf2pdfscreen deleted file mode 100755 index e2c4d02..0000000 --- a/localpdf2pdfscreen +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/sh -# -# /usr/local/bin/localpdf2pdfscreen -# Copyright 2008 Jonas Smedegaard <dr@jones.dk> -# -# $Id: localpdf2pdfscreen,v 1.5 2008-03-17 13:39:17 jonas Exp $ -# -# Downsize PDF file. -# - -set -e - -PRG="$(basename "$0")" - -# Default options -PDFTOPSOPTS="-preload -paper match" -PS2PDFOPTS="-dPDFSETTINGS=/screen" - -showhelp() { - cat <<EOF -Usage: $PRG INFILE [ OUTFILE ] [ pdftops opts ] [ -- ps2pdf opts ] - -Defaults: - OUTFILE: INFILE with trailing ".pdf" replaced with "_lowres.pdf". - pdftops: $PDFTOPSOPTS - ps2pdf: $PS2PDFOPTS - -Examples: - $PRG newspaper.pdf newspaper_screenready.pdf - $PRG newspaper.pdf -level3 - -EOF -} - -exit1() { - echo >&2 "ERROR: $1" - exit 1 -} - -[ $# -gt 0 ] || exit1 "Input file missing" - -infile= -outfile= -pdftopsopts= -pstopdfopts= -while [ $# -gt 0 ]; do - case $1 in - -h|--help) - showhelp - exit 0 - ;; - --) - shift - break - ;; - -*) - pdftopsopts="$pdftopsopts $1" - shift - ;; - *) - if [ -z "$infile" ]; then - infile="$1" - elif [ -z "$outfile" ]; then - outfile="$1" - else - exit1 "Too many parameters" - fi - shift - ;; - esac -done -ps2pdfopts="$@" - -# Use defaults if not overridden -outfile="${outfile:-$(basename "$infile" .pdf)_lowres.pdf}" -pdftopsopts="${pdftopsopts:-$PDFTOPSOPTS}" -ps2pdfopts="${ps2pdfopts:-$PS2PDFOPTS}" - -[ ! -e "$outfile" ] || exit1 "Output file already exists" - -tmpfile=$(mktemp -t "$PRG.XXXXXXXXXX") || exit 1 - -pdftops $pdftopsopts "$infile" "$tmpfile" || rm "$tmpfile" -ps2pdf $ps2pdfopts "$tmpfile" "$outfile" - -rm "$tmpfile" - -exit 0 |