# Printing throught LPT1

**URL:** <https://www.ruby-forum.com/t/printing-throught-lpt1/121710>\
**Category:** Ruby\
**Created:** [November 30, 2007, 5:18am UTC](https://www.ruby-forum.com/t/printing-throught-lpt1/121710 "2007-11-30T05:18:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [November 30, 2007, 5:18am UTC](https://www.ruby-forum.com/t/printing-throught-lpt1/121710/1 "2007-11-30T05:18:25Z")

</div>

Hello, somebody has print to a printer from Ruby???

I thought a library called Etch for printing, but it doesn’t have any  
documentation :s

Regards,

---

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [December 1, 2007, 4:55am UTC](https://www.ruby-forum.com/t/printing-throught-lpt1/121710/2 "2007-12-01T04:55:24Z")

</div>

Edgar G. wrote:

> Hello, somebody has print to a printer from Ruby???
> 
> I thought a library called Etch for printing, but it doesn’t have any  
> documentation :s
> 
> Regards,

Nobody knows???

---

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [December 1, 2007, 6:55am UTC](https://www.ruby-forum.com/t/printing-throught-lpt1/121710/3 "2007-12-01T06:55:35Z")

</div>

On Nov 30, 9:55 pm, Edgar G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Posted viahttp://www.ruby-forum.com/.  
> It depends on your OS for one thing. I’m not aware of a project that  
> provides a uniform cross-platform API to printing for ruby (that  
> doesn’t mean there isn’t one). The closest thing I know of is  
> Gtk::PrintOperation from ruby-gtk [  
> [http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3APrintOperation](http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3APrintOperation)  
> ].

HTH,  
Jordan

---

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [December 1, 2007, 7:47am UTC](https://www.ruby-forum.com/t/printing-throught-lpt1/121710/4 "2007-12-01T07:47:37Z")

</div>

Jordan Callicoat wrote:

> On Nov 30, 9:55 pm, Edgar G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > Posted viahttp://www.ruby-forum.com/.  
> > It depends on your OS for one thing. I’m not aware of a project that  
> > provides a uniform cross-platform API to printing for ruby (that  
> > doesn’t mean there isn’t one). The closest thing I know of is  
> > Gtk::PrintOperation from ruby-gtk [  
> > [http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3APrintOperation](http://ruby-gnome2.sourceforge.jp/hiki.cgi?Gtk%3A%3APrintOperation)  
> > ].
> 
> HTH,  
> Jordan

Well i am in windows, how could i do that?

---

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [December 1, 2007, 8:36am UTC](https://www.ruby-forum.com/t/printing-throught-lpt1/121710/5 "2007-12-01T08:36:39Z")

</div>

On Dec 1, 12:47 am, Edgar G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > HTH,  
> > Jordan
> 
> ## Well i am in windows, how could i do that?
> 
> Posted viahttp://www.ruby-forum.com/.

I’m not sure. I assume you could use the win32ole module that ships  
with ruby 1.8 [1], or perhaps one of the third-party win32 modules  
[2]. But I have no idea how. Maybe someone who knows about ruby +  
win32 can help (Daniel B.?). You could also probably write a  
little C extension to call the windows API, but that may be more work  
than necessary. Sorry I can’t be of more help.

[1] [http://www.ruby-doc.org/core/classes/WIN32OLE.html](http://www.ruby-doc.org/core/classes/WIN32OLE.html)  
[2]  
[http://raa.ruby-lang.org/cat.rhtml?category\_major=Library;category\_minor=Win32](http://raa.ruby-lang.org/cat.rhtml?category_major=Library;category_minor=Win32)

Regards,  
Jordan

---

<div class="post-metadata">

**Author:** ![eagoweb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/e/9de0a6/32.png) [@eagoweb](https://www.ruby-forum.com/u/eagoweb)\
**Post date:** [December 1, 2007, 9:34am UTC](https://www.ruby-forum.com/t/printing-throught-lpt1/121710/6 "2007-12-01T09:34:30Z")

</div>

On Dec 1, 2007 7:47 AM, Edgar G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > HTH,  
> > Jordan
> 
> Well i am in windows, how could i do that?

You can open file ‘PRN:’ (note the double colon). That should provide  
you with a line printer  
(i.e. no graphics, just ascii output). I’m not sure whether it is  
still supported.

Other than that, I guess the easiest way would be to create pdf  
somehow and print that,  
either using some command line tool, or Win32API/Win32OLE.

See ['system' and printing in Windows - Ruby - Ruby-Forum](http://www.ruby-forum.com/topic/83266) for some hints.
