Set up your printer

From LXF Wiki

Revision as of 10:44, 5 Oct 2008; view current revision
←Older revision | Newer revision→

(Originally written by Andy Channelle for Linux Format issue 72.)


Printing needn't be painful. Just follow this guide, and things should get a lot easier.


I have always seen printing as a necessary evil and feel the pain of a thousand trees every time I print out a useless 25-page email thread or a presentation where the slides are set to black. The most ecological way of using a printer is to make sure you print the right things satisfactorily first time. I can't help you with ensuring you have the right things to print, but I can help make sure your printer is recognised, configured and ready to rock and roll.

Linux support for printing hardware has come on in leaps and bounds over the past few years, and most printers you plug into your PC should be accessible with very little (if any) extra work ­ this is especially true of modern USB printers.

If you're looking to buy a printer, the first piece of advice is to find out how other Linux users have fared with the kit you have in your sights. Have a look at www.linuxprinting.org, which collects users' experiences of various devices. If you were looking at an Epson 420 Linux (for example) you'd see that the card reader, printer and scanner all work well under Linux. You'd also see that there are some issues adding the printer with SUSE's YaST utility, meaning that you may need to use the command line. It also suggests that Epson provides a driver in RPM format on its website, complete with instructions for adding the printer manually.

LinuxPrinting.org maintains a comprehensive database of compatible printers, and so you really should examine it before you hit the shops. For a sensible purchase, it suggests sticking with either Epson or Hewlett Packard machines, as both of these companies have shown support by releasing their own Linux drivers (which you'll need to download) and packaging them in a usable format. Other brands tend to have no native drivers at worst; or incomplete, unstable ones at best. I've found Epson products the easiest to install and use and, thanks to generic ink makers, the cheapest to run. This doesn't mean that a Canon or Lexmark printer won't work with Linux ­ only that the drivers available through something like Gimp-Print may not be able to make the best use of any advanced facilities or printer utilities they offer.


Table of contents

Plugging in

Most printers available today will connect to your Linux PC with a USB cable. If you're moving over to Linux from Windows or Mac you might expect an alert to pop up on your desktop the moment you plug in and switch on the printer. And if you're using one of the more mainstream distributions, that is exactly what should happen. Should this alert not appear, you'll need to go into your distro's hardware configuration utility.

In SUSE the setup utility will be in YaST under the Hardware tab. Mandriva/Mandrake users will need to launch Drakconf, while Fedora calls its utility system-config-printer. All of these options should be available under the System menu of whichever desktop you're using. To confuse things, Gnome and KDE have their own integrated printer setup utilities as well.

So which program should you choose? Initially, the best tool to use is the one recommended by your distro vendor; so while SUSE users are better off sticking with YaST, Ubuntu users should fire up the Gnome tool. If in doubt, use what you're given ­just the same as you would in Windows!

The procedure for adding a printer is pretty standard across distros. The operating system will first attempt to recognise your printer. If this fails, it will ask you to provide details such as the manufacturer, model and connection type. Once this is established the system will offer to print some test pages and save the setup. If it does manage to autodetect the printer, setup will be a quick case of confirming the options and running the test pages.


What on Earth is CUPS?

Q. I'm guessing that the P stands for printing?

A. Right. CUPS stands for the Common Unix Printing System (although some people think the `C' stands for something else), which makes it possible to print things out on Linux. CUPS replaced the old Unix lpr architecture and, because it is built on a standard called the Internet Printing Protocol, it is excellent for accessing printers over a network.

Q. Who maintains the software?

A. CUPS was started by Easy Software Products (ESP, www.easysw.com), which released it under a dual licence. Linux distributors can include the software under a free licence in their packages, while ESP continues to sell a commercial version to those who want more extensive printing options. ESP can also sort you out with companion products and, if needed, support packages.

Q. What's the difference between the free and paid-for CUPS software?

A. ESP's version is far more extensive in terms of the devices it supports. CUPS has a suite of 13 generic printer drivers (which work in tandem with Printer Description files), but ESP Print Pro supports over 5,000 printers out of the box through an elegant user interface. The other difference is the price. ESP Print Pro starts at $49 for a single-client licence.

Q. I don't think I need all the extra functionality of the proprietary version. How do I acquire CUPS?

A. The chances are that it will have been included when you first installed your Linux distribution. Check your package manager for it (just open it up and search for CUPS) and if it's not present, install it through there. The latest version is 1.2.23 and there are tons of information available about it at www.cups.org.

Q. Is CUPS a universal printer driver?

A. No. It's a print server that simply relays instructions from your application software to the printer. Unless you follow the walkthrough on page 82 on adding printers, it's unlikely that you will have much actual contact with CUPS itself; usually you would work with a front-end such as KDE's KPrinter, which provides options for configuring printers with a familiar and intuitive interface (more on this on page 83).


Drivers to hand

If you're a Windows user coming to Linux for the first time, you will by now be wondering where the drivers come from. While Linux does indeed need drivers, a lot of hardware manufacturers are reluctant to include Linux drivers in their packages, and distro vendors recognise that installation needs to be as easy as possible if they are going to attract new users. For this reason, most distributions include support for as many printers (and other hardware devices) as possible, and so users who stick with mainstream gear should have no need to find Linux drivers from any other source.

You may occasionally need a PostScript Printer Description (PPD) file if you have fantastically new kit, but this will be available on the Windows driver disk. Again, HP and Epson will ensure that you are never stuck for a PPD; both companies make these files available for download. You could also check www.linuxprinting.org/download/PPD for a good selection of available PPD files whatever printer you choose.


Manual CUPS

If you've looked through all the different menu options and you still can't find a printer utility, it's also possible to completely bypass the desktop tools and go straight to the horse's mouth: CUPS (see What On Earth Is CUPS, above, for more information).

Fire up a web browser and, in the address bar, type the IP address of your own computer (which is always 127.0.0.1) followed by the port number that your printer server is running on (631) separated by a colon (127.0.0.1:631). The CUPS web utility will now be visible in the browser. The problem is that using this route does not simply involve making changes, as that would be quite insecure ­ anyone on the network would be able to alter the printer settings. For this reason we must first set up a username and password to allow access to the CUPS settings. This is an easy procedure, but it does require a quick visit to the command line.

Launch a terminal and become the root user by typing su. You will be asked for your root or administrator password. The first job is to create a new username, so type

lppasswd -a <andy>

substituting <andy> for a username of your choice.

You will be prompted for a password, which must include six characters at the minimum, and must also feature at least one number. Type this, hit Enter and then type the password again when prompted. And that's it. You will now be able to administer CUPS through its web interface using the username and password that you set up here.


Adding a printer using the CUPS web interface

Step 1: Open the correct window

The CUPS user interface looks just like a regular web page. Clicking on the links will take you to the relevant configuration options. We want to add a new printer, and so must select the text link that says `Manage Printers'. Note that links that you've visited will be coloured differently from unvisited links.


Step 2: Pick some signposting

In this page, we give the printer a name, location and description. These labels are arbitrary ­ though the printer name shouldn't have any spaces ­ and are intended to make later administration easier.


Step 3: Add its manufacturer

Once the connection is set, it's time to define the make and model. In this screen we select from the scrolling list the manufacturer of the printer. Pretty much every hardware maker you can think of will be represented in this list.


Step 4: Select the model

With the manufacturer selected, we can choose the model. You may find a lot of options in here, and if you're in any doubt about which driver to choose, go for the first recommended driver, finish the procedure and do a typical test print. If that is unsatisfactory, go back into the Manage Printer page and edit the printer to run on the next recommended driver, then test again.


Step 5: The admin page

This page shows previously configured printers. From here is it also possible to print test pages, abort a job if you accidentally start printing 100 photos of Mick Hucknall, and change several other options, such as choosing which of the attached devices is the default. We're adding a printer, and so we select the Add Printer button below the last printer that's already configured.


Step 6: Choose your connection

Next we define how the printer is attached to the computer. For the purposes of this tutorial we have attached a USB device, so we choose USB#3 as the connection ­ there are already two USB printers attached, so USB#1 and USB#2 are taken.


Step 7: Print a test page

Now we've added the new printer it should be ready for action. Print a test page to make sure everything is sound and, if not, make the adjustments you need through the options available in this page. Gnome's CUPS Manager software follows this sequence but looks a little different and amalgamates some of the screens above into single dialog boxes.


KPrinter and PDFs

Finally, we'll have a brief look at KDE's KPrinter, which acts as a central point for all of the desktop's printing options, and its ability to generate industry standard PDF files.

KPrinter is a front-end for CUPS, but is also a fully-featured print manager, featuring tools for adding and configuring printers, removing jobs from a print queue and restarting the print server. You can also create a PDF file from any application that uses KPrinter. PDFs are useful if you have a document that has to look a particular way regardless of the computer the end user will be viewing it on. The Print To PDF option is what KPrinter calls a `pseudo-printer', and it has all the usual options of a physical printer. This makes creating PDFs as simple as printing a document out.

KDE applications always put the Print option under the File menu. Once this is invoked, we need to select Print To File (PDF) from the Name drop-down box. This list will show any physically connected printers as well as any other pseudo- printers such as Send As Fax or Print To Postscript. Once this is selected, it's possible to configure the pseudo-printer by hitting the Properties button.

In the Properties box, there are options such as paper size, margins and, in the Driver Settings tab, things like resolution, colour depth and whether or not to embed fonts. Embedding fonts is usually a good idea, as it means that whoever is viewing the document will see it exactly as you intend. You can also hit the Preview radio button to have a look at the finished document before committing to a final print. Use this to check for problems with layout before you send. Add in a path and name for the Output File and hit Print to have the document saved.