Re: Help with USB Printer
Hi, Some years ago, I encountered similar problem. My printer dont accept plain text. And it uses its own proprietary protocol (Canon LBP800). I can no longer use the simple print to LPT syntax.. The only solution was to create GIF/JPEG files from the text I wanted to print. Then use MSPaint to print it to printer as graphics. It is indeed slower but it turned out to be more flexible. Not only as I able to print text, I can also combine graphics etc.. Its been years and I now dump my printables into a PDF file, and use PDF reader to print to printer. I find that PDF is faster than creating gif files. Secondly, I can collate all what I need to print into a single PDF file.. This process requires more step than the previous one - but each has its unique advantage/disadvantages.. You may want to solve it this way. Dan On Dec 9, 2007 10:13 AM, Valerie <[EMAIL PROTECTED]> wrote: > Hello all! > > 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. > > Can anyone help me get this program running? If it would be easier, > I could alternatively print to a standalone network > printer/copier/scanner. This might arguably be better as then the > solution could be used from any of our computers. > > Here is an excerpt of the essential part of the program. Note, the > variables, "$v1c", "$vck01" etc. are global variables and are all > valid. As I said, the program works great on my computer. > > sub vkprint { > format vkfmttop = > DAILY CASH RECONCILIATION > Denomination Qty Value Checks Credit Cards Paid > Outs > > - > . > > format vkfmt = > @>>>@[EMAIL PROTECTED]@[EMAIL PROTECTED]@.# > # > $text1, $text2, $text3,$text4, $text5, $text6 > . > > open LPT, '>LPT1' or die "Can't open printer: $!"; > > select LPT; > $~ = 'vkfmt'; > $^ = 'vkfmttop'; > > $text1 = "1c"; > $text2 = $v1c; > $text3 = $v1c * .01; > $text4 = $vck01; > $text5 = $vcc01; > $text6 = $poe01; > write; > > [Additional write / print commands and calculations deleted for > clarity] > > print LPT "\f"; > close LPT; > } > > > Thank you for your assistance. > > Valerie > > > > ___ > Perl-Win32-Users mailing list > Perl-Win32-Users@listserv.ActiveState.com > To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs > ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Re: Help with USB Printer
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. > > > > 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
Re: Help with USB Printer
> > 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