forked from tobybreckon/pdfjam-extras
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpdfbook
executable file
·63 lines (63 loc) · 1.49 KB
/
pdfbook
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#!/bin/sh
##
################################################################################
##
## pdfbook: Rearrange pages of one or more PDF files into 2-up signatures
##
## (c) 2019: David Firth (http://go.warwick.ac.uk/dfirth, original author) + Marco Pessotto
## License: GPL (https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt)
##
## This is a simple wrapper for pdfjam, version N.NN
##
################################################################################
##
case $1 in
--short-edge)
shortedge=true ;
shift ;
;;
*)
;;
esac
for arg
do
case $arg in
--signature*)
## catches both --signature and --signature*
signature=true ; break
;;
*) ;;
esac
done
##
################################################################################
##
## If $signature is empty, we need to use a default:
##
if test -z "$signature" ; then
signature="--signature 4"
else
signature=""
fi
##
################################################################################
##
## Make the call to pdfjam:
##
if test -z "$shortedge"
then
exec pdfjam --landscape --suffix book $signature "$@"
else
(kpsewhich everyshi.sty >/dev/null) || {
echo "the 'everyshi' package is not installed."; exit 1
}
exec pdfjam --landscape --suffix book $signature \
--preamble '\usepackage{everyshi}
\makeatletter
\EveryShipout{\ifodd\c@page\pdfpageattr{/Rotate 180}\fi}
\makeatother
' "$@"
fi
##
################################################################################
##