The NetBSD guide contains a chapter on printing. The basic parts of this printing system are the line printer spooler daemon known as lpd(8) and the associated tools such as lpr(1). Practically all printer-specific configuration is done with a special printcap(5) 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.
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) 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.
Configuring and using a printer with lpd(8) can be easier than with CUPS, once you wrap your head around it.
cd /usr/pkgsrc/print/hpijs make install package clean cd ../foomatic-filters make install package clean
The former is essential for high-quality output with HP printers and the latter is convenient. The print/hpijs-package contains various .ppd-files compressed with bzip(1). You need to pick one suitable for your printer and unpack it to a desired location. An example:
mkdir /etc/print cd /etc/print cp /usr/pkg/share/ppd/HP-DeskJet_5550-hpijs.ppd.gz . gunzip *.gz
The next step is to configure the printer using the /etc/printcap file. An example that uses parallel port:
# This requires the following packages: # print/hpijs and print/foomatic-filters. # lp|hp|HP Deskjet 5550:\ :lp=/dev/lpt0:\ :af=/etc/print/HP-DeskJet_5550-hpijs.ppd:\ :if=/usr/pkg/bin/foomatic-rip:\ :sd=/var/spool/output/lpd:\ :lf=/var/log/lpd-errs:\ :rg=print:\ :rs=true:\ :sh:
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 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).
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).
After starting the daemon you should be able to print files from the command line using the lpr(1). Printing from GUIs should also work. At least print/xpdf and www/firefox3 were both capable of printing.
Before start you have to enable printer daemon in rc.conf file, set:
To enable printing for HP Laser Jet network printers add into /etc/printcap following:
# HP-4250 HP-4250:\ :lp=:sh:sd=/var/spool/lpd/lp:\ :rm=192.168.170.193:\ :lf=/var/log/lpd-errs:mx#0:
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.
Check and create directory path if needed.