| Search Locate Previous Next | Contents |
The PostScrp namespace is designed to convert your RainPro chart to a wide variety of graphics formats. You can view the chart on screen, print it to your Windows printer, direct it to any PostScript device, clipboard it and so on. All the examples shown below assume you have saved the intermediate format of your chart in a character variable PG. The available functions are:
View the Chart
To see the chart on screen, zoom in on any selected region, read off data values from the mouse cursor etc. ...
PostScrp.View PG
The right-mouse menu in the viewer supports many of the facilities listed below. Any settings you change are saved in the Windows Registry, by default under the key Software\Causeway\RainPro\Viewer within HKEY_CURRENT_USER. You can use PostScrp.SetRegPath to set your own registry path, so that the settings will be specific to your own application. If you set this path to null, no settings will be saved to or loaded from the registry.
All the text captions in the viewer may be loaded from a phrasebook file with PostScrp.GetPhraseBook phbfile. The workspace is shipped with a UK-English phrasebook (uk-en.phb) and phrasebooks for other languages will be shipped as they become available. You might choose to load your local phrasebook once and ship your product with a permanent phrase table, or you might have the application load it on startup depending on your users choice of language for the application.
Print the Chart
To have the chart printed on your standard Windows printer ...
PostScrp.Print PG
This will orient the paper automatically to match the orientation of the chart. You can preset the target printer with:
PostScrp.OpenPrinter 'Tektronix 840,\\SERVER\Tek840'
which will route all prints to this destination until you call PostScrp.ClosePrinter.
A null argument to OpenPrinter will open the Windows default printer.
Copy the Chart to the Clipboard
In general, the best format is Windows Metafile which allows the chart to be pasted into standard applications such as Word, remaining fully scalable. To copy the chart to the clipboard in Windows metafile format ...
PostScrp.Clip PG
You can pass a left argument of a file name here, which will save the image to a file with extension .WMF you may then use the Insert,Picture ... menu in Word to import your graphic.
'c:\data\doc\chart1' PostScrp.Clip PG
Two global variables may be used to control the metafile generation:
PostScrp.metascale0.75 © Scales the metafile size PostScrp.showpaper1 © Add a double-line border
These are reset to default by PostScrp.Init.
To copy the chart in bitmap format:
1 PostScrp.ClipBits PG
The left argument gives the required scale factor the function will prompt if you omit it. Large bitmaps require a lot of workspace, and can take a long time to create.
Output to PostScript Devices
Rain charts can be written directly to any PostScript printer, or saved on file in PostScript format.
'\\server\tek840' PostScrp.Write PG © Direct to printer 'C:\temp\RAIN.PS' PostScrp.Write PG © Write to PS file
If you omit the file name, the default is prn which will output the chart to your default printer. If you have a colour printer (such as the Tektronix-840) set PostScrp.rgb1 which allows full-colour output. Otherwise the results will be better if the chart is forced to use a black&white colour map with PostScrp.rgb0.
file PostScrp.WritePDF PG © for Distiller
The files saved in this format are ideal for use with Acrobat Distiller to generate PDF graphics; there is a sample function ToPDF in the RainPro workspace which you can change to route the PostScript data directly to Distillers inbound directory.
To save the chart in Encapsulated PostScript (EPS) format:
'C:\data\doc\rain' PostScrp.WriteEPS PG © Write out as .EPS file
You can import these files into Word, where you will be able to resize them as normal, but note that you will only see a placeholder (with the chart title and date) in the document. The chart will print correctly on any PostScript printer.
Saving Charts in Internet Format
The two graphics formats available are (uncompressed) GIF and PNG use PNG if your browser supports it.
imgPostScrp.MakePNG PG
This returns a 3-element vector with the integer representation of the PNG file in the first element, the image map in the second, and the chart id in the third. If you are not using the capability to make hypertext jumps based on your data, you can simply save the first element directly to file:
'c:\temp\test.png' PostScrp.rput 1img
You can pass a scale factor as the optional left argument to MakePNG and MakeGIF if required. See the notes in the Introduction for suggestions on saving in the VML format for IE5. You can also use PostScrp.MakeApplet to generate applet tags and pass the chart as parameters to the Java viewer which is freely available from the Causeway web site.
Rendering to any Dyalog Object
You can draw your charts on nearly all the standard Dyalog objects, e.g. buttons, subforms etc. See Using the Raw Dyalog Gui for an example.
PostScrp.PS PG '#.ff.sub' 1 cmap
The arguments give the vector of graphics data, the (fully qualified) name of the Gui object, the pixels per point conversion required (1 if the bounding box of the chart matches the size of the Gui object in pixels) and the colour map to be used.
Extracting header comments
You can use PostScrp.ReadHeader to read any of the header comments (such as the page bounding box) which you may find useful in your own event handlers.
See also ...
Loading Translated Phrasebooks