Phil, if you still need a solution to this problem, and to the extent that 
you're mainly stuck on getting output from Perl to appear on the printer, this 
is another possible solution:

DOSPrint, a tiny, free (as in beer) utility that assigns an LPT port to any 
Windows printer (USB, networked, etc.).
Described here: http://pcounter.com/index.php?q=free-software/dosprint
Download here: http://pcounter.com/index.php?q=downloads/free-software

Printing to an LPT port is easy in Perl without any special modules:
  open (PRINTER, ">", "lpt1:");
  print PRINTER "Hello\n";
  close PRINTER;

This doesn't help with any other aspect of your project (intercepting or 
manipulating output from Innovative), but it sounded to me like this addresses 
the part that has you stuck.

Good luck,
Tom
Western Washington University Library


-----Original Message-----
From: KREYCHE, MICHAEL [mailto:mkrey...@kent.edu] 
Sent: Thursday, March 24, 2011 7:29 AM
To: perl4lib@perl.org
Subject: RE: Printing to a Windows receipt printer from a perl script

Phil,

Have you tried something like this:

http://code.activestate.com/lists/perl-win32-users/30503/

I haven't done this myself, just interested in what you're trying!

Mike

-----Original Message-----
From: Phil Shirley [mailto:pshir...@cuyahogafallslibrary.org] 
Sent: Thursday, March 24, 2011 10:13 AM
To: perl4lib@perl.org
Subject: Printing to a Windows receipt printer from a perl script

I've written some perl scripts in the past but I've never printed to a 
printer, and I'm having trouble getting this to work. I'd be grateful 
for any help you could give me.

What I want to do is print to a receipt printer on the parallel port (or 
in some cases a USB port) of a PC running Windows XP or Windows 2000. 
Ideally, I'd like to print a scaler or an array to the printer, rather 
than printing the contents of a file. Actually, the goal is to print the 
price of items on the checkout receipt at the circ desk. Our III system 
doesn't provide for this, but I was going to try to intercept the print 
job using Alphatronics Port Monitor, send the receipt data to a script 
that looked up each barcode and returned its price, and then printed out 
the receipt plus the value of what you checked out. Maybe it's not a 
practical project; at this point I'm trying to get a feel for whether 
this is something I could do.

What I've done: I've installed ActivePerl and nmake on my pc (later I 
tried Strawberry Perl). I also tried several things for printing:

1. Tried this code:
open(PRN, "|lp");
print PRN "hello";

result: error message:
'lp' is not recognized as an internal or external command, operable 
program or batch file.

2. Tried this code:
open( LPT, "> lpt1" ) or die "error opening printer port $!\n";
print LPT "hello";
close(LPT);

result: no error message, but no printing.

3. Tried installing and use the module "Printer" from cpan but it seems 
to need Win32::Printer.

4. Tried installing Win32::Printer but it fails the "make".

Is there something else I can do? Maybe a different scripting language 
would make it easier to print in Windows.

Phil
-- 
Phil Shirley
Technology Services Coordinator
Cuyahoga Falls Library
Cuyahoga Falls, Ohio
330-928-2117, ext. 109
pshirley at CuyahogaFallsLibrary dot org

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

Reply via email to