David Vallner
10/10/2006 10:34:00 PM
Norman Belssner wrote:
> I have been printing to a HP printer in windows2000 using
> $stdout = File.open("LPT1", "W")
> print "Line 1 \n"
>
> I can even control the HP deskjet using Ascii control codes.
By Win2K, that's probably a gruesome hack for backwards compatibility
with DOS programs that translates that to the proper driver calls. It's
improbable that you're actually talking to the printer directly.
> I just got a new printer that interfaces using a USB port and is USB001 on the system. Replacing LPT1 with USB001 does not work. Any ideas?
For the quick hacks, write stuff to a temp file and do system("print
path\to\file"). For the less hacky version, use the bindings to the
Win32API, or use a GUI toolkit - those tend to feature print support.
David Vallner