Rendering the Canvas as PostScript

To get a copy of the Canvas as PostScript, use the postscriptmethod. 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 ...

Get Mastering Perl/Tk now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.