summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/scripts/pdfjam/pdfjam-pocketmod
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/scripts/pdfjam/pdfjam-pocketmod')
-rwxr-xr-xMaster/texmf-dist/scripts/pdfjam/pdfjam-pocketmod54
1 files changed, 54 insertions, 0 deletions
diff --git a/Master/texmf-dist/scripts/pdfjam/pdfjam-pocketmod b/Master/texmf-dist/scripts/pdfjam/pdfjam-pocketmod
new file mode 100755
index 00000000000..0bebe86961c
--- /dev/null
+++ b/Master/texmf-dist/scripts/pdfjam/pdfjam-pocketmod
@@ -0,0 +1,54 @@
+#!/bin/sh
+##
+## pdfjam-pocketmod: A shell program to make an 8-page PDF document
+## into an 8-up file with pages ordered and oriented for folding as
+## a pocket-sized booklet, as described at http://repocketmod.com/
+##
+## Author David Firth (http://go.warwick.ac.uk/dfirth)
+##
+## This is a simple wrapper for (three runs of) pdfjam, version 2.01
+##
+##
+## It's hard (?) to set up this particular script to read from /dev/stdin,
+## so we'll just insist that the first argument is a file:
+##
+E_USAGE=64 ## for a command line usage error
+for arg in "$@"; do
+ case "$arg" in
+ --batch)
+ printf "pdfjam-pocketmod 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' ;;
+ *)
+ ;;
+ esac
+done
+##
+sourceFile="$1" ;
+shift ;
+##
+## Some (very) minimal checking of the first argument:
+##
+if test ! -f "$sourceFile" ;
+then
+ printf "pdfjam-pocketmod ERROR: first argument must be a PDF file\n" ;
+ exit $E_USAGE ;
+fi
+##
+## That's all the argument checking!
+##
+pageSpec="1-8" ## the default page spec
+case "${1}" in
+ --* | "") ## no page spec was given
+ ;;
+ *) ## a page spec was given, so use it
+ pageSpec="$1" ;
+ shift ;;
+esac
+pdfjam $n $q $c -o /dev/stdout "$sourceFile" "$pageSpec" | pdfjam --angle 180 $n $q -o /dev/stdout /dev/stdin '1,8,7,6' | pdfjam --nup 4x2 --landscape --frame true "$sourceFile" '2-5' /dev/stdin "$@"
+