|AHELP for CIAO 4.5 ChIPS v1||
Prints the window to a file or the printer.
print_window([ChipsId,] [filename [,attributes]])
- ChipsId - an optional ChipsId structure containing values to modify the currency state for the command.
- filename - output file. The file format may be included as a suffix, e.g. "plot.pdf" or "plot.png".
The print_window command prints the contents of the window to either a file or the printer. If "filename" is specified, the image is written to a file. If it is not specified, the output is sent to the user's default printer.
ChIPS can create output in a variety of formats: postscript, encapsulated postscript, PDF, PNG, and JPEG. There are three ways to specify the output format:
- Including the format as a suffix on the filename: for example "plot.ps", "plot.eps", "plot.pdf", "plot.png", "plot.jpg", or "plot.jpeg".
- Setting the "format" attribute when you call print_window().
- Setting the "export.format" preference before you call print_window().
The list above is given in the order that the format is checked for, so
chips> print_window("plot.ps", ["format", "eps"])
will create a postscript format file called "plot.ps", and not an encapsulated format file.
If a filename is given with a suffix that is not recognized, then the output format will be taken from either the format attribute or the export.format preference setting.
If the preference "export.printdialog" is set to true, ChIPS will open a printing dialog box when print_window is called. The dialog allows you to decide whether to send the figure to the printer or to a file, and allows you to set all the printing options available in the print_window command (e.g. output format, color scheme, page margins). Unless a filename (with optional path) is specified in the print_window call, the working directory is used as the default location.
chips> print_window("plot.png", ["printdialog", True])
will create a GUI for selecting the export options, with the filename set to plot.png in the current working directory and the format set to PNG (both can be changed from GUI).
chips> print_window(["printdialog", True])
will use a default file name of "untitled1" (or higher if "untitled1" already exists), which can be changed from the GUI.
The margins can be specified individually, along with the page orientation (portrait or landscape), the color scheme (e.g. rbg, cmyk), and the file format (e.g. postscript, jpg). A number of standard page sizes are available (e.g. letter, legal).
The size and aspect ratio of the output matches the dimensions of the window. This can be overridden using the pagewidth and pageheight attributes or the pagesize attributes, but only for the postscript and PDF file formats.
The scalewidth and scaleheight attributes scale the image with regard to the print area - either the window dimensions or the pagewidth/pageheight specification. If the image is scaled such that it's larger than the page and "keepaspect" is set to false, the image is clipped. If "keepaspect" is "true", the scaled image maintains the original aspect ratio and is scaled up until one dimension touches the margins.
The units for the margins, width, and height are determined by the "window.units" preference, unless overridden by the pageunits attribute.
Please see the section "Export Preferences" below the examples for a list of the export preferences.
The contents of the current window are sent to the default printer.
chips> print_window(["printdialog", True])
Print the contens of the current window using the print GUI to change the settings such as format type and output file name.
A postscript version of the current window is created in the file plot.ps.
chips> print_window("plot", ["pagesize","letter","fittopage",True]) chips> print_window("plot.png")
A postscript version of the current window is created in the file plot.ps; it has been re-sized to fill a US letter page. The second call to print_window creates a PNG format of the window in the file plot.png; the size of this file is determined by the size of the window being printed, since the pagesize, pagewidth, and fittopage options are only valid for the postscript and PDF outputs.
chips> add_window("id=FirstWindow") ... chips> add_window("id=Window2") ... chips> id = ChipsId() chips> id.window = "FirstWindow" chips> print_window(id)
Two windows are created; the second window is current after it is created. The id.window command sets the window value of the ChipsId structure to the first window, which is then sent directly to the user's default printer.
chips> add_window("id=MyWindow1") ... chips> add_window() ... chips> print_window("plot1.eps")
Two windows are created; the second window is current after it is created. That window is then printed to an EPS file named "plot1.eps".
The attributes associated with export are given in the following table. All values can be changed using the print_window() command. To change the export preference settings prepend "export." to the attribute name.
|bottommargin||size of the bottom margin||numerical value, with the units taken from the window.units or pageunits setting.||0.2|
|clobber||Overwrite an existing file?||see the Booleans section of "ahelp chipsopt"||false|
|colorscheme||indicates the color specification scheme||rgb|cmyk|cmyksep|greyscale|grayscale||rgb|
|dpi||What resolution should be used when displaying images, in dots per inch.||Non-negative integer||150|
|fittopage||Fits the image to the page size; aspect ratio is controlled by the "keepaspect" attribute||see the Booleans section of "ahelp chipsopt"||false|
|fonts||should the font be written to the printer, if the image is going to the printer||see the Booleans section of "ahelp chipsopt"||true|
|format (only used if not included as part of the file name)||export file format||ps|eps|pdf|png|jpg|jpeg||ps|
|keepaspect||Maintain aspect ratio of the image while fitting to the page?||see the Booleans section of "ahelp chipsopt"||true|
|leftmargin||size of the left margin||numerical value, with the units taken from the window.units or pageunits setting.||0.2|
|orientation||page layout orientation||landscape|portrait||portrait|
|pageheight||height of the saved file image (PS and PDF formats only). This value overrides the window dimensions, and the units are taken from the window.units setting unless overridden by export.pageunits||numerical value||0.0|
|pagesize||print size (PS and PDF formats only)||letter|legal|executive|A3|A4|A5||letter|
|pageunits||Units of measure of the pagesize (PS and PDF formats only)||inches|cm|mm|pixels||inches|
|pagewidth||width of the saved file image (PS and PDF formats only). This value overrides the window dimensions, and the units taken from the window.units setting unless overridden by export.pageunits||numerical value||0.0|
|printdialog||if true, ChIPS will open a GUI for selecting the export option when print_window is called||see the Booleans section of "ahelp chipsopt"||false|
|rightmargin||size of the right margin||numerical value, with the units taken from the window.units or pageunits setting.||0.2|
|scaleheight||Factor for scaling the height value||Floating point percentage value||0.0|
|scalewidth||Factor for scaling the width value||Floating point percentage value||0.0|
|topmargin||size of the top margin||numerical value, with the units taken from the window.units or pageunits setting.||0.2|
See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.