[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Dot matrix and Ruby !

Luiz Macchi

2/24/2007 10:34:00 AM

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 !

thanks any help !

--
Posted via http://www.ruby-....

1 Answer

Robert Klemme

2/24/2007 11:57:00 AM

0

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")
# ...
printer.flush
end

Maybe you have to add some more mode flags to ensure exclusive access to
the printer.

The standard way however would be to use your operating system's print
subsystem - if it has a driver for your kind of printer.

Kind regards

robert