Hi all. I'm having a bit of a problem in creating a ps. Each time I try to create a postscript the tops or sides of my canvas get trimmed while using the code below:
my @dim = $canvas->bbox("all"); my $width = ($dim[2]-$dim[0]); my $height = ($dim[3]-$dim[1]); my $ps = $canvas-> postscript( '-pagewidth' => "8 i", '-pageanchor' => "center", '-width' => $width, '-height' =>$height );
I'm guessing I either have to define a -pagex, -pagey and then anchor on "center" or set the -x and -y. The problem is how do I determine what these values are? I've used $canvas->bbox("all") to capture the dimensions of my canvas. This allowed me to set my width and height but I could not set -x,-y or the -pagex,-pagey as the dimension values are are off by some factor. below is a snip of what I have tried but it jsut makes things worse:
my @dim = $canvas->bbox("all"); my $width = ($dim[2]-$dim[0]); my $height = ($dim[3]-$dim[1]); my $pagex = ($dim[0]+$dim[2])/2; my $pagey = ($dim[1]+$dim[3])/2; my $ps = $canvas-> postscript( '-pagewidth' => "8 i", '-pageanchor' => "center", '-pagex' => $pagex, '-pagey' => $pagey, # '-x' => $dim[0], # '-y' => $dim[1], '-width' => $width, '-height' =>$height );
Does anyone know how tho convert the dim values so that I can use them in the -x,-y or -pagex,-pagey? Thanks in advance.

In reply to Dumping Tk canvas to postscript by TooNewbie

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.