From 48a658728a36b7e4e2df161c8a1e9195ea730821 Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Mon, 17 Mar 2008 12:18:09 +0000 Subject: Add new script to downsample PDF files. --- localpdf2pdfscreen | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100755 localpdf2pdfscreen (limited to 'localpdf2pdfscreen') 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 <&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" -- cgit v1.2.3