Thursday, May 17, 2012

Printer Configuration

Printer Configuration

The Printer Configuration Tool allows users to configure a printer. This tool helps maintain the printer configuration file, print spool directories, and print filters.
Red Hat Enterprise Linux 3 uses the CUPS printing system. If a system was upgraded from a previous Red Hat Enterprise Linux version that used CUPS, the upgrade process preserved the configured queues.
Using the Printer Configuration Tool requires root privileges. To start the application, select Main Menu Button (on the Panel) => System Settings => Printing, or type the command redhat-config-printer. This command automatically determines whether to run the graphical or text-based version depending on whether the command is executed in the graphical desktop environment or from a text-based console.
To force the Printer Configuration Tool to run as a text-based application, execute the command redhat-config-printer-tui from a shell prompt.


Figure 1  Printer Configuration Tool
The following types of print queues can be configured:
  • Locally-connected — a printer attached directly to the computer through a parallel or USB port.
  • Networked CUPS (IPP) — a printer that can be accessed over a TCP/IP network via the Internet Printing Protocol, also known as IPP (for example, a printer attached to another Red Hat Enterprise Linux system running CUPS on the network).
  • Networked UNIX (LPD) — a printer attached to a different UNIX system that can be accessed over a TCP/IP network (for example, a printer attached to another Red Hat Enterprise Linux system running LPD on the network).
  • Networked Windows (SMB) — a printer attached to a different system which is sharing a printer over a SMB network (for example, a printer attached to a Microsoft Windows™ machine).
  • Networked Novell (NCP) — a printer attached to a different system which uses Novell's NetWare network technology.
  • Networked JetDirect — a printer connected directly to the network through HP JetDirect instead of to a computer.

    Clicking the Apply button saves any changes that you have made and restarts the printer daemon. The changes are not written to the configuration file until the printer daemon is restarted. Alternatively, you can choose Action => Apply.


    Adding a Local Printer

    To add a local printer, such as one attached through a parallel port or USB port on your computer, click the New button in the main Printer Configuration Tool Figure 2 Click Forward to proceed. 

     

    Figure 2. Adding a Printer
    In the window shown in Figure 3, enter a unique name for the printer in the Name text field. The printer name cannot contain spaces and must begin with a letter. The printer name may contain letters, numbers, dashes (-), and underscores (_). Optionally, enter a short description for the printer, which can contain spaces.

    Figure 3. Selecting a Queue Name
    After clicking Forward, Figure 4 appears. Select Locally-connected from the Select a queue type menu, and select the device. The device is usually /dev/lp0 for a parallel printer or /dev/usb/lp0 for a USB printer. If no devices appear in the list, click Rescan devices to rescan the computer or click Custom device to specify it manually. Click Forward to continue.

    Figure 4. Adding a Local Printer

    Adding an IPP Printer

    An IPP printer is a printer attached to a different Linux system on the same network running CUPS or a printer configured on another operating system to use IPP. By default, the Printer Configuration Tool browses the network for any shared IPP printers. (This option can be changed by selecting Action => Sharing from the pulldown menu.) Any networked IPP printer found via CUPS browsing appears in the main window under the Browsed queues category.
    If you have a firewall configured on the print server, it must be able to send and receive connections on the incoming UDP port, 631. If you have a firewall configured on the client (the computer sending the print request), it must be allowed to send and accept connections on port 631.
    If you disable the automatic browsing feature, you can still add a networked IPP printer by clicking the New button in the main Printer Configuration Tool window to display the window in Figure 2. Click Forward to proceed.
    In the window shown in Figure 3, enter a unique name for the printer in the Name text field. The printer name cannot contain spaces and must begin with a letter. The printer name may contain letters, numbers, dashes (-), and underscores (_). Optionally, enter a short description for the printer, which can contain spaces.
    After clicking Forward, Figure 5 appears. Select Networked CUPS (IPP) from the Select a queue type menu.
    Figure 5. Adding an IPP Printer
    Text fields for the following options appear:
  • Server — The hostname or IP address of the remote machine to which the printer is attached.
  • Path — The path to the print queue on the remote machine.
Click Forward to continue.
 

 

Adding a Remote UNIX (LPD) Printer

