Adding Printers


Printers are one of the most common types of external device. Today, many computer manufactures bundle printers with new computers-it's hard not to have a printer. Printers used to come with one of two types of connectors: serial or parallel. Today, USB printers are very common. In corporate and small-office/home-office (SOHO) environments, networked printers are common. Ubuntu supports an amazing number of printers; making Ubuntu work with most printers is relatively easy.

Changing Paper Size

Before you install your first printer, be sure to set the system's default paper size. This is found in the file /etc/papersize. The default paper size probably says A4 or letter-this depends on the geographical location you selected during the installation. If the default paper size is not set right, then every printer you add to the system will be configured with the wrong default paper size. Changing /etc/papersize after you create a printer will not alter any already existing printers.

To change the default paper size, edit the /etc/papersize file and change the value. Common values are A4, letter, and legal. A4 is a commonly used standard paper in Europe. Letter and legal refer to the 8.5" × 11" and 8.5" × 14" paper sizes common in the United States. Less common paper sizes that I have come across include A5, B2, C2, ledger, and 10 × 14.

Tip 

If you have multiple printers that take different paper sizes, set the value in /etc/papersize before adding each printer.

image from book
Papers Please

Paper sizes, such as A0, A1, A2, B3, C4, and D4, refer to ratios from a larger piece of paper. For example, A0 has a total area of one square meter. The A0 dimensions are 841 × 1189 mm. A1 is half of A0's longest direction: 594 × 841mm. A2 is half of A1 (420 × 594), and so on. As a result, 16 sheets of A4 cover a surface area of 1m2. Other paper types follow the same ratios-four sheets of B2 can fit in one B0 sheet. B0 is 1000 × 1414 mm and C0 is 917 × 1297 mm.

Specific fields use different paper sizes. For example, A is common in publishing and C is used in construction for building plans. If you have a large printer or plotter, be sure to set up /etc/papersize with the right default before adding the printer.

image from book

Adding a Printer

Adding a printer under Ubuntu is straightforward. Go to System image from book Administration image from book Printing to open the printer applet. From there, you can double-click New Printer to configure the device.

