cta has asked for the wisdom of the Perl Monks concerning the following question:
I suppose to get all the items of my canvas and then dump them out with the postscript method because I already used $canvas->bbox().#!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 @coord=$canvas->bbox('all'); my $maxwidth=$coord[2]; my $maxheight=$coord[3]; $canvas->postscript( '-x'=>'0','-y'=>'0', -colormode=>'color', -file=> "file.ps", -rotate=>0, -width=>$maxwidth, -height=>$maxheight, -pageheight=>'10.5 i', -pagewidth=>'8 i'); system("lpr -S serverN-P printerN file.ps") == 0 or die $!; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: $canvas->postscript method - unexpected result
by zentara (Cardinal) on Jun 25, 2008 at 12:00 UTC | |
by cta (Acolyte) on Jun 25, 2008 at 14:19 UTC | |
by zentara (Cardinal) on Jun 25, 2008 at 16:17 UTC | |
by cta (Acolyte) on Jun 25, 2008 at 17:34 UTC | |
by zentara (Cardinal) on Jun 25, 2008 at 17:54 UTC | |
| |
|
Re: $canvas->postscript method - unexpected result
by Anonymous Monk on Jun 25, 2008 at 09:06 UTC |