Several months ago I posted a note asking how to inject
printer control characters into a printstream under BSD.
Since I received no answer, I looked into it further and
offer the following. Written on a Sun4 using HP Laserjet III.
I'll show the standard entry and a compressed print entry.
Assuming I've made no typos ....
=====
/etc/printcap
#
lp|lw:\
:sh:lp=/dev/ttyb:br#9600:\
:mx#0:\
:sd=/usr/spool/lw:\
:lf=/usr/spool/lw/lw-log:\
:fc#0177777:fs#0006320:\
:xc#0177777:xs#044000
#
hprp|hp60.132RP|HP 60 Line 132 Col 8.5x11 Portrait:\
:sh:lp=/dev/ttyb:br#9600:\
:mx#0:\
:sd=/usr/spool/lw:\
:lf=/usr/spool/lw/lw-log:\
:fc#0177777:fs#0006320:\
:xc#0177777:xs#044000:\
:of=/usr/local/print/hp60.132RP
#
==========
File: /usr/local/print/hp60.132RP
#!/bin/sh -
IFS=
# In each of the 'print' strings below, replace each letter 'q' with
# the escape character '\033'. Using 'vi' this would be done by
# a) switch to insert mode; b) press cntl-v; c) press Esc
awk '
BEGIN {
#
# Set up for
# Name: hp60.132RP
# Type: HP Laserjet
# Page: 60 Lines
# Cols: 132 columns
# Orientation: portrait
# Paper: 8.5 x 11
#
print "qEq&k2S"
# (if parallel interface, use instead) print "qEq&k2Gq&k2S"
# That is, in all print strings, replace the first two bytes 'qE'
# with 'qEq&k2G'
}
{
#
# print the input stream
#
print $0
}
END {
#
# reset printer back to the default condition
#
print "qE"
}
'
==========
Here are some additional strings for BEGIN blocks
hprrp|hp89.132RP|HP 89 Line 132 Col 8.5x11 Portrait:
print "qEq&l5.39Cq&k2S"
hprl|hp45.176RL|HP 45 Line 176 Col 8.5x11 Landscape:
print "qEq&l1Oq&k2S"
hprrl|hp66.176RL|HP 45 Line 176 Col 8.5x11 Landscape:
print "qEq&l1o5.45Cq&k2S"
hpll|hp45.226|HP 45 Line 226 Col 8.5x14 Landscape:
print "qEq&l84p1Oq&k2S"
hplll|hp66.226LL|HP 66 Line 226 Col 8.5x14 Landscape:
print "qEq&l84p1o5.45Cq&k2S"
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:44 CDT