Annotation of wikisrc/tutorials/how_to_setup_a_printer_with_lpd.mdwn, revision 1.1
1.1 ! mspo 1: **Contents**
! 3: [[!toc]]
! 5: # Introduction
! 7: The NetBSD guide contains a chapter on [printing](http://www.NetBSD.org/docs/guide/en/chap-print.html). The basic parts of this printing system are the line printer spooler daemon known as [lpd(8)](http://netbsd.gw.com/cgi-bin/man-cgi?lpd+8+NetBSD-current) and the associated tools such as [lpr(1)](http://netbsd.gw.com/cgi-bin/man-cgi?lpr+1+NetBSD-current). Practically all printer-specific configuration is done with a special [printcap(5)](http://netbsd.gw.com/cgi-bin/man-cgi?printcap+5+NetBSD-current) database. This guide will not replicate the information presented in the official guide, but instead tries to offer some examples on how this printing system can be configured with modern printers.
! 9: # Alternatives
! 11: It appears that the _Common Unix Printing System_ (CUPS) has gradually replaced other more traditional printing systems (see also [[How_to_setup_CUPS_in_NetBSD]]). However, there is still room for [lpd(8)](http://netbsd.gw.com/cgi-bin/man-cgi?lpd+8+NetBSD-current) and friends. If not for anything else, CUPS is relatively complex piece of software with quite bad security record. Some prefer also to always use tools that come with an operating system instead of relying on external packages.
! 13: Configuring and using a printer with [lpd(8)](http://netbsd.gw.com/cgi-bin/man-cgi?lpd+8+NetBSD-current) can be easier than with CUPS, once you wrap your head around it.
! 15: # Example: HP DeskJet
! 17: The following steps were needed for a low-cost HP DeskJet printer. First two packages were installed: [print/hpijs](http://pkgsrc.se/print/hpijs) and [print/foomatic-filters](http://pkgsrc.se/print/foomatic-filters):
! 19: cd /usr/pkgsrc/print/hpijs
! 20: make install package clean
! 21: cd ../foomatic-filters
! 22: make install package clean
! 25: The former is essential for high-quality output with HP printers and the latter is convenient. The [print/hpijs](http://pkgsrc.se/print/hpijs)-package contains various _.ppd_-files compressed with [bzip(1)](http://netbsd.gw.com/cgi-bin/man-cgi?bzip+1+NetBSD-current). You need to pick one suitable for your printer and unpack it to a desired location. An example:
! 27: mkdir /etc/print
! 28: cd /etc/print
! 29: cp /usr/pkg/share/ppd/HP-DeskJet_5550-hpijs.ppd.gz .
! 30: gunzip *.gz
! 33: The next step is to configure the printer using the _/etc/printcap_ file. An example that uses parallel port:
! 35: # This requires the following packages:
! 36: # print/hpijs and print/foomatic-filters.
! 37: #
! 38: lp|hp|HP Deskjet 5550:\
! 39: :lp=/dev/lpt0:\
! 40: :af=/etc/print/HP-DeskJet_5550-hpijs.ppd:\
! 41: :if=/usr/pkg/bin/foomatic-rip:\
! 42: :sd=/var/spool/output/lpd:\
! 43: :lf=/var/log/lpd-errs:\
! 44: :rg=print:\
! 45: :rs=true:\
! 46: :sh:
! 49: This will use the mentioned filter. The curiously named _foomatic_ Perl script takes PostScript as standard input and generates the printer's [page description language](http://en.wikipedia.org/wiki/Page_description_language) as standard output. This is pretty much all that is needed. For additional parameters in the configuration file, such as limiting the access to a group named _print_, please refer to the manual page, [printcap(5)](http://netbsd.gw.com/cgi-bin/man-cgi?printcap+5+NetBSD-current).
! 51: The final step is to enable the [lpd(8)](http://netbsd.gw.com/cgi-bin/man-cgi?lpd+8+NetBSD-current) daemon. The usual conventions with [rc.conf(5)](http://netbsd.gw.com/cgi-bin/man-cgi?rc.conf+5+NetBSD-current) apply:
! 53: lpd=YES
! 54: lpd_flags="-s"
! 57: The _-s_ flag tells the daemon to use UNIX domain socket instead of listening on all interfaces. This is probably a good idea if you are not configuring a printing server (in which case you probably already know what you are doing).
! 59: After starting the daemon you should be able to print files from the command line using the [lpr(1)](http://netbsd.gw.com/cgi-bin/man-cgi?lpr+1+NetBSD-current). Printing from GUIs should also work. At least [print/xpdf](http://pkgsrc.se/print/xpdf) and [www/firefox3](http://pkgsrc.se/www/firefox3) were both capable of printing.
! 61: # Example: HP LaserJet & network
! 63: Before start you have to enable printer daemon in _rc.conf_ file, set:
! 65: lpd=YES
! 68: To enable printing for HP Laser Jet network printers add into _/etc/printcap_ following:
! 71: # HP-4250
! 72: HP-4250:\
! 73: :lp=:sh:sd=/var/spool/lpd/lp:\
! 74: :rm=192.168.170.193:\
! 75: :lf=/var/log/lpd-errs:mx#0:
! 78: Where: HP-4250 is basic name of your printer which you can change per desire. Instead of 192.168.170.193 you should set IP address of your printer.
! 80: Check and create directory path if needed.
! 82: # See also
! 84: * [Printing](http://netbsd.org/docs/guide/en/chap-print.html#chap-print-remote)
! 85: * [Sumsing ML-1640](http://wiki.netbsd.se/Samsung_ML-1640_and_NetBSD)
! 86: * [Cups](http://wiki.netbsd.se/How_to_setup_CUPS_in_NetBSD)
! 87: * [Other](http://mail-index.netbsd.org/netbsd-users/1997/07/23/0002.html)
CVSweb for NetBSD wikisrc <wikimaster@NetBSD.org> software: FreeBSD-CVSweb