Re: postscript [message #2821 is a reply to message #2767] |
Mon, 03 October 1994 07:49  |
Geoff.Sobering
Messages: 14 Registered: June 1994
|
Junior Member |
|
|
Some time ago, I wrote the following short procedures to simplify the
process of directing IDL graphics to a PostScript printer. There are two
routines, 'pso' and 'psc'. 'pso' sets the plot device to "PS", and 'psc'
spools the file to the printer and returns the plot device to whatever it
was.
Most commonly, I construct a graphics command (or commands) with the output
appearing on the screen, then type 'pso', re-execute the graphics
command(s) from the command buffer, and enter 'pso' to spool the graphic to
the printer.
Because of the 'spawn'ed 'lpr' command and the UNIX filename syntax, these
are pretty specific to UNIX, however, they should be pretty easy to adapt
to other OSes.
--
Geoff Sobering (Geoff.Sobering@nih.gov)
In Vivo NMR Research Center
National Institutes of Health
--- pso.pro ----------------------
PRO pso
; 1/17/92 @(#)pso.pro 2.2 In Vivo NMR Research Center, NIH
COMMON ps_switch, old_plot_dev, ps_set
IF keyword_set( ps_set ) THEN BEGIN
message, /inform, 'PostScript output already set.'
ENDIF ELSE BEGIN
; Change the plot-device and flag to 'PS':
old_plot_dev = !D.NAME
set_plot, 'PS'
ps_set = 1
; Put the 'idl.ps' file in the users home directory:
device, file=getenv( 'HOME' )+'/idl.ps'
ENDELSE
RETURN
END
-- psc.pro ----------------------
PRO psc
; 1/17/92 @(#)psc.pro 2.2 In Vivo NMR Research Center, NIH
COMMON ps_switch, old_plot_dev, ps_set
IF NOT keyword_set( ps_set ) THEN BEGIN
message, /inform, 'PostScript output not set.'
ENDIF ELSE BEGIN
; Close the plot-file:
device, /close
; Sent the plot-file to the printer:
spawn, 'lpr $HOME/idl.ps'
; Reset the plot-device and flag:
set_plot, old_plot_dev
ps_set = 0
ENDELSE
RETURN
END
|
|
|