Subject: Re: Tiny NetBSD print server (?)
To: B. James Phillippe <bryan-spamtrap0@darkforest.org>
From: Richard Rauch <rauch@rice.edu>
List: netbsd-users
Date: 04/13/2002 07:03:37
Yes, you can print to non-PostScript printers.  Many things use PostScript
as an output format, though.  To bridge the gap, you will probably find
the GhostScript package useful.  You may already have it installed if you
have TeX, GhostView (gv), or KDE (GNOME, too?) installed.  GhostScript
reads PostScript (various levels) and PDF, and emits any of a wide range
of output formats.  The only caveat is that it's not always clear which
output device (printer driver) is the best back-end to use for your
printer.  (E.g., there are several laserjet and lj* output forms for
GhostScript, but pxlmono seems best for the printer that I have---usually,
anyway.)


Yes, it's realtively simple to set up print-filters.  Rather than using
MagicFilter, I actually use multiple printcap entries to specify virtual
printers (each of which does specialized processing).  Here, for example,
is my ``ps'' (PostScript) printcap entry:

 /~~~ printcap excerpt

ps|PostScript printer:\
        :lp=/dev/ulpt0:sd=/var/spool/lpd/ps:lf=/var/log/lpd/ps:\
        :sh:\
        :of=/usr/local/libexec/printer-filters/ps:

 \___ printcap excerpt

(The ulpt0 is a USB<->parallel converter.  On i386, the built in parallel
port causes lots of overhead to use and seems to go slowly.)

/usr/local/libexec/printer-filters/ps is just a script that I wrote which
acts as a wrapper for GhostScript.  (I recall that the printcap parsing
rules limit what you can do by way of parameters to if= and of= filters.
So, I just defer those details to a script.)

Here's the filter /usr/local/libexec/printer-filters/ps used by ``ps'':


 /~~~ /usr/local/libexec/printer-filters/ps

#!/bin/sh

/usr/pkg/bin/gs -sDEVICE=pxlmono -q -sOutputFile=- -

 \___ /usr/local/libexec/printer-filters/ps

...which transforms PostScript into pxlmono, which the print-system then
dumps to the printer.

pxlmono is apparently a structured graphic language that some laser
printers support.  It is *not* the same as the laserjet or various lj*
output formats that GhostScript also supports.  Those latter formats
appear to be bitmapped formats and tend to be slower (and, depending on
your printer, of lower quality) than pxlmono.

(There are times when pxlmono isn't so hot, and I more or less manually
specify another printing method.  E.g., via my ``ps300'' (300 dpi
rendering of PostScript) or by running GhostScript by hand and sending the
result to the ``raw'' virtual printer that I defined.))

This isn't automated as MagicFilter is.  But it works well for me.


...of course, this only deals with getting a computer to print on a
locally attached network.  Once you've got to that point, you want to
enable the computer to act as a print-server on your home network (but one
step at a time...).


Re. the little Ethernet<->parallel gadget: It looks neat.  I kind of wish
that I had one, if they don't have any silly MS-WINDOWS dependancy.
However, there is one drawback:

I assume that they don't provide PostScript support.  To support such an
interface, you would presumably have to set up filtering on *every*
computer.

If, instead, you stick to the idea of a print server running NetBSD, you
can drop in any filters that you like on just the *one* machine, and
everything else can let the one machine do the transformations.


Side note: I don't know how well the Multia performs.  I've heard that
it's a bit anemic, so you might go to some more lengths to get the
filtering done on a more pwerful system.  I don't think that the native
BSD lpr system has any nice features to help with this...but you might
still be able to do it by havig one system's printcap entry sink to
/dev/null, but the *filter* could explicitly send the data to another
printcap virtual printer (via lpr), which takes the data to the Multia for
actual printing.  But if the Multia is diskless, that would probably end
up spooling the data via NFS...that runs up a silly amount of traffic,
though probably not enough to really bother anybody.

Anyway, just a tangential thought.  (^&


  ``I probably don't know what I'm talking about.'' --rauch@math.rice.edu