Printers

Configuring Linux printers with printtool

Configuring a printer on a Linux box is not really as difficult as you might think. In fact, it's downright easy! Jack Wallen, Jr., explains to you one of the simplest printer configuration tools he knows...printtool.


You have a Linux box up and running. With the help of my configuration series, you've managed to configure users, networking, and sound so far. Now it's time you stepped up to the printer plate and smacked a home run!

In this Daily Feature, we're going to configure both a local and a remote printer (with a helping hand from Samba) using Red Hat's printtool utility.

What is printtool?
The printtool utility is actually a front end for a couple of different applications. The first use of printtool is as a front end for creating and editing the /etc/printcap file. The /etc/printcap file is charged with communicating to lpd (line printer daemon) the configurations (i.e., printer names, printer locations, printer filters) for the connected printers.

The printtool utility is also a front end for the lpd daemon. With the printtool utility, you can restart the lpd daemon after you have set up or edited a printer.

Starting printtool
Starting the printtool utility is as simple as starting up the X Windows System, logging in to root (from a console window, type su and enter root's password when prompted), and finally running the command:
printtool

When you run this command, you will be greeted with the main printtool window, which resembles that in Figure A.

Figure A
From the main printtool window, you can add, edit, and delete printer configurations, restart lpd, run various print tests, reload the current configurations, and get basic help.


Configuring a local printer
From this main window, we are going to first configure a local printer. Click the Add button, which will produce the Add A Printer Entry window (see Figure B). From this window, select Local Printer and click OK.

Figure B
After you have chosen to add a new printer from the main printtool window, you will select a type of printer.


The next window to appear, Edit Local Printer Entry, will confirm what printer devices were auto-detected (see Figure C). In our example, we see that /dev/lp0 is the only printer device detected. That is fine because one is all that we really need for this local printer setup. Click OK so that you can start editing the printer entry. Remember the printcap file I spoke of earlier? This particular window is actually writing to this file. So, instead of having to manually create an /etc/printcap file (see sample in sidebar), you simply have to fill in the blanks offered in Figure C.

Figure C
Setting up a printer is much easier with printtool than by hacking files!


Within the Edit Local Printer Entry window, there are five total configurations for you to deal with:
  • ·        Names: This is the name of the printer.
  • ·        Spool Directory: This is where log files, filters (specific to configured printer), lock files, and other configuration files are housed.
  • ·        File Limit In Kb (0 = no limit): This allows you to limit the allowable file size to be printed.
  • ·        Printer Device: Remember when we initially ran the printtool application and saw that /dev/lp0 was the only printer available? This is where you declare that device.
  • ·        Input Filter: This is where you choose your filter (a.k.a., driver). Click the Select button and a long list of printers will appear (see Figure D).

Figure D
If your printer prints incorrectly, you might select Send EOF After Job To Eject Page.


Restarting lpd and printing a test page
Once you've configured your printer, you will want to restart the line printer daemon. To do this, you simply have to go back to the main printtool window and choose Restart Lpd from the Lpd drop-down menu (see Figure E).

After you restart the daemon, you can then select the printer you just configured by highlighting it and selecting the type of test you want to run from the Tests drop-down menu (see Figure F).

Figure E
You must restart the line printer daemon before you will be able to print to a newly configured printer.


Figure F
Most printers will be able to print an ASCII test page.


Setting up a remote SMB printer
Setting up a remote SMB printer is pretty much the same as the above configuration, with the addition of a couple of extra configuration entries and a properly working Samba installation.

For the purposes of this Daily Feature, I'll assume you have Samba up and running and only need to configure the printer.

To begin the setup of a remote SMB printer, select SMB/Windows 95/98/NT Printer from the Add A Printer Entry window (see Figure B). Click OK to continue. You will see the Edit SMB/Windows 95/98/NT Printer Entry window. As you can see in Figure G, there are a few more configurations to enter. In our example, in addition to what you entered for the local printer, you have to know network settings for your remote printer.

Figure G
What is critical in this configuration are the Hostname Of Printer Server, Printer Name, User, Password, and Workgroup entries.


In our example, we have a printer, tr2k, which has an IP address of 10.2.1.27, a printer name of 9900_Meeting, and lives on the TECH workgroup. Also in this example, we have configured the user wallenj, whose password is ******** (just a little humor there).

Once this printer is configured, click OK and then restart and test as you did above.

One last word on remote SMB printers
As mentioned, you will need to have a properly configured Samba installation. Fortunately for all you TechProGuild members, we have a great series covering that very topic! Take a look at Bryan Pfaffenberger's cross-platform printer series part one and part two for more information.

About Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic and Linux.com. He’s an avid promoter of open source and the voice of The Android Expert. For more news about Jack Wallen, visit his website jackwallen.com.

Editor's Picks