-
Notifications
You must be signed in to change notification settings - Fork 0
/
booklet
executable file
·46 lines (36 loc) · 868 Bytes
/
booklet
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
#!/bin/bash
debug=false
if [ $# -eq 0 ]; then
echo "direct booklet \"Unknown\" \"Print a document in booklet form\""
exit 0
fi
out=${DEVICE_URI#booklet:/}
user=$2
title=$3
tmpdir=$(mktemp -d /tmp/print-$(date +'%Y%m%d%H%M%S')-XXXXX)
tmpfile0=$tmpdir/cmdline
tmpfile1=$tmpdir/0_orig.ps
tmpfile2=$tmpdir/1_after-fixtd.ps
tmpfile3=$tmpdir/2_after-psbook.ps
tmpfile4=$tmpdir/3_final.ps
tmpfile5=$tmpdir/output
if $debug;
then
tmpfile0=/dev/null
tmpfile1=/dev/null
tmpfile2=/dev/null
tmpfile3=/dev/null
tmpfile4=/dev/null
tmpfile5=/dev/null
fi
echo $* > $tmpfile0
(
cat $6 | tee $tmpfile1 | fixtd -tumble | tee $tmpfile2 | psbook | tee $tmpfile3| /usr/bin/pstops "2:[email protected](21cm,0)[email protected](21cm,14.85cm)" | tee $tmpfile4 | lpr -T "$title" -U "$user" -P "$out"
) 2>&1 | tee $tmpfile5
if $debug;
then
chmod -R a+rx $tmpdir
else
rm -rf $tmpdir
fi
exit 0