about summary refs log tree commit diff
path: root/converter/pbm/pbmtoppa/INSTALL-MORE
blob: 2565c740d5803ecfea567276ae4472e2e158ea0d (plain) (blame)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
Installation of ppa-0.8.5 with S.u.S.E. Linux
(Special Installation with Hp820 and paper size A4)
___________________________________________________


0. Introduction

This text describes how to use the package pbm2ppa written by Tim Norman
with the S.u.S.E Linux System. This program allows the use of GDI (Winows
only) printers with Linux. The program pbm2ppa is actually a converter
between the two formats pbm (an output format from ghostscript) and the
format understood by the HP printers 720, 820 and 1000. So anyway we have to
use ghostscript to produce pbm (or faster: pbmraw) files. To print ascii
files there is an extra step invoking enscript to convert the ascii to
postscript files.  I rather constructed two new printer spoolers in printcap
from scratch then using apsfilter: one for postscript files and another for
ascii files. I welcome solutions in combination with the apsfilter script.
The installation is quiet easy - after seven steps you should be ready to
print postscript and ascii files, but it may take some time to adjust the
constants properly, don't despair.

0.1. Modifications

This was modified on October 18, 1998 by Tim Norman to conform to the new
A4 paper support in version 0.8.5.


1. Installation of program package ppa-0.8.5

Get the packate at http://www.rpi.edu/~normat/technical/ppa/ and compile it
with

# make 820

or put in your printer number (720, 820 or 1000) (see also INSTALL and README
file).


2. To adjust the paper size to DIN A4, use the -s a4 option to pbm2ppa or
change your pbm2ppa.conf file to read "papersize a4" (see step 5).


3. You can now calibrate the printer with 

For US size paper:
# pbmtpg | pbm2ppa > /dev/lp1 ( as root )
For A4 size paper:
# pbmtpg -a4 | pbm2ppa -s a4 > /dev/lp1 ( as root )

or you try first printing some sample files and calibrate in step 5.


4. Now you can print (postscript) files with a shell script like this:

Contents of print:

cat $1 | gs -sDEVICE=pbmraw -q -dNOPAUSE -r600 -sOutputFile=- - | \
pbm2ppa - - >/dev/lp1

After changing the file modes (i.e. chmod 755 print) you are able to print
a postscript file invoking the shell script print like:

# print filename.ps


To print ascii files just extend the script print with the use of enscript:

Contents of printascii:

enscript -2rj -p- $1 | \
gs -sDEVICE=pbmraw -q -dNOPAUSE -r600 -sOutputFile=- - | \
pbm2ppa - - >/dev/lp1


Check the manpage for enscript to adjust the options to your flavour.
Now you can also print ascii files with

# printascii filename.ascii


5. It may be possible that you have to recalibrate your printer (see 3.)

Here follow the results from my calibration after printing ascii files with the
shell script printascii (see 4.). The program pbm2ppa takes the arguments in the
following order:

1. shell arguments
2. config file /etc/pbm2ppa.conf
3. Compiled options from default.h

So whenever you invoke pbm2ppa without arguments the program uses the options
stored in the file /etc/pbm2ppa.conf, so I suggest to leave there a copy of
this file.

# Sample configuration file for the HP820 and DIN A4 paper size
#
# This file will be automatically read upon startup if it's placed in
# /etc/pbm2ppa.conf
#

version  820

papersize	a4

xoff      0 # \ Adjust these for your printer.
yoff    -600 # / (see CALIBRATE)

# 1/4 inch margins all around (at 600 DPI)
top       50
bottom    50
left      50
right     50


6. To integrate the converter into the Linux system we create two printer
spooler in /etc/printcap. One to print postscript files and another to print
plain ascii files.

Contents of /etc/printcap:

lp:\
        :lp=/dev/lp1:\
        :sd=/var/spool/lpd/lp:\
        :lf=/var/spool/lpd/lp/log:\
        :af=/var/spool/lpd/lp/acct:\
        :if=/usr/local/bin/ps.if:\
        :la:mx#0:\
        :sh:sf:

ascii:\
        :lp=/dev/lp1:\
        :sd=/var/spool/lpd/ascii:\
        :lf=/var/spool/lpd/ascii/log:\
        :af=/var/spool/lpd/ascii/acct:\
        :if=/usr/local/bin/ascii.if:\
        :la:mx#0:\
        :sh:sf:


Here follow some explanations (for more information consult the printcap
manpage). We use the lp1 device, have two spool directories
/var/spool/lpd/ascii and /var/spool/lpd/lp (better you create them now) a log
file (lf) an accounting file (af), suppress form feeds (sf), suppress printing
of burst page header (sh) and the maximum file size is unlimited (mx#0). To
integrate the converter pbm2ppa into the system we use two input filters. Maybe
you have a better solution in combination with apsfilter but until then try
this way. Actually, the two input filter files are almost identical with the
shell scripts print and printascii we created in step 4.

File /usr/local/bin/ascii.if:

#! /bin/sh
enscript -2rj -p- | \
gs -sDEVICE=pbmraw -q -dNOPAUSE -r600 -sOutputFile=- - | \
/usr/local/bin/pbm2ppa - -


File /usr/local/bin/ps.if:

#! /bin/sh
gs -sDEVICE=pbmraw -q -dNOPAUSE -r600 -sOutputFile=- - | \
/usr/local/bin/pbm2ppa - -


7. Place pbm2ppa in the directory /usr/local/bin. Now you are ready to print
files with

# lpr filename.ps

and

# lpr -P ascii filename.ascii

like you are used to it.

Enjoy


19. May 1998

Michael Buehlmann
Badenerstrasse 285
8003 Zuerich
Switzerland

mbuehlma@stud.ee.ethz.ch