The first step in adding a printer requires specifying which kernel device communicates with the printer (see Figure 3-4). The default choices are a local printer using a USB or parallel port, or a network printer. Although the local printer configuration is easy (simply select the detected USB printer or parallel port), networked printers require additional information.

  • CUPS Printer (IPP)-The Common Unix Printing System allows the sharing of printers between different Unix computers. You will need to provide a URL for the printer, such as ipp://server/printer_name.

  • Windows Printer (SMB)-More common than CUPS are Windows printers. In small offices, a user with a printer directly connected to their Windows host can share the printer with the network. You will need to provide the Windows host name, printer name, and any user name and password needed to access the device.

  • Unix Printer (LPD)-The Line Printer Daemon protocol is one of the oldest and most reliable network printing options. Most stand-alone network printers support LPD. For this option, you will need to provide the host name and the name of the LPD print queue.

  • HP JetDirect-This is another common protocol for stand-alone printers. You only need to provide the host name (and port number if it's not the default 9100).

image from book
Figure 3-4: The applet for adding a new printer

The second step for adding a printer enables you to specify the type of printer. If your exact printer model is not listed, chances are good that there is a model that is close enough. In the worst case, you can always select one of the generic printer options.

Finally, you should name the printer. Give it something descriptive so you can recognize it later.

Sharing Your Printer

After you have added your printer, you can share it with other people on the network. Sharing the printer requires knowing who will use it: other system using CUPS, other devices using LPD, or other computers running Windows.

Sharing With CUPS

To share the printer with CUPS, you will need to configure both the printer server and the client.

On the print server:

  1. Edit /etc/cups/cups.d/ports.conf and change the line that reads Listen localhost:631 to Port 631. This tells CUPS to allow printing from any remote system.

  2. (Optional) Edit /etc/cups/cups.d/browse.conf and change Browsing off to Browsing on. This allows the server to announce the printer's availability to other hosts on the network. The default is an announcement every 30 seconds.

  3. Restart the CUPS subsystem on the print server.

     sudo /etc/init.d/cupsys restart 

On the print client:

  1. Go to System image from book Administration image from book Printing to open the printer applet.

  2. Double-click New Printer to configure the device.

  3. Select a Network Printer and the CUPS Printer (IPP) protocol.

  4. Enter the printer host name and printer name as a URL. For example, if the server is named printer.example.com and the printer is called Okidata127, then you would use ipp://printer.example.com/printers/Okidata127.

  5. Click the Forward button and select the printer model.

  6. Create a description for the printer

  7. Click on the Apply button to create the printer.

Tip 

If you enabled browsing in Step 2 of the server configuration, then Ubuntu clients can use the Global Settings image from book Detect LAN Printers option on the Printing applet. This will automatically discover and configure the remote printer.

image from book
CUPS Runneth Over

CUPS provides many configuration options, but it has a long history of being a security risk. The CUPS installation includes a web-based administration interface. By default, it is not accessible remotely. (But if you followed the steps under Sharing With CUPS, then it is remotely accessible.) The URL for this interface is http://localhost:631/.

Although you can use the CUPS web interface to view and manage the print queue, the default administration interface does not permit adding new printers or changing configurations. This functionality is disabled in Ubuntu primarily due to security risks. Enabling this interface is not recommended. Instead, if you need to modify printer configurations, use the System image from book Preferences image from book Printing applet.

image from book

Sharing With LPD

Enabling LPD support is a little more complex since Ubuntu does not normally include servers.

On the print server:

  1. Install xinetd on the print server. This is the extended Internet daemon for running processes.

     sudo apt-get install xinetd 
  2. Create a configuration file for the printer service. This requires creating a file called /etc/xinetd.d/printer. The contents should look like this:

     service printer {   socket_type = stream   protocol = tcp   wait = no   user = lp   group = sys   server = /usr/lib/cups/daemon/cups-lpd   server_args = -o document-format=application/octet/stream } 
  3. Restart the xinetd server.

     sudo /etc/init.d/xinetd restart 

On the printer client:

  1. Go to System image from book Administration image from book Printing to open the printer applet.

  2. Double-click New Printer to configure the device.

  3. Select a Network Printer and the Unix Printer (lpd) protocol.

  4. Enter the print server host name (or IP address) in the Host field and the CUPS printer name under the Queue field.

  5. Continue through the remaining screens to select the printer type and configuration. On the final screen, click the Apply button to create the printer.

Sharing with Windows

It is usually best to use a native printing protocol. For Ubuntu, LPD and CUPS are native. Most versions of Windows support network printing to LPD servers, so sharing with LPD should be enough, but it requires user to configure their printers.

Native Windows environments can share printers using the Server Message Block (SMB) protocol. This allows Windows users to browse the Network Neighborhood and add any shared printers-very little manual configuration is required. For Ubuntu to share a printer with Windows users requires installing SAMBA, an open source SMB server.

On the print server:

  1. Install SAMBA on the print server. This provides Windows SMB support.

     sudo apt-get install samba 
  2. Create a directory for the print spool.

     sudo mkdir /var/spool/smbprint 
  3. Edit the SAMBA configuration file: /etc/samba/smb.conf.

  4. Change workgroup = to match your Windows Workgroup.

  5. Under the [global] section is an area for printer configuration. Uncomment (remove the leading ;) the load printers = yes and CUPS printing lines.

  6. Set the [printers] section to look like this:

     [printers]    comment = All Printers    browseable = no    security = share    use client driver = yes    guest ok = yes    path = /var/spool/smbprint    printable = yes    public = yes    writable = yes    create mode = 0700 

    This setting allows any Windows client to access the printers without a password.

  7. (Optional) Under the [printers] section, set browseable = yes. This allows Windows systems to see the printers through the Network Neighborhood.

  8. Restart the SAMBA server.

     sudo /etc/init.d/samba restart 

On the Windows client, you can add the printer as if it were a Windows printer. For example, if the server's name is printer.example.com and the printer is Okidata127, then the shared printer resource would be \\printer.example.com\Okidata127. Windows clients will need to install their own print drivers.



Hacking Ubuntu
Hacking Ubuntu: Serious Hacks Mods and Customizations (ExtremeTech)
ISBN: 047010872X
EAN: 2147483647
Year: 2004
Pages: 124
Authors: Neal Krawetz

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net