>  
> 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. 
>   
There are some fundamental assumptions you make that break - the first 
is that the printer can accept straight text, and that printers 
necessarily hook up to LPT1. Both assumptions are woefully out of date 
today. Maybe you can hook up a passthrough of LPT to USB; don't know. 
Hooking LPT1 up to a network printer is easier (net use lpt1 
\\server\printer). But still...

Being able to send plain text wouldn't be true for a pure postscript 
printer, though I seem to recall hearing about ones that magically 
deduced that it was plain text. Also, hooking up to ports is very 
different today, to the point that apps shouldn't really try to fiddle 
with that. Basically, printing is a very abstracted business and by 
talking to the 'right' interfaces your printing will magically work on 
almost any conceivable printer hooked up in almost any conceivable way 
(including using technologies not yet invented).

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...

HTH,

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

Reply via email to