in reply to Re^3: $canvas->postscript method - unexpected result
in thread $canvas->postscript method - unexpected result

thanks for your help.
I think I gonna try to modify the ps code itself to see how it could be fixed.
Now if I don't need to scale my output, do you know how to split my ps file into multiple pages?
  • Comment on Re^4: $canvas->postscript method - unexpected result

Replies are listed 'Best First'.
Re^5: $canvas->postscript method - unexpected result
by zentara (Cardinal) on Jun 25, 2008 at 17:54 UTC
    Never did it, but this is what I would try. After a bbox('all'), break your your page's @capture settings, and take multiple captures. It might take some ingenuity. :-) You might want to look into some other utilities that paginate large postscript?
    $main->Button( -text => "Save", -command => [sub { $canvas->update; my @capture=(); my ($x0,$y0,$x1,$y1)=$canvas->bbox('all'); @capture=('-x'=>$x0,'-y'=>$y0,-height=>$y1-$y0,-width=>$x1-$x +0); $canvas -> postscript(-colormode=>'color', -file=>$0.'.ps', -rotate=>0, -width=>800, -height=>500, @capture); } ] )->pack;

    I'm not really a human, but I play one on earth CandyGram for Mongo
      :)
      Logically, it supposes to work but no, I think postscript method is not smart enough to split the file just by specify smaller size for width and height.
      I gonna look for utilities that you said.
      Thanks.
        This 2 page split works for me on linux. It needs a slight anchor or border adjustment, but it splits the pages.
        #!/usr/bin/perl use warnings; use strict; use Tk; my $mw=MainWindow->new(-title=>"Print out the canvas"); my $c=$mw->Scrolled("Canvas")->pack(-expand=>1,-fill=>'both'); my $canvas=$c->Subwidget("canvas"); $canvas->createLine(100,100,20,20,-arrow=>'both',-arrowshape=>[10,10,1 +0]); $canvas->createOval(100,80,65,75,-fill=>"blue"); $canvas->createRectangle(30,50,60,80, -fill=>"red",-width=>5); $canvas->createText(150,1100,-text=>"check postscript",-justify=>"left +"); $canvas->createOval(150,1150,300,1300,-fill=>"blue"); $canvas->createRectangle(150,1300,400,1350, -fill=>"red",-width=>5); $canvas->configure(-scrollregion=>[$canvas->bbox("all")]); $canvas->update(); my $button=$canvas->Button(-text=>"Print",-command=>\&buttonDo) ->pack(-side=>"bottom"); MainLoop; sub buttonDo{ $canvas->update; my @capture=(); my ($x0,$y0,$x1,$y1)=$canvas->bbox('all'); my $width = $x1-$x0; my $height = ($y1-$y0)/2; print "$width $height\n"; #first page @capture=('-x'=>$x0,'-y'=>$y0,-height=>$height,-width=>$width +); $canvas -> postscript(-colormode=>'color', -file=>"$0a.ps", -rotate=>0, @capture); # second page @capture=('-x'=>$x0,'-y'=>$height ,-height=>$height,-width=>$ +width); print $y0 + ($y1-$y0/2),"\n"; $canvas -> postscript(-colormode=>'color', -file=>"$0b.ps", -rotate=>0, @capture); print "saved\n"; }

        I'm not really a human, but I play one on earth CandyGram for Mongo