For printer and plotter devices (e.g., PCL, PostScript, and HP-GL), IDL creates a file containing output commands. This file can be sent to the printer via the normal methods provided by the local operating system. When attempting to output the file before exiting IDL, the user must be sure that the graphics output file is complete. For example, the following IDL commands (executed under Unix) will not produce the desired result:
These commands fail because the attempt to print the file is premature--the file is still open within IDL and is not yet complete.
The following lines of code are an IDL procedure called OUTPUT_PLOT which closes the current graphics file and sends it to the printer. This routine assumes that the graphics output file is named idl.xxx , where xxx represents the name of the graphics driver. For example, PostScript output file is assumed to be idl.ps . It also assumes that the graphics output to be printed is from the current graphics device, as selected with SET_PLOT.
Pro OUTPUT_PLOT, New_file ; Close the current graphics file, and print it. If the New_file parameter is present, rename the file to the given name so it won't be overwritten.
DEVICE,/CLOSE ; Close current graphics file.
file = 'idl.' + STRLOWCASE(!D.NAME) ; Build the default output file name by using the idl name for the current device (!D.NAME).
cmd = 'lpr ' + file ; Build shell commands to send file to the printer. You will probably have to change this command in accordance with local usage.
IF N_ELEMENTS(New_file) GT 0 THEN $
cmd = cmd + '; mv' + file + ' ' + New_file
;
Concatenate rename command if new file specified.
SPAWN, cmd ; Issue shell commands to print/rename file.
The call to DEVICE causes IDL to finish the file and close it, which makes it available for printing.
In order for IDL generated output files to work properly with printers and plotters, it is necessary for the device to be configured properly. This usually involves configuring both the device hardware and the operating system printing software. When setting up your system, keep the following points in mind:
Many printers have a large buffer into which they store incoming data they haven't yet processed. This reduces the need to invoke flow control. When testing your configuration to ensure flow control is actually enabled, you must be sure to print a document long enough to fill any such buffer, or flow control may never occur, giving a false impression that the setup is correct. A common source of problems stem from attempting to print long IDL generated output files without proper flow control.
If you are having problems printing on a PostScript printer, the ehandler.ps file provided in the ps subdirectory of the fonts subdirectory of the resource subdirectory of the IDL distribution can help you to debug your problem. Sending this file to your PostScript Printer causes it to print any subsequent errors it encounters on a sheet of paper and eject it. The effect of this file lasts until the printer is reset.
Printers are configured in the /etc/printcap file. This file describes to the system which printers are connected to it, the characteristics of each printer, and how the printer port should be configured. Managing the printcap file is usually discussed in the system management documentation supplied with the system by the manufacturer.
Printer queue configuration under VMS is a large topic. However, it is often sufficient to set the printer port up properly using the DCL_SET_TERMINAL command, and set up a printer queue using the standard printer form. Users can send eight-bit data to such a printer using the DCL PRINT/PASSALL command (On very small systems, it is even possible to dispense with the printer queue entirely and simply use the COPY command to send data to the printer port directly).
However, much more sophisticated arrangements are possible including the definition of specialized printer forms, placing printers on the local area network for use by more than one machine, and so forth. For information on these topics, refer to the relevant VMS documentation.
The difference between the XOFFSET and YOFFSET keywords to the DEVICE procedure, and the higher level plot positioning keywords and system variables (discussed in Graphics Keywords and Plotting ) can lead to confusion. A common misunderstanding is to attempt to use the DEVICE procedure "offset" and "size" keywords multiple times in an attempt to produce multiple plots on a single output page.
The DEVICE keywords are intended to specify the size and position of the entire output area on the page, not to move the plotting region for multiple plots. The driver does not monitor their values continuously, but only when initializing a new page or ejecting the current one.
The proper way to produce multiple plots is to use the high level positioning abilities. The !P.MULTI, !P.POSITION, and !P.REGION system variables can be used to position individual plots on the page. The plotting routines also accept the POSITION, MARGIN and REGION keywords.