• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/sh
2#
3# This is a xerox script for Laserjet Printer.
4# To get use of Postscript change the Printercommand and enable the
5# command at the end of this File.
6#
7DEV=mustek:/dev/scanner
8RES=300
9PAPERTYPE=letter
10#PAPERTYPE=a4
11PRINTERTYPE=ps
12#PRINTERTYPE=lj
13#
14# Non-printable area (left, right, top, and bottom margins):
15#
16LMARGIN=0.0
17RMARGIN=0.0
18TMARGIN=0.25
19BMARGIN=0.0
20#
21# Scanner-specific options:
22#
23DEVOPTS="--mode Gray"
24#DEVOPTS="$DEVOPTS --custom-gamma=yes --gamma-table [0]0-[64]128-[255]255"
25#DEVOPTS="$DEVOPTS --backtrack=yes"	 # needed for Mustek 12000SP
26#
27# Printer Command/Resolution
28PRES=$RES # change this if other Res. is desired
29#
30# Papersize in inch
31if [ "$PAPERTYPE" = "letter" ]; then
32  WIDTH=8; HEIGHT=10
33else
34  # assume a4 paper
35  WIDTH=8.27; HEIGHT=11.69
36fi
37
38SCANWIDTH=`bc <<_EOF_
39scale=3
40$WIDTH-$LMARGIN-$RMARGIN
41_EOF_`
42SCANHEIGHT=`bc <<_EOF_
43scale=3
44$HEIGHT-$TMARGIN-$BMARGIN
45_EOF_`
46#
47SCALE=`bc << _EOF_
48scale=3
4975/$RES
50_EOF_`
51
52if [ "$PRINTERTYPE" = "ps" ]; then
53  POST="pnmtops -rle -scale $SCALE -dpi $PRES | lpr"
54else
55  POST="pgmtopbm | pbmtolj -resolution $PRES | lpr -Praw"
56fi
57
58scanimage -d $DEV \
59	-x $SCANWIDTH\" -y $SCANHEIGHT\" -l $LMARGIN\" -t $TMARGIN\" \
60        --resolution $RES $DEVOPTS | eval $POST
61