# How do you get a file to the printer using wxRuby?

**URL:** <https://www.ruby-forum.com/t/how-do-you-get-a-file-to-the-printer-using-wxruby/206616>\
**Category:** wxRuby\
**Created:** [May 6, 2011, 12:35am UTC](https://www.ruby-forum.com/t/how-do-you-get-a-file-to-the-printer-using-wxruby/206616 "2011-05-06T00:35:58Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dubstep](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/cdc98d/32.png) [@dubstep](https://www.ruby-forum.com/u/dubstep)\
**Post date:** [May 6, 2011, 12:35am UTC](https://www.ruby-forum.com/t/how-do-you-get-a-file-to-the-printer-using-wxruby/206616/1 "2011-05-06T00:35:58Z")

</div>

Can someone point me to some documentation on how to use the printer  
using  
ruby 1.9.2 or WxRuby?

---

<div class="post-metadata">

**Author:** ![ann\_m](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e8cbc/32.png) [@ann\_m](https://www.ruby-forum.com/u/ann_m)\
**Post date:** [May 6, 2011, 4:34am UTC](https://www.ruby-forum.com/t/how-do-you-get-a-file-to-the-printer-using-wxruby/206616/2 "2011-05-06T04:34:22Z")

</div>

On Fri, May 6, 2011 at 5:40 AM, Ann M. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Can someone point me to some documentation on how to use the printer using  
> ruby 1.9.2 or WxRuby?

what os do you use?  
if it’s linux, simply

system(“lpr”, filename) or raise “lpr failed”

should do the trick

---

<div class="post-metadata">

**Author:** ![ann\_m](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8e8cbc/32.png) [@ann\_m](https://www.ruby-forum.com/u/ann_m)\
**Post date:** [May 6, 2011, 8:40am UTC](https://www.ruby-forum.com/t/how-do-you-get-a-file-to-the-printer-using-wxruby/206616/3 "2011-05-06T08:40:28Z")

</div>

On 05/05/11 22:40, Ann M. wrote:

> Can someone point me to some documentation on how to use the printer  
> using ruby 1.9.2 or WxRuby?

For the content (text, images, geometric figures) that is to be printed,  
a printer is a DeviceContext (DC) that is drawn to in the same way that  
wxRuby draws to screen. Have a look at the drawing classes (wxDC).

For controlling the printer (choosing which one to use, choosing paper &  
orientation) there is a set of Printing classes.  
[http://wxruby.rubyforge.org/doc/#printing](http://wxruby.rubyforge.org/doc/#printing)

There is an example in the distribution in samples/printing/printing.rb  
which shows both these aspects

alex
