Using Central Printers from Linux
Handout LAG 320 / July 2006
Overview
The Iowa State Linux software allows Red Hat Linux systems to print to the Information Technology Services central printers or to some departmental printers. Printing from a shell (like bash or tcsh) uses the lpr command:
lpr [options] [files]If you did not install the Kerberized login components of Iowa State Linux, you will need to use the kinit command to enter your Iowa State Net-ID and password before printing. When printing through the central print servers, you may send either PostScript files or plain text files. You do not need to convert text files to PostScript; the server will detect which type of file you are sending and translate it accordingly.
1 Options
Here are some of the common options for the lpr command:
-PprinterThis will send the output to the printer listed, rather than the default printer. If you do not supply this option, the output will go to the default printer (set by the PRINTER environment variable, typically by the line export PRINTER=printer_queue in your .profile or system-wide /etc/profile file). If you do not have a default printer set, it will go to the system-wide default printer, a black-and-white laser printer in 95 Durham Center; your output will appear in a bin in 139 Durham Center. Common printer queues are:
du139_lj4 the black-and-white printer with output delivered to bins in 139 Durham Center
du139_color the color printer with output delivered to bins in 139 Durham Center
du139-lj5 the self-serve, black-and-white printer in 139 Durham Center.
-BbinWhen you print to the central printers in Durham Center, your output is delivered to a bin in 139 Durham Center. You can specify the bin number your print output will be delivered to. Bin numbers must be between 201 and 475. If you do not specify a bin number, the output will be put in your default bin (set by the BIN environment variable, typically by the line export BIN=bin_number in your .profile or system-wide /etc/profile file).
-GgrantThere are two grants used for printing. Students have by default a $5 printing subsidy provided through their computer fee. This grant is called subsidy_netid. All accounts have a U-Bill grant, called ubill_netid, that allows you to charge up to $50 in printing to your U-Bill. If you do not specify a grant, the output will be charged to your default grant (set by the GRANT environment variable, typically by the line export GRANT=grant_name in your .profile or system-wide /etc/profile file). If you do not set a default grant, your printing will be charged against your subsidy grant.
-FformThis will set the type of paper for your print job. By default, this is:
- 3hol (three-hole white paper) on the black-and-white printer
- bond (white paper) on the color printer
Another common form is tran (transparencies). Costs on the black-and-white printers are:
- $.07 for bond and 3hol forms per side
- $.40 for tran form
Prints one-sided. The default is two-sided.
For more information on printing from Linux in general, see the Linux Printing HOWTO at
http://www.tldp.org/HOWTO/Printing-HOWTO/.
2 Setting Defaults
The Iowa State Linux install puts the localized version of lpr in the directory /usr/athena/bin. This directory should be included in your path before /usr/bin but after /usr/kerberos/bin. If you have installed the full Iowa State Linux package, the installation process will make this change for you. If you have not installed the Kerberized login RPMs, these directories will not be added to your path. You can see what directories are in your path with the command echo $PATH.
To add these directories to the path of all users on your machine, add the following lines to the "Path manipulation" section of the file /etc/profile. To make these changes only for individual users, add these lines to the file /home/username/.profile. Warning: Once you have made these changes you will not be able to print to a local printer unless you specify the path to the original lpr command, i.e., /usr/bin/lpr.
if ! echo $PATH | /bin/grep -q "/usr/athena/bin" ; then
PATH = "/usr/athena/bin:$PATH "
fi
if ! echo $PATH | /bin/grep -q "/usr/kerberos/bin" ; then
PATH="/usr/kerberos/bin:$PATH"
fi
export PATH
To set a default print queue, grant, and bin number, add the following lines to either of the files above:
PRINTER=printer_queue
GRANT=grant_name
BIN=bin_number
export PRINTER GRANT BIN
3 Application Configuration
The lpr command allows you to print from the command shell, but you'll also need to tell desktop applications how to find the appropriate print command. With some applications, you can make this setting once; with others, you'll have to enter the command each time.
3.1 StarOffice/OpenOffice.org
StarOffice and OpenOffice.org must have printers configured with the Printer Administration tool (spadmin) before you can use them to print. You can set up a printer for each queue you might need to print to; the system administrator can set it up for all users. Here's how it works:
- Start a shell and become root with the su command.
- Change to the directory containing spadmin. The StarOffice and OpenOffice.org and installers default to the
directories shown below:
StarOffice /opt/staroffice6.0
OpenOffice.org /opt/OpenOffice.org1.0
If you've installed the application somewhere else, change to that directory. - Start spadmin with the command: ./spadmin &
- In the Printer Administration window, click New Printer.
- Choose Add a printer and click Next.
- Printer Administration will display a list of printer types. All of them are PostScript printers. (StarOffice and OpenOffice.org will only print to a PostScript printer unless you use an output filter like Ghostscript that converts PostScript to a non-PostScript language.) Select the one most like your printer or choose Generic Printer. The generic printer should print on any PostScript printer, but will not be able to control many of your printer's special features. Use Generic Printer for the 139 Durham Center printers. Click Next.
- Enter the command to print to your chosen queue as follows:
/usr/athena/bin/lpr -Pprinter_name -Ggrant_name
Use the full path so that remote users who launch OpenOffice.org or StarOffice from a local menu command can still access the lpr command. When you've entered all the options on the command line, click Next. - Enter a name for the printer and click Finish. This name will appear in the Print dialog box when you print from any OpenOffice.org or StarOffice application. If you prefer, you can click Use as default printer to make this the default printer.
- OpenOffice.org and StarOffice originated in Europe and have some European options set as the default. Unless you intend to use A4 paper in your departmental printer, you need to change that setting. In the Printer Administration window, highlight the name of the printer and click Properties.
- Click Paper, then reset the paper size from A4 to US Letter.
- Click OK, then Close.
- The queue you've entered should now appear as a selectable printer in the Print dialog box in any StarOffice or OpenOffice.org application. Note: If you have both StarOffice and OpenOffice.org installed on your machine, you will need to run Printer Administration and add the printer for both suites; the information is stored separately for each version.
- Warning: If you have configured the default printer to use letter as the paper size, StarOffice or OpenOffice.org will create new documents on letter-sized paper. If you have not configured a printer, they will use A4 as the default size, and any document you have already created will expect to print on A4 paper. To correct this, open the document, select Format-> Document, click the Page tab and choose Letter for the document's paper size. Click OK and save the document.
3.2 K Desktop Environment (KDE)
The K Desktop Environment also allows you to create printers, which will then be available in the Print dialog box for all KDE applications, including KMail, KWord, KSpread, KPresenter, etc. Unfortunately, these settings cannot be made system-wide, they must be configured for each user.
- Start the KDE Control Center. Either click K Menu-> Control Center, or at the shell prompt type: kcontrol &
- In the menu on the left side of the window, click System, then Printing Manager.
- On the right side, right-click on the printer list and select Add special (pseudo) printer.
- Enter the following information:
Name: a meaningful queue name
Description: a description for the queue
Location: where the printer is
Command: /usr/athena/bin/lpr -Pprinter_name -Ggrant_name %in - Click OK.
3.3 GIMP
You'll only need to enter the printer command the first time you print from GIMP. After that it will remember the last printer used. Note that GIMP has special options it would like to add to the lpr command.
- Right-click on an open document and choose File-> Print.
- Select an appropriate printer model. For the central printers, select PostScript Level 1.
- Enter the following printer command:
/usr/athena/bin/lpr -Pprinter_name -Ggrant_name -s -dlpr -draw - Click OK, then Print and save settings.
3.4 Mozilla
Mozilla will also remember a printer command and properties for the default printer after the first time you print:
- Click Print or select Printfrom the File menu.
- Click Properties.
- Under Print command enter:
/usr/athena/bin/lpr -Pprinter_name -Ggrant_name - Make sure the paper size is set to Letter.
- Click Print.
3.5 Opera 6.x
Opera is a good graphical web browser for smaller machines. When you print, Opera displays the list of printers from the /etc/printcap file, which doesn't include ITS central printers. You can add one custom printer to the list like this:
- Choose File-> Print.
- Click the Options tab.
- Click Add or remove custom printer.
- Under Printer Program enter:
/usr/athena/bin/lpr - Under Parameter enter:
-Pprinter_name -Ggrant_name -Bbin_number - Click the Destination tab, choose the Custom Printer, then click Print.
Your custom printer choice will be saved when you exit Opera.
3.6 Other Applications
Applications such as AbiWord, Balsa, Gnumeric, Ical, and Netscape 4.x make you enter the printing command every time you print. If you have followed the instructions above on setting the path and the default printer and grant, you should be able to print to the default printer without setting any options. If you have not changed the path and set default environment variables, or if you need to print to another printer or set unusual options, enter the appropriate printing command as described above in the Print dialog box along with any options you need.
Using Central Printers from Linux was written by Jeff Balvanz.
For more assistance, contact the Solution Center by phone at 515-294-4000, on the web at http://www.it.iastate.edu/help/, by email at solution@iastate.edu, or in person at 195 Durham Center.

