[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Printing with ruby under windows

Marc Heiler

6/21/2008 12:36:00 PM

Anyone knows if there is an easy, straight-forward way to print a i.e.

foobar.pdf

file on windows?
--
Posted via http://www.ruby-....

2 Answers

Phlip

6/21/2008 1:04:00 PM

0

Marc Heiler wrote:

> Anyone knows if there is an easy, straight-forward way to print a i.e.
>
> foobar.pdf
>
> file on windows?

No joke:

system "cmd /c start #{mypdf.to_s.inspect}"

If your users ask not to have to click the little print button, write code
that locates AcroRd32.exe (thru the Registry, in the file association for
pdf), then call:

system "#{path_to_AcroRd32} /p #{mypdf.to_s.inspect}"

There might also be a way to drive Adobe thru its ActiveX Automation. Don't
go that route until you have tried the simpler ways!!

--
Phlip
http://assert2.rubyforge.org/assert_yin...

Axel Etzold

6/21/2008 1:15:00 PM

0


-------- Original-Nachricht --------
> Datum: Sat, 21 Jun 2008 21:36:02 +0900
> Von: Marc Heiler <shevegen@linuxmail.org>
> An: ruby-talk@ruby-lang.org
> Betreff: Printing with ruby under windows

> Anyone knows if there is an easy, straight-forward way to print a i.e.
>
> foobar.pdf
>
> file on windows?
> --
> Posted via http://www.ruby-....

Dear Marc,

I managed to print something in Vista Ultimate with the following command:

system("C:/Program Files/Adobe/Reader 8.0/Reader/AcroRd32.exe /p gpcard.pdf").

(Still had to press the Ok button in the printer dialog....)

You'll maybe have to give the full path of both Acroread and of the file you want to print.
And I also had to change the file separators to forward slashes...
Here's an old post that describes this and other options :


http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-...


Best regards,

Axel
--
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
Browser-Versionen downloaden: http://www.gmx.net/de/...