Hi,

  I am trying to print a canvas using the postscript method, but it's a really 
big canvas
(not too wide, just high / long), and always comes out scaled to a single page. 
Any easy 
way to get the postscript method to make it a multi-page document, or should I 
just start 
hacking the resulting eps? I've tried playing with all the options to the 
postscript method, 
but haven't gotten anything to help.

  Example code:

#!/usr/local/PERL_5.005_03/bin/perl -w
# written/testing on MSwin
######################################
use Tk;
use strict;

my $temp = "C:\\temp";
my $file="$temp\\psfile.ps";
chomp(my @files = `dir/b $temp\\psfile.* 2>&1`);

for (@files) {
    next if /file not found/i;
    if (-e "$temp\\$_") {
        unlink "$temp\\$_";
    }
}

my $cw=595;            # 595.44 printer points A4
my $ch=841;            # 841.68 printer points A4

my $mw= tkinit;
my $c = $mw->Scrolled('Canvas',
                      -scrollregion => [0,0,'596 p','842 p'],
                      )->pack(-expand => 1, 
                              -fill => 'both',
                              );
    
# create "page size" box and text in each corner
$c->createRectangle(0,0,$cw.'p',$ch.'p',-outline=>'blue');
$c->createText(0,0,            -text => 'nw', -anchor => 'nw');
$c->createText($cw.'p',0,      -text => 'ne', -anchor => 'ne');
$c->createText($cw.'p',$ch.'p',-text => 'se', -anchor => 'se');
$c->createText(      0,$ch.'p',-text => 'sw', -anchor => 'sw');

# create numbers down the middle (3 "pages" worth)
for (my $i = 0; $i <= (3*$ch); $i += 72) {
    $c->createText(($cw/2).'p',$i.'p',-text => $i);
}
    
my $b = $mw->Button(-text=>'output',-command=>\&ps)->pack;

MainLoop;

sub ps {
$c->postscript(
               -colormode=> 'color',
               -file=> $file,
               -width=> $cw.'p',
               -height=> (3*$ch).'p',          # height of canvas to print
               -x=> 0,
               -y=> 0,
               -pagex=> 0,
               -pagey=> 0,
               -pageanchor=> 'nw',
               -pagewidth=> $cw.'p',
               -pageheight=> (3*$ch).'p',      # all 3 pages on single page
#               -pageheight=> $ch.'p',         # all 3 pages on single page
               );
}


Thanks,
Cort




      

Reply via email to