printcap

Ed Flecko edflecko at gmail.com
Tue Sep 21 20:12:40 UTC 2010


Dick,
I'm not sure if this will help you, but here's what I did on my
network to print directly to an HP LaserJet on my LAN.

Pick a name (and a few convenient aliases) for the printer, and put
them in the /etc/printcap file.

hp|officehp:\
:sh:\
:rm=192.168.1.50:\
:sd=/var/spool/lpd/officehp:\
:mx#0:\
:lf=/var/log/officehp:\
:if=/usr/local/libexec/if-simple:

hp and officehp -> what I have named my printer (two names)
sh    -> disables a banner from printing
rm	-> I.P. address of the remote printer
sd    -> my spool directory
mx    -> max file size (o=unlimited)
lf    -> error file
if    -> input filter

# mkdir /var/spool/lpd/officehp

# touch /var/log/officehp

# chown daemon:daemon /var/spool/lpd/officehp

# chmod 770 /var/spool/lpd/officehp

# touch /usr/local/libexec/if-simple

# vi /usr/local/libexec/if-simple

#!/bin/sh
#
# if-simple - Simple text input filter for lpd
# Installed in /usr/local/libexec/if-simple
#
# Simply copies stdin to stdout.  Ignores all filter arguments.
/bin/cat && exit 0
exit 2

Now make the file executable:

# chmod 555 /usr/local/libexec/if-simple

Note: A copy of the if-simple script can be found in the
/usr/share/examples/printing directory.

Let's try and print!

lpd is run from /etc/rc, controlled by the lpd_enable variable. This
variable defaults to NO. If you have not done so already, add the
line:

lpd_enable="YES"
to /etc/rc.conf, and then either restart your machine, or just run lpd

# lpd

lptest 20 20 | lpr -Pofficehp


Ed


More information about the freebsd-questions mailing list