On previous article, we have discussed about how to install CUPS on FreeBSD. In this article we will discuss and use the server for printing example documents.


Test the server by pointing a web browser to http://host.example.com:631 (substituting your server’s hostname or IP address for host.example.com). You will then see a Common Unix Printing System Welcome! page if the server started successfully; if you don’t, check your /usr/local/etc/cups/cupsd.conf file for typographical errors.

If you are using a PostScript printer, have its PPD (PostScript Printer Description) file handy . If you don’t have your printer’s PPD file, check http://openprinting.org.

Gutenprint Driver

The Gutenprint driver contains extensive support for Epson printers (among others). Visit http://gutenprint.sourceforge.net for a complete list of supported printers. The following commands will install the Gutenprint driver from the ports collection (this may take 30 minutes or more to complete):

A menu will appear containing options for Gutenprint; choose Gutenprint Cups Drivers. You may install the HPLIP driver as well, if you wish.

HPLIP Driver

The HP Linux Imaging and Printing driver was developed at Hewlett-Packard, and it contains support for virtually all HP printers. Visit http://hplip.sourceforge.net for a complete list of supported printers. The following commands will install the HPLIP printer driver from the ports collection (this may take 60 minutes or more to complete):

A menu will appear containing options for HPLIP. Here we use defaults installation, thus we don’t need to change anything.

Finishing Printer Setup

Ensure that your printer is powered on and connected to the CUPS server via a USB or parallel cable. Reboot the system. Log in as root to the web administration interface https://host.example.com:631/admin (or substitute it with your servers hostname or IP address).

Select Add Printer. Choose a name for the connected printer. This name will act as identifier among printers we have. Also enter a description of the printer (e.g., HP LaserJet 1100) and then click Continue. There should be a pull-down menu on the next page. Select either USB or LPT (parallel) as appropriate and then click Continue. Select the correct brand (vendors) of your printer on the next page, then click Continue. Choose the correct model from the list presented on the next page, then click Continue. Your printer should be ready to accept print jobs. You can print a test page from the Printers page of the CUPS web interface. Proceed to the appropriate section to set up client printing.

Various Testing

Printing from Windows XP

To print to a CUPS printer from Windows XP:

  1. click the Start menu and select Control Panel.
  2. Double-click the Printers and Faxes icon.
  3. Click Add a Printer at the left side of the window. The Welcome to the Add Printer Wizard dialog will appear; click Next.
  4. Click the Network Printer radio button, then click Next.
  5. Click the Connect to a Printer on the Internet or on a Home or Office Network radio button. In the URL field, use the following syntax to specify the server address: http://host.example.com:631/printers/printername (substitute the hostname or IP address of your CUPS server for host.example.com and replace printername with the name you assigned the printer during the CUPS printer setup).
  6. After clicking Next, you will be required to select the printer series and model from a list. If you have a Windows driver from the manufacturer, use it; otherwise select it from the given list and click OK.

You should be able to print via the CUPS print server from Windows applications.

Printing from Mac OS X

Open an application capable of printing (e.g., Safari). In the File menu, select Print. Select the Printer pull-down menu to display a list of available printers. You should see Shared Printers in the lower half of the menu. Hover the mouse over Shared Printers to display the submenu. Select the appropriate CUPS printer from the list. The CUPS printer will be added to your permanent list of printers. You can print the current document by clicking Print on the lower-right side of the dialog box.

Printing from the FreeBSD Command Line

Printing from command line is one of fun thing to do. The contents of file can be printed by CUPS. To print it, use following command:

Send Command from Command Line

Print a Document

As a user, we can use printer on network using CUPS. To print using the default print, use:

Print to specific printer:

Print multiple copies, for example 4 copies:

CUPS status information

Query CUPS status by:

The options can be:

  • -t: show all CUPS info
  • -d: show default printer
  • -p: show all printer
  • -a: show all printers that accept jobs
  • -o: show active print jobs

Cancel a Print Job

Cancelling a job can be done by the same user who submit the job.

Setting Options for a Specific Print Job

Sometimes, user needs specific print options. A general way to define specific options for a print job is:

Modify the Default Print Options

A user can define his own options for all his print jobs for a specific printer. They are saved in the ~/.lpoptions file and override the default options that have been defined by the system administrator for this specific CUPS printer.

Create Sets of Options

A user can set his own default options for a specific CUPS printer by issuing following command:

Remove Print Options

Previously defined print options can be removed from ~/.lpoptions by:

List a Printer’s Options

To list print queue’s current options:

To list print queue’s current options:

Create Sets of Options

A very useful CUPS feature is that sets of options can be defined. These can be system-wide if they are set by root, or user specific if they are set by a user. Printer instances are extra options for a specific printer that are saved as an extra printer in the form printer/set. This virtual printer’s settings override the default options. To create a printer instance, as a user issue the command:

To delete a printer instance issue the command:

The printer instance is listed as a printer in lpstat. The user can send a document to the printer instance:

Options Available

The common print options can be seen here. If an option accepts a value, then it is listed in the form option=value:

  • landscape – for landscape printing
  • media=A4 – check your ppd file for possible media values
  • Collate=true | false – useful when printing multiple copies
  • sides=two-sided-short-edge – used for landscape prints [the default is sides=one-sided]
  • sides=two-sided-long-edge – used for portrait prints [the default is sides=one-sided]
  • page-ranges=1-4,7,9-12 – print specific pages or page ranges
  • page-set=odd | even – print only odd or even pages
  • outputorder=normal | reverse – the pages are printed from first to last or the other way around
  • cpi=10 – characters per inch
  • lpi=6 – lines per inch
  • columns=2 – format the text in two or more columns
  • page-left=value – specify the left margin in points [1pt = 1/72inch]
  • page-right=value – specify the right margin in points [1pt = 1/72inch]
  • page-top=value – specify the top margin in points [1pt = 1/72inch]
  • page-bottom=value – specify the bottom margin in points [1pt = 1/72inch]
  • job-sheets=none – front and back cover pages
  • job-sheets=standard
  • job-sheets=classified,classified

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">