On 4 Nov 2002, Stacey Roberts wrote:

> Input filter., I take it you're referring to smbprint. Forgive me, but I
> really know very little about printing as it is, and would appreciate
> guidance here.

Okay, quick overview: lpd is the line printer daemon.  It runs all the
time, waiting for print jobs.  The printers it can use are defined in
/etc/printcap.  lpr is used to submit print jobs.

Sometimes you have to translate what is submitted as a print job into
what the printer wants.  For instance, Unix end-of-lines are plain
linefeeds rather than the more common CR/LF.  An input filter can be
used to convert what you have to what you need.  Chapter 11 in the
Handbook goes into this a little bit, and does cover the stairstepping
case.  Input filters are the if= lines in /etc/printcap entries.  As an
example, here's a Perl input filter that will fix the stairstepping
problem by translating linefeeds into CR/LF:

#!/bin/sh
/usr/bin/perl -pe 's/\n/\r\n/s/g;'

Create that as the file crlf in /usr/local/libexec, and use chmod +x to
make it executable.  Then put this in your /etc/printcap:

lp:\
        :lp=/dev/lpt0:\
        :sh:\
        :lf=/var/log/lpd-errs:\
        :if=/usr/local/libexec/crlf:\
        :sd=/var/spool/output/lpd/lp:

That's a printcap entry that says the printer device is /dev/lpt0,
suppress headers, the log file is lpd-errs, the input filter is the file
you just made, and the spool directory is in /var.  You have to create
that spool directory, and set the ownerships.  Again, see the Handbook
Printing chapter for that.  (You may also need to have it add a form
feed at the end of the job, which I think is :ff:, but can't recall
exactly.)

> I've ready through smbprint, and it doesn't mention print-control chars
> that are included anywhere.., so are the carraige-return and line-feed
> control chars to be included by myself before copying smbprint to the
> location referenced here: "`dirname $0`/smbclient"?
 
I haven't used printing through Samba, but I'd get the basic
/etc/printcap setup completed before going on to printing through Samba.

The other option has also been mentioned: apsfilter and other "print
filter" packages generally detect what kind of thing you're printing and
apply the appropriate filters.  I haven't tried them; I'd rather control
/etc/printcap and filtering directly myself.

-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