Difference between revisions of "LPRng"

From ArchWiki
Jump to: navigation, search
Line 10: Line 10:
*Install optional filter packages:
*Install optional filter packages:
**foomatic-filters-lprng (AUR)
**{{pkg|foomatic-filters-lprng}} (AUR)

Revision as of 14:41, 3 January 2015

LPRng is an alternative print spooler to CUPS. It was designed as a drop-in replacement for the old Berkeley Unix LPR system. It is mature and robust and it handles print filtering in a transparent and flexible manner.

Complete documentation exists on the LPRng website: [1] The man pages are also a useful source of information.



Configuration consists of the following steps:

  • Set up control files
  • Configure filters
  • Create a printcap file and spool directories
  • Enable and start the lpd daemon using systemctl

Control files

Two control files must be configured, lpd.conf and lpd.perms. The default configurations in /usr/share/doc/lprng are adequate for a client computer printing to a remote printer. Copy these to /etc/lprng/lpd/. For a server receiving requests across the Internet, uncomment the last line in lpd.conf and configure permissions as documented in the comments in lpd.perms. The files lpd.conf.sample and lpd.perms.sample, located in /usr/share/doc/lprng, document more complex situations.

Configure filters

If you have a network Postscript printer you are in luck. The sample postscript filter /usr/share/doc/lprng/psfilter converts PDF and text files to Postscript. Other file types are rejected. Copy this file to /usr/lib/lprng/lpd and rename it as desired. Then edit it to set your paper type and your choice of simplex/duplex printing. If you wish to have separate simplex and duplex print queues, make two copies with different names and edit appropriately.

Another mechanism for print filtering is via the Foomatic system. This system used by CUPS. Install the foomatic-filters-lprng package from the AUR (the foomatic-rip program in the CUPS installation has been modified to remove LPRng support) and use foofilter as described above, editing for your desired .ppd file. Install the .ppd file in conformance with the path specified in foofilter. (/etc/lprng/lpd is a good location.)

To use Hewlett Packard printers, install hplip from the main distribution. This package has .ppd files for virtually all Hewlett Packard printers.

If you have a printer that has a Ghostscript driver, copy and edit gsfilter as above to set the appropriate driver and the paper type. You can discover the drivers available in your version of Ghostscript by typing the command

$ gs -h

Note that support for various printer features is typically limited and out of date with this option.

Printcap file

The /etc/lprng/printcap file tells LPRng about the printers you have and the print filters that need to be used. The printcap.sample file (in /usr/share/doc/lprng) provides a short tutorial as to how to set up a printcap file. The printcap fragments printcap_server and printcap_client in this directory also provide information. Generally, one computer should be designated as the server for one or more printers. Other client computers should send their print jobs to the server rather than the printer directly. The rather non-obvious server setup in printcap_server is needed to make print filtering work on network printers, as opposed to printers attached directly to the server computer via, say, a USB port. (See the reference manual.)

After creating the printcap file, run the command

$ /usr/bin/checkpc -f

This will check your configuration and create spool directories in /var/spool/lpd. If checkpc complains about something, address the issue and rerun.

Start the lpd daemon

LPRng runs a daemon in background called lpd to manage print requests. To start this daemon, type the two commands:

$ systemctl enable lpd.service
$ systemctl start lpd.service

If these complete without complaint, you should be good to go. If any configuration files are changed, one must restart the lpd daemon. Do this with the command

$ systemctl restart lpd.service

Note that this LPRng package assumes that systemd is running. If some alternate initialization package is used, one must devise an alternate means of starting the lpd daemon.


The lpr command is the printing tool in LPRng. The general form of use is

$ lpr [options] [file_to_be_printed]

If no file is specified, input is accepted on the standard input. The most useful options are -P printer and -K number_of_copies. In the absence of the printer option, the environment variable PRINTER=name_of_printer will tell LPRng which printer to use.

Other useful commands are lpq (examine the print queue) and lprm (remove a print job from the queue). See the man pages for lpr, lpq, and lprm.

CUPS and LPRng

CUPS may be used to access a printer on a server from a client machine on which LPRng is not installed. The trick is to configure CUPS to access the printer via the lpd protocol. This is easy to do using the web interface to CUPS. Also, since the server as set up here does all necessary print filtering, tell CUPS to use the raw filter. Alternative divisions between filtering responsibilities can be devised, depending on your needs.


A disadvantage of LPRng is that Gnome3/GTK3 (ncluding chrome and chromium) and KDE do not support lpr printing from their GUI. However, printing to a file and then using lpr works, though it is inconvenient. Gnome2/GTK2 applications (including Firefox, Mate, LXDE, and XFCE4) still support LPR printing. To make this work, create the file .gtkrc-2.0 in your home directory containing a single line

gtk-print-backends = "file,lpr"

LXDE may create its own .gtkrc-2.0 file if the look and feel of the desktop are altered -- look in this file for instructions as to how to proceed.

The filter pdftops from the poppler package is used to create Postscript from PDF files in the print filters. Occasionally, pdftops produces bad or no output. An alternative filter, pdf2ps from the ghostscript package, can be substituted, but this filter has its own problems. For a one-shot case, just use pdf2ps or some other converter to produce Postscript and send that to the printer.

Duplex on Postscript files is effected in the example filters by inserting a line of Postscript code right after the first line. For some Postscript files, this doesn't work. In this case, send the Postscript file to a simplex queue. Such files are submitted to the printer with no filtering.