On Wed, 5 Mar 2003, Darren Spruell wrote:

> I've seen a couple of sample scripts, but if you have one that works
> specifically with Laserjet, that would suit :)

Ah, that's the beauty of it--it works with any PostScript printer.  (Or
non-PostScript... see below.)

First, the /etc/printcap:

# /etc/printcap



# end

You have to create the spool directories: /var/spool/output/lpd/lp and
lpraw.  I chmod them to daemon:wheel and chmod them to 600.  "laser" is
the hostname of the printer in /etc/hosts.

When you print to lp, the input filter (if=) called checkps sees if the
incoming file is PostScript.  It also detects HP PJL PostScript jobs,
which the example given in the Handbook does not.  If the job is
PostScript, it sends it to the lpraw queue, which is the real printer.
If the job is not PostScript, it uses Enscript to format it and then
sends it to lpraw.  If you know your job is PostScript, you can send it
straight to lpraw in the first place.  Here's the
/usr/local/libexec/checkps program (the fourth line should not wrap):

# Warren Block 01-15-2003
$outname = /^%!|\e%/ ? '| /usr/bin/lpr -Plpraw' : '| /usr/local/bin/enscript -Plpraw';
open(PRT, $outname) or die "can't open pipe: '$!'\n";
print PRT $_;
while (<STDIN>) {
        print PRT $_;

chmod +x the Perl program, and install the print/enscript-letter port.

If you want other computers to be able to print to this one, add their
hostnames to /etc/hosts.lpd.

Not the most efficient of filters, but it's simple and hasn't failed. If
the printer is PCL only, Ghostscript can be added to convert the
PostScript output to PCL.

-Warren Block * Rapid City, South Dakota USA

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-questions" in the body of the message

Reply via email to