sub print { my $dc = new Win32::Printer( papersize => 1, dialog => 0x000004, description => $filename, unit => 'mm' ); my $font = $dc->Font($font, $size); $dc->Font($font); chomp(my $page = $t->get("1.0", "end")); my @page = split(/\n/, $page); my $lncnt = 0; $lncnt++ for (@page); my $total = (($lncnt/83) + 1); if ($total =~ /\./) { my $trash; ($total, $trash) = split(/\./, $total); } my $y = 15; my @flnm = split(/\//, $filename); my $file = pop(@flnm); my $current = 1; $dc->Write("-- $file --", 20, 5); foreach (@page) { $dc->Write($_, 10, $y); $y+=3; if ($y > 264) { $dc->Write("$current of $total pages", 180, 267); $current++; $dc->Page(); $dc->Write("-- $file --", 10, 5); $y = 15; } if ($current == $total) { $dc->Write("$current of $total pages", 180, 267); } } $dc->Close(); $info = "Print job complete!"; }