canvas postscript
Gives the items as Encapsulated PostScript.
PATHNAME postscript ?OPTION VALUE ...?
Description
Gives a page of Encapsulated PostScript, with the comments of the Document Structuring Conventions 3.0, for an area of the canvas. The area starts at -x and -y, in canvas units, and has the size -width by -height, in screen distances; each defaults to the part of the canvas in the window. A canvas that has never been shown has a window of 1 by 1, so give -width and -height or run update first.
On the page, a point of the screen is 1/72 inch, from tk scaling, unless -pagewidth or -pageheight gives the size of the area on the page; with both, -pagewidth sets the scale. -pagex and -pagey give the point on the page, by default the middle of a letter page, and -pageanchor gives the point of the area that falls on it. -rotate with a true value turns the area for a landscape page. A distance on the page is a number of points, or a number with c, i, m, or p.
-colormode is color, gray, or monochrome. -colormap names an array: an element with the name of a color, as an item option gives it, holds the PostScript that sets the color. -fontmap names an array: an element with the name of a font, as -font gives it, holds a PostScript font name and a size in points. The arrays are read in the frame of the caller.
With -file, the page goes to a new file; with -channel, to an open channel. A bad distance on the page gives the message as the result, as in Tk 8.6.16.
Returns
The PostScript, or an empty string with -file or -channel.
Examples
# 100 by 50 pixels at 1 inch wide: 72 by 36 points, from the corner of the page.
% canvas .ps
> regexp {%%BoundingBox: ([^\n]*)} [.ps postscript -width 100 -height 50 -pagewidth 1i -pagex 0 -pagey 0 -pageanchor sw] -> box
> set box
0 0 73 37
% canvas .ps2
> regexp {%%Orientation: (\S+)} [.ps2 postscript -width 10 -height 10 -rotate 1] -> orientation
> set orientation
Landscape
Errors
% canvas .ps3; .ps3 postscript -bogus 1
unknown option "-bogus"
-errorcode NONE
Facts
- Capability
- None.
- Tcl release
- Tcl 9.1 and 8.6.
- Since
- ztk 1.0.0-beta.10