IDL Printer Setup for UNIX or Mac OS X

IDL for UNIX uses the Xprinter print technology from Bristol Technology to create and output information to a wide variety of printers. This section describes the Xprinter setup dialogs.

The Xprinter Setup Dialog

To configure a printer for use by IDL, enter the following command at the IDL command line:

void = DIALOG_PRINTERSETUP() 

The Xprinter Setup dialog allows you to select model-specific printer options such as paper trays, paper size, page orientation, and the UNIX print spooler command. Printer options are saved in the $HOME/.XprinterDefaults file. Once configured, the desired information is saved to the file system and used in future IDL sessions.

Figure 8-2: The Printer Setup Dialog

unix_printsetup01.gif

Printer Setup Dialog Buttons

The action area of the Printer Setup dialog contains six buttons:

Table 8-1: Printer Setup Dialog Buttons 

Button
Description

OK

Writes current configuration information to your default printer information file $HOME/.XprinterDefaults. This button also dismisses the dialog.

Save

Writes current configuration information to your default printer information file $HOME/.XprinterDefaults.

Reset

Reloads default configuration from $HOME/.XprinterDefaults.

Cancel

Closes dialog and cancels all configuration changes.

Options

Displays the options dialog box that lets you select an alternate printer setup. This button is disabled if output is configured to be sent to a file instead of a printer.

Install

Displays the installation dialog box that allows you to add or remove printer devices and printer ports from the $HOME/.XprinterDefaults file.

Configuring Printer Setup Options

Specify the following options on the initial Printer Setup dialog:

Table 8-2: Specifying Printer Setup Options 

Option
Description

Output Format:

Specify whether to send output to a file or a printer. If you choose Printer Specific, you can send output to any printer type/port combination configured in your $HOME/.XprinterDefaults file. If the port is FILE:, Xprinter creates an output file for the specified printer type. If you choose Generic (File Only), print output is sent to an Encapsulated PostScript or generic PCL file.

Printer:

This field appears only if you select Output Format: Printer Specific. It specifies the name of the default printer type/port to which to send print output. Click the Options button to specify a different printer type/port combination.

File Name:

This field appears only if you choose Output Format: Generic (File Only). Type the name of the print file you wish to create. To pipe print output to a command, enter a ! character as the first character and then specify the command to which to send output. For example, to send output to the lp command, enter the following:

!lp

EPSF

PCL4

PCL5

This field only appears if you select Output Format: File. Click this button to display a list of output file types and select the desired type. Available types are EPSF (Encapsulated PostScript), PCL4, and PCL5.

Orientation

Specify portrait or landscape.

Scale

To increase the size of the output, specify a value greater than 1.00. To reduce the size, specify a value less than 1.00. For example, a value of 2.00 would double the size of the output; a value of 0.50 would reduce it by half.

Copies

Specify the number of copies to print.

To set additional options, such as selecting a different printer or changing the page size, click the Options button. The Options dialog appears.

Note
The Options dialog is only available when sending output to a printer.

Figure 8-3: The Options Dialog

unix_printsetup02.gif

Use this dialog to set the Printer Setup options:

Table 8-3: The Printer Setup Options

Option
Description

Printer Name

Use this field to select the current printer. Click the down arrow to display a list of configured printers.

Resolution

Specify printer resolution with this field. Values vary depending on printer.

Page Size

Specify paper size with this field. Values vary depending on printer.

Paper tray

Specify paper tray with this field. Values vary depending on printer.

Duplex

Specify duplex options (if the selected printer supports duplex printing). Valid values include None (no duplex printing), Duplex Tumble (flips over the short edge), and Duplex No Tumble (flips over the long edge). If the selected printer does not support duplexing, this field is disabled.

Adding a New Printer to the List of Printer Choices

To add a new printer to your list of available printers:

Defining a New Port

