To direct the output of of VisualAge for Java printing commands to a printer, you must first configure the system to recognize any available printers and queues. Printer definitions are installed through the Print Setup option in the File menu. To install printer definitions:
port=print_command
The port is any string which users will recognize as referring to a particular printer. The print_command is the command used for sending output to the printer port (for example, lp -d or lpr -P). For example, suppose you have two printers, ADMIN and LAB. Your definitions might look like the following:
ADMIN=rsh bandit "lp -d ps" LAB=lpr -Pgonzo
In this example, ADMIN refers to a printer connected to the system BANDIT, so the print command is a remote shell command executed on BANDIT. ADMIN is a PostScript printer attached to a queue named PD, so the command lp -d ps is executed on BANDIT to print to ADMIN. LAB, however, prints to a printer on the local system, so the print command executed locally to print to LAB is lpr -Pgonzo, where GONZO specifies the defined PostScript printer queue name.
Note: Some systems use lp -dqueuename to send output to the printer; others use lpr -Pqueuename. Use the appropriate command to generate printed output on your system.
Note: To modify an existing port using the Printer Setup dialog, select the port you want to modify and edit the port information in the Edit Port input area, then select Add/Replace.
To close any dialog without accepting the changes, select Cancel. To close a dialog and accept the changes, select Dismiss.
Configuring Printer Setup Options
The Print Setup dialog does the following:
The orientation, scale, and number of copies to be printed can be specified directly using this dialog. Additionally, the action area of the Print Setup dialog contains the following buttons:
Button | Description |
Apply | Provides changed configuration information to the application without updating the default printer. |
Save | Saves the current configuration information as your default printer. |
Reset | Reloads the default configuration from $HOME/.Xpdefaults |
Cancel | Closes the dialog and aborts all configuration changes. |
Options | Displays the options dialog box that allows you to select a different printer setup. |
Install | Displays the installation dialog box that allows you to add or remove printer devices and printer ports. |
Selecting the Install button will open a dialog allowing you to add and remove printer definitions.
To select a different printer or to change printer-specific properties, select Options. If the Options button is disabled, ensure that Printer Specific is selected in the outputTo: field.
Printer name, resolution, page size, and paper tray can be changed using this dialog. Selecting the arrow button to the right of the field displays a list of valid values from which you can choose. The values presented differ based upon the particular printer selected. To save the configuration as the default, after you have changes the printer option, select Save. Select Apply when finished to close the printer prompter.
Printer Configuration Information
By default, printer configuration information is stored in the file Xpdefaults,
in the printer subdirectory (that is opt/IBMVJava/printing). The information in this
file is used by the printer prompter to allow selecting and modification of currently
defined printers. This file can be treated as common and shared by multiple users.
It is important, however, to note that the Xpdefaults file is read-only. When a user modifies the printer information in this file using the printer prompter, the resulting information is stored in the user's home directory in the file .Xpdefaults. If a user's home directory contains an .Xpdefaults, this file will always be used in preference to the common Xpdefaults file. Each user, therefore, can have a different printer configuration. As a result, it is necessary to rename the $HOME/.Xpdefaults file to Xpdefaults and move the file to the printing directory for all users to have access to the newly installed printers.
Printing Program Elements
Printing Source Code and Other Text
Printing the Graph View of a Class