Tuesday, December 13, 2016

Printing VI

Configuring a CUPS Printer


All CUPS printers are defined in the


/etc/cups/printers.conf 


file.



Although you can manually edit this file, you really should use the
CUPS web-based administration utility instead. Configuring a CUPS
printer is a snap with it. You can either configure CUPS to service a
locally attached printer (and optionally make it available to other
network users) or connect to a CUPS printer over the network. For
example, to configure CUPS to use a locally attached printer, do the
following:




1) On your Linux system, start a web browser and navigate to
http://localhost:631.



2) Select Administration. The screen in Figure 16-5 is displayed.



3) Under Printers, select Add Printer.



4) When prompted, log in as the administrative user you created
previously. The screen in Figure 16-6 is displayed.



5) Select a locally attached printer type under Local Printers and
then select Continue. A screen similar to that shown in Figure 16-7 is
displayed.



TIP You could also select a network printer in this screen. All
broadcasting CUPS printers on other network hosts are listed under
Discovered Network Printers. To send print jobs to one of these
printers, just select it.




6) In the Name field, enter a name for the printer.



7) In the Description field, enter a description of the printer.



8) In the Location field, enter a location for the printer.



9) If you want to share the printer with other network users, mark
    Share This Printer.



10) Select Continue. The screen in Figure 16-8 is displayed.



11) Select the printer manufacturer; then select Continue.



12) In the Model field, select your printer model; then select Add Printer.



13) Configure your default options for the printer, such as paper
size, color model, media source, print quality, two-sided printing,
and so on. When complete, select Set Default Options.







At this point, a page is displayed indicating your printer has been
added. The current status of your printer is displayed, similar to
that shown in Figure 16-9.



From the Printer Status page, you can manage your CUPS printer. You
can send a test page, stop the printer, kill a print job, modify the
printer configuration, or delete the printer altogether. At this
point, you can send print jobs to the printer. If you’re using a
graphical X application, you can simply select File | Print; then
select the printer and click OK. You can also send print jobs from the
command line to the printer. This is done using the lp command, which
will send a specified file to the printer. The syntax for using lp is




lp –d printer_name filename




For example, if I wanted to print the myfiles file in the current
directory to the HPLJ2 printer I just created, I

would enter




lp –d HPLJ5 ./myfiles




at the shell prompt, as shown here: openSUSE:~ # lp -d HPLJ2 ./myfiles

request id is HPLJ2-2 (1 file(s))





As you can see in this example, the

job is created and assigned an ID (in this case, HPLJ2-2). The job is
added to the print queue and sent to the printer. The lp utility
includes a variety of options besides –d that you can use to create
print jobs, including the following:




• –n x Prints x number of copies

• –m E-mails a confirmation message to my local user account when the
   job is finished printing


• –q x Sets the priority of the print job to x

–o landscape Prints the file landscape instead of portrait

–o sides=2 Prints the file double-sided on a printer that supports duplexing




You can also configure other Linux systems to print to the CUPS
printer. Simply configure a new printer, but specify that it listen
for CUPS announcements. The CUPS printer you configured should be
displayed within 30 seconds. After you select it, all print jobs sent
to that printer will be redirected over the network connection to your
CUPS printer.




In addition, if you’ve installed Samba on your system, your CUPS
printers are automatically shared. You can connect to them from
Windows workstations and submit print jobs. Now that’s cool!








LX0-104 Exam Objectives (Q)

No comments:

Post a Comment