To add a remote UNIX printer, such as one attached to a different Linux system on the same network, click the New button in the main Printer Configuration Tool window. The window shown in Figure 2 will appear. Click Forward to proceed.
In the window shown in Figure 3, enter a unique name for the printer in the Name text field. The printer name cannot contain spaces and must begin with a letter. The printer name may contain letters, numbers, dashes (-), and underscores (_). Optionally, enter a short description for the printer, which can contain spaces.
Select Networked UNIX (LPD) from the Select a queue type menu, and click Forward.
Figure 6. Adding a Remote LPD Printer
Text fields for the following options appear:
  • Server — The hostname or IP address of the remote machine to which the printer is attached.
  • Queue — The remote printer queue. The default printer queue is usually lp.
Click Forward to continue.

Adding a Samba (SMB) Printer

To add a printer which is accessed using the SMB protocol (such as a printer attached to a Microsoft Windows system), click the New button in the main Printer Configuration Tool window. The window shown in Figure 2 will appear. Click Forward to proceed.
In the window shown in Figure 3, enter a unique name for the printer in the Name text field. The printer name cannot contain spaces and must begin with a letter. The printer name may contain letters, numbers, dashes (-), and underscores (_). Optionally, enter a short description for the printer, which can contain spaces.
Select Networked Windows (SMB) from the Select a queue type menu, and click Forward. If the printer is attached to a Microsoft Windows system, choose this queue type.
Figure 7. Adding a SMB Printer
As shown in Figure 7, SMB shares are automatically detected and listed. Click the arrow beside each share name to expand the list. From the expanded list, select a printer.
If the printer you are looking for does not appear in the list, click the Specify button on the right. Text fields for the following options appear:
  • Workgroup — The name of the Samba workgroup for the shared printer.
  • Server — The name of the server sharing the printer.
  • Share — The name of the shared printer on which you want to print. This name must be the same name defined as the Samba printer on the remote Windows machine.
  • User name — The name of the user you must log in as to access the printer. This user must exist on the Windows system, and the user must have permission to access the printer. The default user name is typically guest for Windows servers, or nobody for Samba servers.
  • Password — The password (if required) for the user specified in the User name field.
Click Forward to continue. The Printer Configuration Tool then attempts to connect to the shared printer. If the shared printer requires a username and password, a dialog window appears prompting you to provide a valid username and password for the shared printer. If an incorrect share name is specified, you can change it here as well. If a workgroup name is required to connect to the share, it can be specified in this dialog box. This dialog window is the same as the one shown when the Specify button is clicked.

Adding a Novell NetWare (NCP) Printer

