Subject: Re: NetBSD and printing
To: Tim Rightnour <root@garbled.futureone.com>
From: Brett Lymn <blymn@baea.com.au>
List: netbsd-help
Date: 12/16/1997 23:09:14
According to Tim Rightnour:
>
>I just so happen to have figured it out, and have it
>set up currenty to share printers.  IE: I have a Epson Stylus 500 printer
>attached to my machine red_scorp.  It can't handle postscript.. so I have some
>scripts that handle the conversions for me..

Cute but you are going about this the long way.  Instead of having a
script that does the conversion you should be wrapping that up in the
printcap entry something like this:

epson_ps|Epson printer with PS:\
        :lp=/usr/spool/lpdps/.null:sd=/usr/spool/lpdps:\
        :lf=/var/log/lpd-errs:mx#0:\
        :if=/usr/spool/lpdps/if:

Firstly, carefully note the /usr/spool/lpdps/.null file, touch this
file into existence to fool the lpd that it is talking to a local
device otherwise the input filter (if) will not be invoked
and in /usr/spool/lpdps have a file called if that has this (please
make scripts shell scripts, sh is much better for scripting):

#!/bin/sh
exec gs -sDEVICE=stcolor -dMicroweave -sDithering="fscmyk" -r360x360 -dNOPAUSE -q -sOutputFile="|lpr -h -Pst500" stcolor.ps - -c quit

Or whatever the incantation is for making ghostscript act as a filter
(I cannot remember what the exact arguments are and the script I had
for doing it seems to have suffered bit rot).  Anyway the idea is to
get the if script (call it anything you like) to take postscript in on
standard input and stuff the epson codes to the real printer via lpr.
This means that you don't need to invoke a special script you just
queue the job - if you want to get more sophisticated then you can
autosense a PS job by the leading %PS and select the correct thing to
do.  This is not an unusual idea, in Suns NeWSPrint they had a huge
script that handled all the printcap filters and also detected whether
or not the file was postscript and did the conversion if appropriate.

I used to do this sort of thing with a HP paintjet at work,
unfortunately the device went away and the so did the machine driving
it taking my carefully crafted scripts with it.  It is cute being able
to print postscript to a known non-postscript device and have the
correct thing come out.

Fun and games with lpd is not just limited to making a postscript
printer out of nothing but you can do other things like have a fax
printer.  I had a test fax printer setup that would pick destination
phone numbers out of our (then) standard fax document and use this
number along with the file to dump the thing to a fax modem using
Hylafax.  The beauty of this is that the client need know nothing
about how to send the fax, they just print the postscript to a printer
destination and the system takes care of it.



-- 
Brett Lymn, Computer Systems Administrator, British Aerospace Australia
===============================================================================
  What do you get when you cross a cantaloup with a dog?        Melancholy :-P