File:  [NetBSD Developer Wiki] / wikisrc / tutorials / how_to_setup_a_printer_with_lpd.mdwn
Revision 1.4: download - view: text, annotated - select for diffs
Wed Sep 9 14:28:56 2020 UTC (4 months, 2 weeks ago) by kim
Branches: MAIN
CVS tags: HEAD
Use man template



#  Introduction 

The NetBSD guide contains a chapter on [printing]( The basic parts of this printing system are the line printer spooler daemon known as [[!template id=man name="lpd" section="8"]] and the associated tools such as [[!template id=man name="lpr" section="1"]]. Practically all printer-specific configuration is done with a special [[!template id=man name="printcap" section="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. 

#  Alternatives 

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 [[!template id=man name="lpd" section="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 [[!template id=man name="lpd" section="8"]] can be easier than with CUPS, once you wrap your head around it. 

#  Example: HP DeskJet 

The following steps were needed for a low-cost HP DeskJet printer. First two packages were installed: [print/hpijs]( and [print/foomatic-filters]( 
    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]( contains various _.ppd_-files compressed with [[!template id=man name="bzip" section="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:\

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, [[!template id=man name="printcap" section="5"]]. 

The final step is to enable the [[!template id=man name="lpd" section="8"]] daemon. The usual conventions with [[!template id=man name="rc.conf" section="5"]] apply: 

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 [[!template id=man name="lpr" section="1"]]. Printing from GUIs should also work. At least [print/xpdf]( and [www/firefox3]( were both capable of printing. 

#  Example: HP LaserJet & network 

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

Where: HP-4250 is basic name of your printer which you can change per desire. Instead of you should set IP address of your printer. 

Check and create directory path if needed. 

#  See also 

  * [Printing](
  * [Sumsing ML-1640](
  * [Cups](
  * [Other](

CVSweb for NetBSD wikisrc <> software: FreeBSD-CVSweb