Obviously FreeBSD can be used to connect to printers and communicate with them. This is not a big deal, since pretty much every other operating system has a printing interface that can be hooked up to standard printers, and print documents. Besides that, FreeBSD can be used as a full-featured print server. As a print server, your FreeBSD host can receive print jobs from multiple hosts over the network, and spool the jobs and then print them respectively.
FreeBSD has its own built-in generic print spooler called lpd(8) based on RFC 1179 definitions. There are also various alternatives to the built-in print spooler such as LPRng (available in ports tree as sysutils/LPRng) that is a more advanced print spooler as compared to FreeBSD's built-in spooler.
Another very popular and more complex print spooler is CUPS (for Common UNIX Printing System) that supports more protocols and is easier to configure.
lpd-Print Spooler Daemon
The lpd(8) utility is the legacy print spooler daemon that is built-in to the FreeBSD distribution. It can handle incoming print requests from the network (or locally) and store them in the spool directory, and then take care of printing documents correctly.
LPD relies on the /etc/printcap file in order to communicate with your printer. This file contains printer definitions. LPD reads this file anytime it needs to communicate with a printer. Therefore, you should setup your printer and add appropriate configuration to this file before anything else. Setting up the printcap entries manually is somewhat complex. Luckily there are tools that would make your life easier by taking care of configuring printcap for you, based on an interactive interface. One such tool is apsfilter program that is available in ports collection as print/apsfilter. The apsfilter program helps you in choosing the correct printer drivers and configuration, and finally creating relevant entries in the /etc/printcap file.
Once you have configured your printer driver, you should enable lpd, so that your host can receive print jobs and send them to its attached printer.
LPD can be enabled from the rc.conf file by adding the following line:
You can then start the LPD service manually, by running the following command:
# /etc/rc.d/lpd start
Now LPD is ready to accept print jobs. You can test your setup by sending a sample text file to the printer. The following command is run to test your print setup:
# lpr /etc/motd
This should print the /etc/motd file to your recently configured printer.
Common UNIX Printing System (CUPS)
CUPS provides you with a friendly interface for printing. Unlike legacy LPD, CUPS automatically takes care of your printer configuration, and deals with the printcap file in the background. In addition to LPD protocol, CUPS supports Internet Printing Protocol (IPP) as the default protocol, as well as SMB and HP JetDirect protocols.
IPP is an advanced remote printing protocol that covers many shortcomings of older protocols by adding many advanced features such as Access Control, Encryption, and Authentication.
CUPS can be found in ports collection under the print/cups directory.
If you have already configured your /etc/printcap file, make sure you take a backup prior to installing CUPS as it will overwrite the existing printcap file.
Just like any other daemon in FreeBSD, CUPS should be enabled by adding this line to your /etc/rc.conf file:
While running, CUPS listens on TCP 631 (bound to 127.0.0.1) and UDP 631, on all interfaces. You can manage CUPS configuration using the Web GUI by pointing your browser to http://127.0.0.1:631/ on the same host you are running CUPS. If you want to manage CUPS configuration remotely, you should change the default configuration file that is located at /usr/local/etc/cups/cupsd.conf.
Using the Web GUI, you can manage printers, classes (group of printers), and print jobs. CUPS updates the /etc/printcap file, when you add or modify printer settings. So when you configure a printer using CUPS, any other print spooler (for example LPD or LPRng) can use the printcap file to communicate with the printers.