summaryrefslogtreecommitdiff
path: root/tools/xerox
blob: 0b2a7c38a0de0daca04d902c0413870d3ef98c50 (plain)
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
#!/bin/sh
#
# This is a xerox script for Laserjet Printer.
# To get use of Postscript change the Printercommand and enable the
# command at the end of this File.
#
DEV=mustek:/dev/scanner
RES=300
PAPERTYPE=letter
#PAPERTYPE=a4
PRINTERTYPE=ps
#PRINTERTYPE=lj
#
# Non-printable area (left, right, top, and bottom margins):
#
LMARGIN=0.0
RMARGIN=0.0
TMARGIN=0.25
BMARGIN=0.0
#
# Scanner-specific options:
#
DEVOPTS="--mode Gray"
#DEVOPTS="$DEVOPTS --custom-gamma=yes --gamma-table [0]0-[64]128-[255]255"
#DEVOPTS="$DEVOPTS --backtrack=yes"	 # needed for Mustek 12000SP
#
# Printer Command/Resolution
PRES=$RES # change this if other Res. is desired
#
# Papersize in inch
if [ "$PAPERTYPE" = "letter" ]; then
  WIDTH=8; HEIGHT=10
else
  # assume a4 paper
  WIDTH=8.27; HEIGHT=11.69
fi

SCANWIDTH=`bc <<_EOF_ 
scale=3
$WIDTH-$LMARGIN-$RMARGIN
_EOF_`
SCANHEIGHT=`bc <<_EOF_ 
scale=3
$HEIGHT-$TMARGIN-$BMARGIN
_EOF_`
#
SCALE=`bc << _EOF_
scale=3
75/$RES
_EOF_`

if [ "$PRINTERTYPE" = "ps" ]; then
  POST="pnmtops -rle -scale $SCALE -dpi $PRES | lpr"
else
  POST="pgmtopbm | pbmtolj -resolution $PRES | lpr -Praw"
fi

scanimage -d $DEV \
	-x $SCANWIDTH\" -y $SCANHEIGHT\" -l $LMARGIN\" -t $TMARGIN\" \
        --resolution $RES $DEVOPTS | eval $POST