start page | rating of books | rating of authors | reviews | copyrights

Book HomeMastering Perl/TkSearch this book

9.18. Rendering the Canvas as PostScript

To get a copy of the Canvas as PostScript, use the postscript method. It will either return the PostScript output or, if the -file option is specified, put it in a file:

$postscript = $canvas->postscript( );
$canvas->postscript(-file => "ps.out");

The following options allow you to control the output of the PostScript:

-colormap => \@array
Specifies that each element in @array must be a valid PostScript command for setting color values (e.g., "1.0 1.0 0.0 setrgbcolor").

-colormode => "color" | "gray" | "mono"
Creates the PostScript in full color, grayscale ("gray"), or black and white ("mono").

-file => filename
Specifies the file in which to put the PostScript output.

-fontmap => \@array
Each element in @array is a two-element array that contains a font name and a point size. The font name should be a complete font name so Tk will parse it correctly (e.g., "-*-Helvetica-Bold-O-Normal--*-140-*").

-height => size
Sets the height of the area to print. The default height is the Canvas height.

-pageanchor => "n" | "e" | "s" | "w" | "center"
Indicates where the page should be placed over the positioning point specified by the -pagex and -pagey options.

-pageheight => height
Sets the height of the printed page. The Canvas image will be scaled to fit. height is any valid screen distance.

-pagewidth => width
Sets the width of the printed page. The Canvas image will be scaled to fit.

-pagex => x
Sets the coordinate for the x positioning point. Can be any valid screen distance.

-pagey => y
Sets the coordinate for the y positioning point. Can be any valid screen distance.

-rotate => 0 | 1
If 1, the page is rotated into a landscape orientation. Default is 0, which is portrait orientation.

-width => size
Sets the width of the Canvas area to be printed. Defaults to the width of the Canvas.

-x => x
Sets the left edge of the area to be printed (in Canvas coordinates). Default is the left edge of the window.

-y => y
Sets the top edge of the area to be printed (in Canvas coordinates). Default is the left edge of the window.



Library Navigation Links

Copyright © 2002 O'Reilly & Associates. All rights reserved.