To define a new port using the Printer Setup dialog:

  1. Display the Ports dialog. From the Printer Setup dialog, select Install, Add Printer, and Define New Port.
  2. Figure 8-4: Defining a New Port

    unix_printsetup03.gif

  3. Type the port definition in the Edit Port edit box. Port definitions have the following format:
  4. port=print_command 
     

    The print_command is the command for sending output to the printer port. If you were to have two printers named ORION and SIRIUS for example, the definitions would appear as follows:

    ORION=rsh bandit "lp -d ps" SIRIUS=rsh bandit "lp -d ps -T pcl5"

    Both printers here are connected to the system bandit, so the print command is a remote shell command executed on bandit. ORION is a PostScript printer, so the command lp -d ps is executed on bandit to print to ORION. SIRIUS though is a PCL5 printer, so the print command executed on bandit to print to SIRIUS is lp -d ps -T pcl5.

  5. Click Add/Replace and the new port is now included in the list of current port definitions.
  6. Repeat the above step for each printer to which you wish to send output.

Note
To create a printer port for each available queue on hp700 systems, click the Spooler button on the Ports dialog. This command creates a default printer port for each available printer queue returned by the lpstat -a command.

Modifying an Existing Port

In order to modify an existing port using the Printer Setup dialog:

  1. Display the Ports dialog. From the Printer Setup dialog, click Install, Add Printer, and Define New Port.
  2. Select the port you wish to modify and edit the port information in the Edit Port edit box.
  3. Click Add/Replace. The modified port is now included in the list of current port definitions.

Matching a Printer Device to a Port

In order to match a printer device to a port using the Printer Setup dialog:

  1. Display the Add Printer dialog. From the Printer Setup dialog, click Install and Add Printer.
  2. In the Printer Devices field, select the description that matches the printer you are to install. If no description matches this printer, contact your printer vendor for a printer description (PPD) file.
  3. Select the desired port in the Current Port Definitions list box and click Add Selected. The new printer is now included in the list of currently installed printers.
  4. Figure 8-5: Adding a Printer

    unix_printsetup04.gif

Removing an Installed Printer

In order to remove a printer device/port combination using the Printer Setup dialog:

  1. Display the Printer Installation dialog. From the Printer Setup dialog, click Install.
  2. In the Currently Installed Printers list box, select the printer you wish to remove and click on Remove Selected.

Manually Modifying Default Printer Setup Values

Xprinter retrieves default printer setup information from the file .XprinterDefaults in your home directory. If this file does not exist, Xprinter reads the information from the file $XPHOME/xprinter/XprinterDefaults or $XPPATH/XprinterDefaults.

Note
For IDL, $XPATH is set to $IDL_DIR/resource/xprinter.

The Xprinter Printer Setup dialog writes modifications to the default information in $HOME/.XprinterDefaults. However, it never modifies the default information in the file $XPHOME/XprinterDefaults or $XPPATH/XprinterDefaults. If the file $HOME/.XprinterDefaults does not already exist, the Xprinter Printer Setup dialog creates it.

Although the most common way to modify the default Printer Setup is using the Printer Setup dialog, which updates $HOME/.XprinterDefaults automatically, you may also edit this file with any text editor and make changes directly.

You may also set up the $HOME/.XprinterDefaults file to do the following:

Defining a Port

A printer port is an alias for the print command. It is defined in the [ports] section of $HOME/.Xpdfaults and appears as part of the Printer Name in the Printer Setup dialog. For instance, the following is the first Printer Name in the Printer Setup dialog before you make any changes to $HOME/.XprinterDefaults:

AppleLaserWriter v23.0 PostScript on FILE: 

For this Printer Name, FILE: is the port name. To send output to a printer instead of a file, you first must define a port for each printer to which you wish to direct output. Port entries in the [ports] section have this format:

port=print_command 

The print_command is the command for sending output to the printer port. For instance, if you have two printers (ORION and SIRIUS), your [ports] section may appear as follows:

[ports] 
ORION=rsh bandit "lp -d ps" 
SIRIUS=rsh bandit "lp -d ps -T pcl5" 

In the above, both printers are connected to the system bandit, so the print command is a remote shell command executed on bandit. ORION is a PostScript printer, so the command lp -d ps is executed on bandit to print to ORION. SIRIUS, though, is a PCL5 printer, and thus the print command executed on bandit to print to SIRIUS is lp -d ps -T pcl5.

If a printer is connected to your local system, you will need to add an entry for that printer as well. For the local printer, your entry should be like the following:

[ports] 
ORION=rsh bandit "lp -d ps" 
SIRIUS=rsh bandit "lp -d ps -T pcl15" 
LOCAL=lp -d ps 

