[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
slackbook:cups [2012/08/21 08:39 (UTC)] – vharishankar | slackbook:cups [2012/09/09 02:47 (UTC)] (current) – deleted page, recreated page with original text at slackbook:printing to correct chapter name and guarantee text mfillpot | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Common Unix Printing System (CUPS) ======= | ||
- | |||
- | Linux hasn't always had a great history with printers. For many years, printing was a black art to many Linux users, and very few printers worked reliably. Today, most printers will work well with Linux, but some still do not. If you're purchasing a new printer, be aware that many of the cheap inkjet models aren't as well supported in Linux as more expensive laser printers. If you're unsure about a printer, you can check online to see if others have had success with it. | ||
- | |||
- | All these warnings are perhaps a bit overkill though, as the large majority of printers work with Linux after only a brief and simple setup. The progress in this direction is largely due to the efforts of the Common UNIX Printing System, (CUPS). CUPS is a printing system used by Slackware and most other Linux distributions today. It primarily uses a graphical setup procedure accessed via a web browser. In order to setup a printer with CUPS, you'll need to open a web browser such as firefox, konqueror, or links and go to [[http:// | ||
- | |||
- | You might find that a quick click-through of CUPS configures your printer nearly automatically. Or, you may find that further configuration is required. To learn more about how printing works or how to get a stubborn printer configured, read on. | ||
- | |||
- | ===== Getting the driver ===== | ||
- | |||
- | There are, essentially, | ||
- | |||
- | * Postscript printers use the unversal-ish language of Postscript to communicate with computers. A driver for postscript printers is usually not needed, since a postscript-compatible subsystem called Ghostscript is already installed. | ||
- | * Gutenprint are drivers engineered by GNU Linux developers. It provides support for roughly 700 printers. | ||
- | * Manufacturers may provide Linux drivers for their printers. Find out by going to the manufacturer' | ||
- | |||
- | Since gutenprint is already installed on Slackware, from this set of three categories, we have two methods of installing drivers: | ||
- | * For the manufacturer' | ||
- | * For Postscript printers, there is no " | ||
- | |||
- | Once you've located and installed or downloaded the necessary components, you're ready to run CUPS. | ||
- | |||
- | ===== Setting Up a Printer in CUPS ===== | ||
- | |||
- | From this point onward, setting up a printer is just a series of following the step-by-step instructions with CUPS, but understanding how the printing configuration actually works might help clarify what CUPS does is doing. | ||
- | |||
- | The file / | ||
- | |||
- | A typical entry would look something like this: | ||
- | |||
- | <Printer r1060> | ||
- | Info Ricoh 1060 | ||
- | Location Downstairs | ||
- | MakeModel Ricoh Aficio 1060 - CUPS+Gutenprint v5.2.6 | ||
- | DeviceURI lpd:// | ||
- | State Idle | ||
- | StateTime 1316011347 | ||
- | Type 12308 | ||
- | Filter application/ | ||
- | Filter application/ | ||
- | # standard-ish stuff below here | ||
- | Accepting Yes | ||
- | Shared No | ||
- | JobSheets none none | ||
- | QuotaPeriod 0 | ||
- | PageLimit 0 | ||
- | KLimit 0 | ||
- | OpPolicy default | ||
- | ErrorPolicy stop-printer | ||
- | </ | ||
- | | ||
- | In this example, we have given the printer the name **r1060**, a human-readable identifier **Ricoh 1060**. | ||
- | |||
- | The **MakeModel** attribute is gained from lpinfo, which lists all available printer drivers on your system. So, if you know that you have a Ricoh 1060 that you want to print to, then you would issue this command as root: | ||
- | |||
- | darkstar:~# lpinfo -m | grep 1060 | ||
- | |||
- | This lists the drivers that you have installed, grepping for the string 1060: | ||
- | |||
- | gutenprint.5.2:// | ||
- | gutenprint.5.2:// | ||
- | |||
- | The **MakeModel** is the last half of the appropriate result; in this case **Ricoh Aficio 1060 - CUPS+Gutenprint v5.2.6**. | ||
- | |||
- | The final vital entry is the device URI, or where on the network (or physical location, such as the USB port), the printer can be found. In this example, we use DeviceURI lpd:// | ||
- | |||
- | Now you understand what is being configured, and you can use the more common (and easier) method of doing this from the configuration tool that runs inside of a web browser. | ||
- | |||
- | In the CUPS interface, choose the Administration tab, and choose to Add Printer. You should be asked to enter administrative authorization here; enter **root** as the admin and your **root password**. | ||
- | |||
- | You will be presented with a list of printer interfaces and protocols that you can use for a printer. In many cases, you will want to add the printer via the LPD/LPR protocol (unless you've managed to find a printer that requires some other protocol). | ||
- | |||
- | Note that if the printer is plugged directly into your computer, and is on, you should see it listed as a Local Printer. | ||
- | |||
- | Assuming the printer is networked, the next screen will ask for the location of the printer. Using lpd:// as the protocol, enter the IP address of the printer. To find the IP address of the printer, you will probably need to look at the printer' | ||
- | |||
- | Whether your printer is connected via USB or network, the following screen will ask for human-readable details about the printer; this is for your reference only, so enter a name for the printer that makes sense to you and your users (the model number usually), a description (something that is distinctive about the printer if you have more than one of the same printers), and the location (describing where it is in the building). | ||
- | |||
- | On the next screen, point CUPS to the printer driver. If the printer is a postscript printer (as most laserprinters are) then you may need only the PPD for that printer. If your printer is not postscript or has special features that require additional drivers, then define the make (manufacturer) and you will then be presented with a list of available drivers. Select the appropriate driver. | ||
- | |||
- | The printer is now installed and will be the default printer for all of your applications. | ||
- | |||
- | ===== Printing from the command line ===== | ||
- | |||
- | Now that you have successfully installed and configured your printer, you may also use lpr to print from the command line. lpr sends documents to a printer but before using it, you might want to define a default printer by using lpadmin as root: | ||
- | |||
- | # lpadmin -d r1060 | ||
- | | ||
- | In this example, **r1060** is the human readable name given to the printer in either / | ||
- | |||
- | < | ||
- | |||
- | $ PRINTER=r1060 | ||
- | $ export PRINTER | ||
- | </ | ||
- | | ||
- | Once the printer has been set, then you may print: | ||
- | |||
- | $ lpr foo.txt | ||
- | |||
- | ===== Formatting for Print ===== | ||
- | |||
- | lpr, like so many other UNIX applications, | ||
- | |||
- | pr is a simple text formatter that takes any text document and makes sure that it contains line breaks and page breaks, with an optional header and footer, page numbering, and much more. It has many options, but the defaults are usually good enough. pr outputs the results of the formatting to standard out, meaning it simply takes the text document, formats it, and displays the results in the terminal. This, of course, means that it can be redirected to lpr: | ||
- | |||
- | darkstar:~$ pr foo.txt | lpr | ||
- | | ||
- | |||
- | This will format foo.txt and send the formatted output to the default printer. | ||
- | |||
- | As usual, see the pr man page for a list of the customizations you can make to the default formatting. | ||
- | |||
- | =====Sources===== | ||
- | |||
- | * Original source: http:// | ||