On 24.02.2007 11:34, Gugão wrote:
Hi all, I´d like to do a class to print into a lx-300 printer ! i would
send parameters like, coordenates X,Y, condensed, draft, roman etc. I
have the printer´s manual, Is there a command in pure Ruby to send or
redirect to printer ?
Im searching without success !
If the printer is directly attached you can usually send commands and
control sequences directly to the printer port (on Windows typically
“LPT1:”, on Linux I believe it’s /dev/lpt). Just make sure you open
that device in binary mode.
File.open("/dev/lpt", “wb”) do |printer|
printer.write(“text and control sequences”)
Maybe you have to add some more mode flags to ensure exclusive access to
The standard way however would be to use your operating system’s print
subsystem - if it has a driver for your kind of printer.