Dot matrix and Ruby !

G

Gugão

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 !
 
R

Robert Klemme

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,214
Messages
2,571,110
Members
47,702
Latest member
gancflex

Latest Threads

Top