To add a Novell NetWare (NCP) printer, click the New button in the main Printer Configuration Tool window. The window shown in Figure 1 will appear. Click Forward to proceed.
In the window shown in Figure 3, enter a unique name for the printer in the Name text field. The printer name cannot contain spaces and must begin with a letter. The printer name may contain letters, numbers, dashes (-), and underscores (_). Optionally, enter a short description for the printer, which can contain spaces.
Select Networked Novell (NCP) from the Select a queue type menu.
Figure 8. Adding an NCP Printer
Text fields for the following options appear:
  • Server — The hostname or IP address of the NCP system to which the printer is attached.
  • Queue — The remote queue for the printer on the NCP system.
  • User — The name of the user you must log in as to access the printer.
  • Password — The password for the user specified in the User field above.

    Adding a JetDirect Printer

    To add a JetDirect printer, click the New button in the main Printer Configuration Tool window. The window shown in Figure 1 will appear. Click Forward to proceed.
    In the window shown in Figure 3, enter a unique name for the printer in the Name text field. The printer name cannot contain spaces and must begin with a letter. The printer name may contain letters, numbers, dashes (-), and underscores (_). Optionally, enter a short description for the printer, which can contain spaces.
    Select Networked JetDirect from the Select a queue type menu, and click Forward.
    Figure 9. Adding a JetDirect Printer
    Text fields for the following options appear:
  • Printer — The hostname or IP address of the JetDirect printer.
  • Port — The port on the JetDirect printer that is listening for print jobs. The default port is 9100.


  • Selecting the Printer Model and Finishing

    After selecting the queue type of the printer, the next step is to select the printer model.
    You will see a window similar to Figure 10. If it was not auto-detected, select the model from the list. The printers are divided by manufacturers. Select the name of the printer manufacturer from the pulldown menu. The printer models are updated each time a different manufacturer is selected. Select the printer model from the list.
    Figure 10. Selecting a Printer Model
    The recommended print driver is selected based on the printer model selected. The print driver processes the data that you want to print into a format the printer can understand. Since a local printer is attached directly to your computer, you need a print driver to process the data that is sent to the printer.
    If you are configuring a remote printer (IPP, LPD, SMB, or NCP), the remote print server usually has its own print driver. If you select an additional print driver on your local computer, the data is filtered multiple times and is converted to a format that the printer can not understand.
    To make sure the data is not filtered more than once, first try selecting Generic as the manufacturer and Raw Print Queue or Postscript Printer as the printer model. After applying the changes, print a test page to try out this new configuration. If the test fails, the remote print server might not have a print driver configured. Try selecting a print driver according to the manufacturer and model of the remote printer, applying the changes, and printing a test page.


    Confirming Printer Configuration

    The last step is to confirm your printer configuration. Click Apply to add the print queue if the settings are correct. Click Back to modify the printer configuration.
    Click the Apply button in the main window to save your changes and restart the printer daemon. After applying the changes, print a test page to ensure the configuration is correct.

    Printing a Test Page

    After you have configured your printer, you should print a test page to make sure the printer is functioning properly. To print a test page, select the printer that you want to try out from the printer list, then select the appropriate test page from the Test pulldown menu.
    If you change the print driver or modify the driver options, you should print a test page to test the different configuration.
    Figure 11. Test Page Options

Modifying Existing Printers

To delete an existing printer, select the printer and click the Delete button on the toolbar. The printer is removed from the printer list. Click Apply to save the changes and restart the printer daemon.
To set the default printer, select the printer from the printer list and click the Default button on the toolbar. The default printer icon appears in the Default column of the default printer in the list. A IPP browsed queue printer can not be set as the default printer in the Printer Configuration Tool. To make an IPP printer the default, either add it as described in Section Adding an IPP Printer and make it the default or use the GNOME Print Manager to set it as the default. To start the GNOME Printer Manager, select Main Menu => System Tools => Print Manager. Right-click on the queue name, and select Set as Default. Setting the default printer in the GNOME Print Manager only changes the default printer for the user who configures it; it is not a system-wide setting.
After adding the printer(s), the settings can be edited by selecting the printer from the printer list and clicking the Edit button. The tabbed window shown in Figure 12 is displayed. The window contains the current values for the selected printer. Make any necessary changes, and click OK. Click Apply in the main Printer Configuration Tool window to save the changes and restart the printer daemon.
Figure 12. Editing a Printer

Queue Name

To rename a printer or change its short description, change the value in the Queue name tab. Click OK to return to the main window. The name of the printer should change in the printer list. Click Apply to save the change and restart the printer daemon.

Queue Type

The Queue type tab shows the queue type that was selected when adding the printer and its settings. The queue type of the printer can be changed or just the settings. After making modifications, click OK to return to the main window. Click Apply to save the changes and restart the printer daemon.
Depending on which queue type is chosen, different options are displayed. Refer to the appropriate section on adding a printer for a description of the options.

Printer Driver

The Printer driver tab shows which print driver is currently being used. If it is changed, click OK to return to the main window. Click Apply to save the change and restart the printer daemon.

Driver Options

The Driver Options tab displays advanced printer options. Options vary for each print driver. Common options include:
  • Prerender Postscript should be selected if characters beyond the basic ASCII set are being sent to the printer but they are not printing correctly (such as Japanese characters). This option prerenders non-standard PostScript fonts so that they are printed correctly.
    If the printer does not support the fonts you are trying to print, try selecting this option. For example, select this option to print Japanese fonts to a non-Japanese printer.
    Extra time is required to perform this action. Do not choose it unless problems printing the correct fonts exist.
    Also select this option if the printer can not handle PostScript level 3. This option converts it to PostScript level 1.
  • GhostScript pre-filtering — allows you to select No pre-filtering, Convert to PS level 1, or Convert to PS level 2 in case the printer can not handle certain PostScript levels. This option is only available if the PostScript driver is used.
  • Page Size allows the paper size to be selected. The options include US Letter, US Legal, A3, and A4.
  • Effective Filter Locale defaults to C. If Japanese characters are being printed, select ja_JP. Otherwise, accept the default of C.
  • Media Source defaults to Printer default. Change this option to use paper from a different tray.
