# 'system' and printing in Windows

**URL:** <https://www.ruby-forum.com/t/system-and-printing-in-windows/70719>\
**Category:** Ruby\
**Created:** [October 2, 2006, 12:04pm UTC](https://www.ruby-forum.com/t/system-and-printing-in-windows/70719 "2006-10-02T12:04:32Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 2, 2006, 12:04pm UTC](https://www.ruby-forum.com/t/system-and-printing-in-windows/70719/1 "2006-10-02T12:04:32Z")

</div>

Dear all,

I’d like to give the user the possibility to print some Ruby-generated  
results of  
my programs (this can be PDF, PS, EPS, PNG files, a .doc document, …)  
from  
a GUI  
program developed in Ruby.  
So far, I have created a button, which when pressed, should execute  
some  
‘system’ command to print the document.  
This works, except for that I don’t know what to write in this line  
except  
for the  
system command, when the OS is Windows XP ☹  
Ideally, I’d like the ‘system’ command to open some option window  
of the printer software, where further settings (A4, letter paper,  
portrait,landscape etc…)  
can be made.

Thank you for your help!

Best regards,

Axel

---

<div class="post-metadata">

**Author:** ![unknown](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/u/4bbf92/32.png) [@unknown](https://www.ruby-forum.com/u/unknown)\
**Post date:** [October 2, 2006, 1:02pm UTC](https://www.ruby-forum.com/t/system-and-printing-in-windows/70719/2 "2006-10-02T13:02:38Z")

</div>

On 10/2/06, removed\_email\_address@domain.invalid [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Dear all,  
> I’d like to give the user the possibility to print some Ruby-generated  
> results of  
> my programs (this can be PDF, PS, EPS, PNG files, a .doc document, …) from  
> a GUI  
> program developed in Ruby.

This can be a little complicated, and might involve all sorts of nutty  
winapi calls.

See [http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/32861](http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/32861)  
for an example of printing plain-text documents.

If you’re using more complicated filetypes you may want to consider  
using windows’ shellexecute function to just run the associated  
program’s ‘print’ action.

This has an example of that approach:  
[http://rubyforge.org/pipermail/fxruby-users/2005-February/000199.html](http://rubyforge.org/pipermail/fxruby-users/2005-February/000199.html)

Sam
