On 10 Dec 2007 at 10:50, Kenneth Ölwing wrote:
> > I have written a PERL/Tk program to take input from a user and to
> > print a report back based on the data. It works fine on my Windows
> > XP system with an HP Laserjet 6MP connected to a standard parallel
> > port (LPT1).  When I copy the program to a different computer
> > running the same OS but with a different model HP laser printer
> > (model 1012) connected to the USB port, the program hangs when I try
> > to print. 
>
> <snipped>
> 
> I think you should check out something like Win32::Printer (no idea if
> it's good, never used it). Or perhaps there are some printing
> abstractions in Tk that will help? Another approach would be to take
> the help of some other app - i.e. talk to Word through COM (i.e.
> Win32::OLE), feeding it the text and triggering the printing from
> there. If Word doesn't exist, maybe something else does - your needs
> seems simple...perhaps Notepad can be utilized by just reading a file
> you prepare and then trigger the print. Or, prepare your output as pdf
> and utilize Adobe reader. Etc. There are a number of ways, though
> admittedly all will require some fanciness...as noted though, the
> payoff may be great as you've then insulated yourself from the
> physical printer issues...

According the the registry the command to print a .txt file is

        %SystemRoot%\system32\NOTEPAD.EXE /p %1

so you might try that. Save the text into a file and ask notepad to 
print it. Or use Win32::FileOp::ShellExecute like this:

        ShellExecute 'Print' => $the_file;

this will work just as well if you later decide to generate the 
report in HTML or any other format assuming you store it with the 
correct file extension.

HTH, Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery

_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to