To modify the driver options, click OK to return to the main window. Click Apply to save the change and restart the printer daemon.

Saving the Configuration File

When the printer configuration is saved using the Printer Configuration Tool, the application creates its own configuration file that is used to create the files in the /etc/cups directory. You can use the command line options to save or restore the Printer Configuration Tool file. If the /etc/cups/ directory is saved and restored to the same locations, the printer configuration is not restored because each time the printer daemon is restarted, it creates a new /etc/printcap file from the Printer Configuration Tool configuration file. When creating a backup of the system's configuration files, use the following method to save the printer configuration files.
To save your printer configuration, type this command as root:
/usr/sbin/redhat-config-printer-tui --Xexport > settings.xml
Your configuration is saved to the file settings.xml.
If this file is saved, it can be used to restore the printer settings. This is useful if the printer configuration is deleted, if Red Hat Enterprise Linux is reinstalled, or if the same printer configuration is needed on multiple systems. The file should be saved on a different system before reinstalling. To restore the configuration, type this command as root:
/usr/sbin/redhat-config-printer-tui --Ximport < settings.xml
If you already have a configuration file (you have configured one or more printers on the system already) and you try to import another configuration file, the existing configuration file will be overwritten. If you want to keep your existing configuration and add the configuration in the saved file, you can merge the files with the following command (as root):
/usr/sbin/redhat-config-printer-tui --Ximport --merge < settings.xml
Your printer list will then consist of the printers you configured on the system as well as the printers you imported from the saved configuration file. If the imported configuration file has a print queue with the same name as an existing print queue on the system, the print queue from the imported file will override the existing printer.
After importing the configuration file (with or without the merge command), you must restart the printer daemon. Issue the command:
/sbin/service cups restart


Command Line Configuration

If you do not have X installed and you do not want to use the text-based version, you can add a printer via the command line. This method is useful if you want to add a printer from a script or in the %post section of a kickstart installation.

Adding a Local Printer

To add a printer:
redhat-config-printer-tui --Xadd-local options
Options:
--device=node
(Required) The device node to use. For example, /dev/lp0.
--make=make
(Required) The IEEE 1284 MANUFACTURER string or the printer manufacturer's name as in the foomatic database if the manufacturer string is not available.
--model=model
(Required) The IEEE 1284 MODEL string or the printer model listed in the foomatic database if the model string is not available.
--name=name
(Optional) The name to be given to the new queue. If one is not given, a name based on the device node (such as "lp0") will be used.
--as-default
(Optional) Set this as the default queue.
After adding the printer, use the following command to start/restart the printer daemon:
service cups restart

Removing a Local Printer

A printer queue can also be removed via the command line.
As root, to remove a printer queue:
redhat-config-printer-tui --Xremove-local options
Options:
--device=node
(Required) The device node used such as /dev/lp0.
--make=make
(Required) The IEEE 1284 MANUFACTURER string, or (if none is available) the printer manufacturer's name as in the foomatic database.
--model=model
(Required) The IEEE 1284 MODEL string, or (if none is available) the printer model as listed in the foomatic database.
After removing the printer from the Printer Configuration Tool configuration, restart the printer daemon for the changes to take effect:
service cups restart
If all printers have been removed, and you do not want to run the printer daemon anymore, execute the following command:
service cups stop


Setting the Default Printer

To set the default printer, use the following command, and specify the queuename:
redhat-config-printer-tui --Xdefault --queue=queuename

Managing Print Jobs

