Elijah has asked for the wisdom of the Perl Monks concerning the following question:
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!"; }
This is what I have come up wioth so far and it somewhat works but is too static for my taste. It will only look decent if the user uses portrait and not landscape and the specific style and size font defined. Also as of now text that extends past the edge of the paper is cutoff and does not wrap.
Is there any better built in functionality to this module to allow for easier and more dynamic formatting of the print page layout? I have searched the documentation and have found nothing that will seem to help me with this, although I am sure there is and maybe I am simply overlooking it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::Printer formatting?
by BrowserUk (Patriarch) on Aug 25, 2004 at 22:45 UTC |