Re: Win32ole & Adobe Acrobat Reader

M. Edward (Ed) Borasky wrote:

require ‘win32ole’

pdf = PDF::Writer.new
pdf.select_font “Times-Roman”
pdf.text “Hello, Ruby.”, :font_size => 72, :justification => :center

pdf.save_as(“hello.pdf”)

acrobat = WIN32OLE.new(‘AcroExch.App’) doc =
WIN32OLE.new(‘AcroExch.PDDoc’)
doc.open(“c:<the_absolute_path_to_the_file>\hello.pdf”) acrobat.show

For one thing, don’t your backslashes need to be doubled?

“C:\Program Files\Microsoft Space-Bearing Paths\Are\Evil.pdf”

Hi,

Hum, unfortunately, it does not seem to help!

On 11/6/06, Jeff [email protected] wrote:

filename = “myfile.pdf”

start #{filename}

FYI: be careful when using quotes with start: start "myfile.pdf"
won’t work because when first parameter is quoted it is the title of
the window. so this works:
start "" "myfile.pdf"

…sometimes I wonder what did they smoke when they created this…

Philippe L. wrote:

M. Edward (Ed) Borasky wrote:

I’m trying to launch the opening of a PDF document from
within ruby, under Windows XP. Adobe Acrobat shows up, but no
document appears. Does anyone see the error, or maybe has
another better (cross-platform) method?

Not cross-platform, but try this:

filename = “myfile.pdf”

start #{filename}

If it’s hard to see in your browser, I’m using the “backtick” not the
apostrophe, which will induce a system call. I’m assuming Acrobat is
installed as your handler for .pdf files.

Jeff
softiesonrails.com

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs