From the perl/Tk FAQ:
11.7. How do I get a Canvas to output PostScript(c)? Many thanks to Tom Oelke <tpo9617@rit.edu> for providing this questio +n, answer & snippet of code: The following section of code gets the postscript code for the secti +on of canvas that's top-left corner is at $min_x, $min_y, and has a width +and height equivalent to the displayed region. This ps code is then pipe +d out to lpr to be printed. my $ps = $canvas->postscript( '-x' => $min_x, '-y' => $min_y, -width => $canv->Width, -height => $canv->Height); open (PS, "| lpr"); # customize with -Pname e.g. print PS $ps; close (PS); Whereas you would use something like: open (PS, ">file.ps"); # to output to a file print PS $ps; close (PS);
Update: A better explanation: the first bit of code sends the canvas data in postscript form to a (unix) printer lpr. The second bit of code creates a postscript file that you can send to the printer directly via
% lpr file.ps
or you can open it with ghostscript to print it on a non-postscript printer.

-Mark


In reply to Re: Printing a TK Canvas by kvale
in thread Printing a TK Canvas by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.