How to Print in Raspberry Pi Using CUPS

This article will guide you on how to configure the Raspberry Pi to print to a printer using the Common Unix Printing System (CUPS).

What is CUPS?

CUPS stands for Common Unix Printing System. It is a modular printing system for UNIX-like computers that allows a computer to act as a printer server. This means that a computer running CUPS is a host that can accept print jobs from client computers, process them, and send them to the appropriate printer for printing.

For our Raspberry Pi to be able to handle printing jobs, we first need to install CUPS. The steps below will guide you on how to do this.

Installing CUPS

To install CUPS in your Raspberry Pi, open a Terminal Window and enter the following:

sudo apt-get install cups

Answer ‘Yes’ to the prompt to start the installation. Installation might take a while due to the number of files that need to be downloaded and installed.

Installing CUPS via CLI
Installing CUPS via CLI

CUPS Administration

CUPS uses the user group “lpadmin” to know who is authorized to administer the printers.

After installing CUPS, add a username to the user group “lpadmin” by entering the following in a terminal window:

sudo usermod -a -G lpadmin <user>

Replace <user> with the username you wish to have access to the CUPS administration page. If you are using the default username “pi”, then you would add it like this:

sudo usermod -a -G lpadmin pi
CLI Adding users to the user group lpadmin
Adding users to the user group lpadmin

Configuring CUPS

After installing CUPS and adding a user, or set of users, to the user group lpadmin, the rest of the configuration can be done via the CUPS Administration page. You can access this page by opening a web browser and going to the address: http://127.0.0.1:631/.

CUPS Home Tab
CUPS Home Tab

The CUPS webpage is used to configure the print server, manage printers, classes, and jobs, and view logs. For this tutorial, we will only discuss how to add a printer via CUPS Administration Tab.

Adding a Printer

To start adding a printer, go to the CUPS Administration Tab and click ‘Add Printer.’

CUPS Administration Tab
CUPS Administration Tab

After clicking ‘Add Printer’, the next page will let you select which printer you want to add from the list.

  • Local Printers
  • Discovered Network Printers
  • Other Network Printers
CUPS Add Printer
Add printer

After selecting your printer, click ‘Continue.’ Next page will allow you to edit the description of your printer.

CUPS Printer Details
Printer Details

After editing the printer details, click ‘Continue.’ Next task is to select your printer’s make. Or if you have the PPD file of your printer, you can select the file as well on this page.

CUPS Select make/model of printer
Select make/model of printer

After selecting your printer’s make, click ‘Continue’ (or ‘Add Printer’ if you have the PDD file). The next page will ask you for your printer’s model based on the make you have selected earlier.

CUPS Select Printer Model
Select Printer Model

After selecting your printer’s model, click ‘Add Printer’ to continue. Next page will be for the default settings of your printer.

CUPS Printer Default Options
Printer Default Options

After setting your options, click ‘Set Default Options’ to continue. You will see a message that the printer has been added successfully.

And congratulations! You just configured your Raspberry Pi to work with the printer. You can check the registered printers with their status in the Printers tab.

CUPS Printers tab