6 min read

Configuring Printer Classes

By default there are no printer classes set up. You will need to define them. The following are some of the criteria you can use to define printer classes:

  • Printer Type: Printer type can be a PostScript or non-PostScript printer.
  • Location: The location can describe the printer’s place; for example the printer is placed on the third floor of the building.
  • Department: Printer classes can also be defined on the basis of the department to which the printer belongs. The printer class might contain several printers that are used in a particular order.

CUPS always checks for an available printer in the order in which printers were added to a class. Therefore, if you want a high-speed printer to be accessed first, you would add the high-speed printer to the class before you add a low-speed printer. This way, the high-speed printer can handle as many print requests as possible, and the low-speed printer would be reserved as a backup printer when the high-speed printer is in use.

It is not compulsory to add printers in classes. There are a few important tasks that you need to do to manage and configure printer classes.

Printer classes can themselves be members of other classes. So it is possible for you to define printer classes for high availability for printing. Once you configure the printer class, you can print to the printer class in the same way that you print to a single printer.

Features and Advantages

Here are some of the features and advantages of printer classes in CUPS:

  • Even if a printer is a member of a class, it can still be accessed directly by users if you allow it. However, you can make individual printers reject jobs while groups accept them. As the system administrator, you have control over how printers in classes can be used.
  • The replacement of printers within the class can easily be done. Let’s understand this with the help of an example.

    You have a network consisting of seven computers running Linux, all having CUPS installed. You want to change printers assigned to the class. You can remove a printer and add a new one to the class in less than a minute. The entire configuration required is done as all other computers get their default printing routes updated in another 30 seconds. It takes less than one minute for the whole change—less time than a laser printer takes to warm up.

  • A company is having the following type of printers with their policy as:
    • A class for B/W laser printers that anybody can print on
    • A class for draft color printers that anybody can print on, but with restrictions on volume
    • A class for precision color printers that is unblocked only under the administrator’s supervision
    • CUPS provide the means for centralizing printers, and users will only have to look for a printer in a single place
    • It provides the means for printing on another Ethernet segment without allowing normal Windows to broadcast traffic to get across and clutter up the network bandwidth
    • It makes sure that the person printing from his desk on the second floor of the other building doesn’t get stuck because the departmental printer on the ground floor of this building has run out of paper and his print job has got redirected to the standby printer
  • All of these printers hang off Windows machines, and would be available directly for other computers running under Windows. However, we get the following advantages by providing them through CUPS on a central router:

Implicit Class

CUPS also supports the special type of printer class called as implicit class. These implicit classes work just like printer classes, but they are created automatically based on the available “printers and printer classes” on the network. CUPS identifies printers with identical configurations intelligently, and has the client machines send their print jobs to the first available printer. If one or more printers go down, the jobs are automatically redirected to the servers that are running, providing fail-safe printing.

Managing Printer Classes Through Command-Line

You can perform this task only by using the lpadmin -c command. Jobs sent to a printer class are forwarded to the first available printer in the printer class.

Adding a Printer to a Class

You can run the following command with the –p and -c options to add a printer to a class:

$sudo lpadmin –p cupsprinter –c cupsclass

The above example shows that the printer cupsprinter has been added to printer class cupsclass:

You can verify whether the printers are in a printer class:

$lpstat -c cupsclass

Removing a Printer from a Class

You need to run lpadmin command with –p and –r options to remove printer from a class. If all the printers from a class are removed, then that class can get deleted automatically.

$sudo lpadmin –p cupsprinter –r cupsclass

The above example shows that the printer cupsprinter has been removed from the printer class, cupsclass:

Removing a Class

To remove a class, you can run the lpadmin command with the –x option:

$sudo lpadmin -x cupsclass

The above command will remove cupsclass.

Managing Printer Classes Through CUPS Web Interface

Like printers, and groups of printers, printer classes can also be managed by the CUPS web interface. In the web interface, CUPS displays a tab called Classes, which has all the options to manage the printer classes. You can get this tab directly by visiting the following URL: http://localhost:631/classes

If no classes are defined, then the screen will appear as follows which shows the search and sorting options:

CUPS: How to Manage Multiple Printers

Adding a New Printer Class

A printer class can be added using the Add Class option in the Administration tab. It is useful to have a helpful description in the Name field to identify your class. You can add the additional information regarding the printer class under the Description field that would be seen by users when they select this printer class for a job.

The Location field can be used to help you group a set of printers logically and thus help you identify different classes. In the following figure, we are adding all black and white printers into one printer class. The Members box will be pre-populated with a list of all printers that have been added to CUPS. Select the appropriate printers for your class and it will be ready for use.

CUPS: How to Manage Multiple Printers

Once your class is added, you can manage it using the Classes tab. Most of the options here are quite similar to the ones for managing individual printers, as CUPS treats each class as a single entity.

In the Classes tab, we can see following options with each printer class:

Stop Class

Clicking on Stop Class changes the status of all the printers in that class to “stop”. When a class is stopped, this option changes to Start Class. This changes the status of all of the printers to “idle”. Now, they are once again ready to receive print jobs.

Reject Jobs

Clicking on Reject Jobs changes the status of all the printers in that class to “reject jobs”. When a class is in this state, this option changes to Accept Jobs which changes the status of all of the printers to “accept jobs” so that they are once again ready to accept print jobs.




Please enter your comment!
Please enter your name here