Your printer port can be any name you choose except FILE:, which is the only reserved port name. It causes Xprinter to create a print file formatted specifically for the specified printer type.

An entry must be created in the [ports] section for every printer to which you wish to be able to print.

Matching a Printer Type to a Defined Port

After you have defined a port for each printer, you must tell Xprinter what type of printer is associated with each port. List device types in the [devices] section of the .XprinterDefaults file. Each entry in the [devices] section has the following format:

alias=PPD_file driver,port 

Note
There must be a space between the PPD_file and driver and a comma between the driver and the port. The following table describes each part of this entry.

Table 8-4: Associating a Printer with a Port 

Field
Description

alias

The alias is a descriptive name used to identify the printer. It can be anything you choose. The alias is the name which appears in the Printer Setup dialog (such as HP LaserJet III SI PostScript).

PPD_file

The PPD_file is the name of the printer description (PPD) file used by the printer, without a .PPD extension. Search in the directory $XPHOME/xprinter/ppds/ to find the PPD file for your printer.

driver

The driver is the type of driver your printer uses. Value values are PostScript, PCL4, and PCL5.

port

The port is the printer port as listed in the [ports] section of the .XprinterDefaults file (ORION, SIRIUS, and LOCAL in the example [ports] section).

Here's an example configuring three printers:

Table 8-5: Example Configuration 

Port
Printer Type
Output Type

ORION

HP LaserJet IIISi PostScript v52.3

PostScript

SIRIUS

HP LaserJet 4M PCL Cartridge

PCL

LOCAL

QMS-PS 2200 v52.3

PostScript

First, be sure to choose an alias for each printer. In order to make it simpler to identify the printer from the Printer Setup dialog you wish to use, you may use the following aliases:

HP LaserJet PS 
HP LasterJet PCL 
QMS PS 

It is important to note that if you utilize the Printer Setup dialog to associate ports and PPD files, you cannot specify a printer alias. You must instead choose an alias from the predefined listing that appears in the Printer Devices list box in the Add Printer dialog. The corresponding PPD file is already associated with the printer aliases in this list box.

Now, identify the PPD file associated with each of these printers.

Thus the [devices] section of the .XprinterDefaults file would be as follows:

[devices] 
HP LaserJet PS=HP3SI523 PostScript,ORION 
HP LaserJet PCL=HP4M PCL,SIRIUS 
QMS PS=Q2200523 PostScript,LOCAL 

After these entries have been added to your .XprinterDefaults file, the following printer choices are available from the Printer Setup dialog:

HP LaserJet PS on ORION 
HP LaserJet PCL on SIRIUS 
QMS PS on LOCAL 

Specifying a Default Printer

After you have configured all available printers, you may select one of them as the default printer. To make a specific printer the default printer on the Printer Setup dialog, add an entry (in the following format) to the [windows] section of the .XprinterDefaults file:

[windows] 
device=PPD_file,driver,port 

Simply provide the same information that you used in the [devices] section. Only the format of the entry is different; there is a comma between the PPD_file and the driver instead of a space.

For example, suppose you wish the default printer to be the printer at port ORION. The [windows] section would appear as follows:

[windows] 
device=HP3SI523,PostScript,ORION 
[ports] 
ORION=rsh bandit "lp -d ps" 
SIRIUS=rsh bandit "lp -d ps -T pcl5" 
LOCAL=lp -d ps 
[devices] 
HP LaserJet PS=HP3SI523 PostScript,ORION 
HP LaserJet PCL=HP4M PCL,SIRIUS 
QMS PS=Q2200523 PostScript,LOCAL 

In your default .XprinterDefaults file, the [windows] entry appears:

[windows] 
device=NULL,PostScript,FILE: 

Since no PPD file is listed (NULL), the default on the Printer Setup dialog is to print generic PostScript to a file. You may specify the filename and change the type of output to PCL on the Printer Setup dialog.

Specifying Printer-Specific Options

You may include a section that lists the default printer-specific options for each printer defined in the devices section. The options available vary between differing printers, but typical options include number of copies, page size, paper tray, and orientation. An example follows of a printer-specific section for a default printer in the example .XprinterDefaults file:

[HP3SI523,PostScript] 
Scale=0.80 
Copies=1 
PaperTray=Lower 
PageSize=Letter 
Orientation=Portrait 
DPI=300