Search code examples
psidl-programming-language

Set Title in postscript header, produced by IDL


How to produce an postscript output in IDL such that the title window (i.e. the Title field in the header of the postscript file) is set to the filename or to an arbitrary string? By default, it is set to "Graphics produced by IDL":

%%Title: Graphics produced by IDL

Is is possible to change this from within IDL, without using scripts after the .ps is produced?


For reference, one may produce a .ps file in the following way. PRO test_2 device,decomposed=0 set_plot, 'ps' device,filename="~/filename.ps",/isolatin1,xsize=8.,ysize=10.5,inches=1,$ xoffset=0.25,yoffset=0.25,landscape=0 !p.font=0 device, /helvetica, font_size=7 ; a classic sans-serif font ; x = indgen(100) plot, x, sin(x) ; device,/close set_plot,'x' !p.thick=1 & !p.charthick=1 & !p.font=-1 & !x.thick=1 & !y.thick=1 END


Solution

  • This is the nice thing about IDL - there is always a way!

    After opening the PS-file with set_plot, do the following:

    IDL> printf, 100, "%!PS-Adobe-3.0"
    IDL> printf, 100, "%% Created with: IDL> "+(recall_commands())(0)
    IDL> printf, 100, "%", form='(A0,$)'
    

    The 1st line makes a new declaration that this is a PS-file. Check that this is the actual PS-version that your IDL version creates.

    The 2nd line is your comment - this prints the command you used before opening the PS-file.

    The 3rd line out-comments the PS-file declaration that IDL will print next. So there'll be two of those lines, with the second being a comment by way of the resulting "%%".

    You might want to check that the LUN of PS-files is indeed 100. Good luck!