summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/pdfjam/pdfpun
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-04-14 18:29:31 +0000
committerKarl Berry <karl@freefriends.org>2010-04-14 18:29:31 +0000
commit299bdb0274ac6021f90b883511b05fe7b54b3f84 (patch)
tree051ee04434aaa2533b7cd95a5ae0737739291632 /Master/texmf-dist/scripts/pdfjam/pdfpun
parent2f62a5fe6f4a15971e376276ff7a5abaf17fccbf (diff)
new scripts pdfjam 2.01 (14apr10)
git-svn-id: svn://tug.org/texlive/trunk@17868 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/scripts/pdfjam/pdfpun')
-rwxr-xr-xMaster/texmf-dist/scripts/pdfjam/pdfpun72
1 files changed, 72 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/pdfjam/pdfpun b/Master/texmf-dist/scripts/pdfjam/pdfpun
new file mode 100755
index 00000000000..eee08a05d33
--- /dev/null
+++ b/Master/texmf-dist/scripts/pdfjam/pdfpun
@@ -0,0 +1,72 @@
+#!/bin/sh
+##
+## pdfpun: A shell program to n-up pages of a PDF file with
+## the n-upped pages ordered from right to left
+##
+## Author David Firth (http://go.warwick.ac.uk/dfirth)
+##
+## This is a simple wrapper for (three runs of) pdfjam, version 2.01
+##
+##
+E_USAGE=64 ## for a command line usage error
+##
+for arg in "$@"; do
+ case "$arg" in
+ --batch)
+ printf "pdfpun ERROR: the --batch option is not allowed\n" 1>&2;
+ exit "$E_USAGE" ;;
+ --no-tidy)
+ n='--no-tidy' ;;
+ --quiet | -q)
+ q='-q' ;;
+ --checkfiles)
+ c='--checkfiles' ;;
+ *) continue ;;
+ esac
+done
+sourceFile="$1" ;
+shift ;
+##
+## Some (very) minimal checking of the first argument:
+##
+if test ! -e "$sourceFile" ;
+then
+ printf "pdfpun ERROR: first argument must be a PDF file\n" ;
+ exit $E_USAGE ;
+fi
+if test "$sourceFile" = /dev/stdin ;
+then
+ if tty -s ; then
+ printf "pdfpun ERROR: tty is connected to connected to stdin, no PDF file found\n"
+ exit $E_USAGE ;
+ fi
+fi
+##
+## That's all the argument checking!
+##
+pageSpec="-" ## the default
+case "${1}" in
+ --* | "")
+ ;;
+ *) ## a page spec was given
+ pageSpec="$1" ;
+ shift ;;
+esac
+case "${1}" in
+ --outfile)
+ outFile="$2" ;
+ shift 2 ;;
+ *)
+ ;;
+esac
+if test "$outFile" = "" ;
+then
+ printf "pdfpun ERROR: no output file specified\n" 1>&2 ;
+ exit "$E_USAGE" ;
+fi
+pdfjam --reflect true $n $q $c "$sourceFile" "$pageSpec" -o /dev/stdout | \
+ pdfjam --landscape --nup 2x1 "$@" -o /dev/stdout | \
+ pdfjam --suffix nup --reflect true --fitpaper true $n $q -o "$outFile"
+
+
+