When you send a print job to the printer daemon, such as printing text file from Emacs or printing an image from The GIMP, the print job is added to the print spool queue. The print spool queue is a list of print jobs that have been sent to the printer and information about each print request, such as the status of the request, the username of the person who sent the request, the hostname of the system that sent the request, the job number, and more.
If you are running a graphical desktop environment, click the Printer Manager icon on the panel to start the GNOME Print Manager as shown in Figure 13.
Figure 13. GNOME Print Manager
It can also be started by selecting Main Menu Button (on the Panel) => System Tools => Print Manager.
To change the printer settings, right-click on the icon for the printer and select Properties. The Printer Configuration Tool is then started.
Double-click on a configured printer to view the print spool queue as shown in Figure 14.
Figure 14. List of Print Jobs
To cancel a specific print job listed in the GNOME Print Manager, select it from the list and select Edit => Cancel Documents from the pulldown menu.
If there are active print jobs in the print spool, a printer notification icon might appears in the Panel Notification Area of the desktop panel as shown in Figure 15. Because it probes for active print jobs every five seconds, the icon might not be displayed for short print jobs.
Figure 15. Printer Notification Icon
Clicking on the printer notification icon starts the GNOME Print Manager to display a list of current print jobs.
Also located on the Panel is a Print Manager icon. To print a file from Nautilus, browse to the location of the file and drag and drop it on to the Print Manager icon on the Panel. The window shown in Figure 16 is displayed. Click OK to start printing the file.
Figure 16. Print Verification Window
To view the list of print jobs in the print spool from a shell prompt, type the command lpq. The last few lines will look similar to the following:
Rank   Owner/ID            Class  Job Files       Size Time
active user@localhost+902    A    902 sample.txt  2050 01:20:46
Example 1. Example of lpq output
If you want to cancel a print job, find the job number of the request with the command lpq and then use the command lprm job number. For example, lprm 902 would cancel the print job in Example 1. You must have proper permissions to cancel a print job. You can not cancel print jobs that were started by other users unless you are logged in as root on the machine to which the printer is attached.
You can also print a file directly from a shell prompt. For example, the command lpr sample.txt will print the text file sample.txt. The print filter determines what type of file it is and converts it into a format the printer can understand.


Sharing a Printer

The Printer Configuration Tool's ability to share configuration options can only be used if you are using the CUPS printing system.
Allowing users on a different computer on the network to print to a printer configured for your system is called sharing the printer. By default, printers configured with the Printer Configuration Tool are not shared.
To share a configured printer, start the Printer Configuration Tool and select a printer from the list. Then select Action => Sharing from the pulldown menu.


On the Queue tab, select the option to make the queue available to other users.
Figure 17. Queue Options
After selecting to share the queue, by default, all hosts are allowed to print to the shared printer. Allowing all systems on the network to print to the queue can be dangerous, especially if the system is directly connected to the Internet. It is recommended that this option be changed by selecting the All hosts entry and clicking the Edit button to display the window shown in Figure 18.
If you have a firewall configured on the print server, it must be able to send and receive connections on the incoming UDP port, 631. If you have a firewall configured on the client (the computer sending the print request), it must be allowed to send and accept connections on port 631.
Figure 18. Allowed Hosts
The General tab configures settings for all printers, including those not viewable with the Printer Configuration Tool. There are two options:
  • Automatically find remote shared queues — Selected by default, this option enables IPP browsing, which means that when other machines on the network broadcast the queues that they have, the queues are automatically added to the list of printers available to the system; no additional configuration is required for a printer found from IPP browsing. This option does not automatically share the printers configured on the local system.
  • Enable LPD protocol — This option allows the printer to receive print jobs from clients configured to use the LPD protocol using the cups-lpd service, which is an xinetd service.

Figure 19. System-wide Sharing Options


Additional Resources

To learn more about printing on Red Hat Enterprise Linux, refer to the following resources.

 Installed Documentation

  • map lpr — The manual page for the lpr command that allows you to print files from the command line.
  • man lprm — The manual page for the command line utility to remove print jobs from the print queue.
  • man mpage — The manual page for the command line utility to print multiple pages on one sheet of paper.
  • man cupsd — The manual page for the CUPS printer daemon.
  • man cupsd.conf — The manual page for the CUPS printer daemon configuration file.
  • man classes.conf — The manual page for the class configuration file for CUPS.

Useful Websites


No comments:

Post a Comment