How to use WIN32OLE to Save As PDF

J

Joe Peck

Hi,

I've been trying to figure out how to use Win32OLE to save as a PDF. It
doesn't seem like there's any good documentation on how to do this, so I
was hoping someone here has experience with this.

Anyhoo, if anyone's tried this before, and actually gotten somewhere
with it, please let me know.

Thanks
 
G

gregarican

Hi,

I've been trying to figure out how to use Win32OLE to save as a PDF.  It
doesn't seem like there's any good documentation on how to do this, so I
was hoping someone here has experience with this.

Anyhoo, if anyone's tried this before, and actually gotten somewhere
with it, please let me know.

Thanks

Ever look at this?

http://ruby-pdf.rubyforge.org/pdf-writer/

Seems like it'd be straightforward, at least moreso than digging into
all of the OLE stuff...
 
G

Gregory Brown

P

Phillip Gawlowski

Yeah, I've seen that. I just figure there has to be a way to save
directly as a PDF using WIN32OLE.

Only if an OLE capable tool is installed that a) accepts your input and
b) writes PDF (for example, Oo_O Writer, or MS Word 2007).
 
J

Joe Peck

Alrighty, so I figured it out.

It turns out 17 is the FormatType for PDF, so you just have to do
something like this:

document.SaveAs(filename, 17)

I didn't see any documentation about this, but we just started going up
from 0 as a FormateType, and once we hit 17, it made a valid PDF!!
 
G

Gregory Brown

Alrighty, so I figured it out.

It turns out 17 is the FormatType for PDF, so you just have to do
something like this:

document.SaveAs(filename, 17)

FormatType for what? You never mentioned what program you're using
via win32ole (i'm assuming MS Office?). In the future, be sure to do
that so that people know what you're talking about.

-greg
 
A

Austin Ziegler

Gregory said:
Please don't use PDF::Writer anymore. If you need pure Ruby PDF
generation, Prawn is the way to go.
If there are features that are holding you back, let us know.

(Disclosure: I am the maintainer of Prawn and the 'if all hell breaks
loose' maintainer of PDF::Writer (originally written by Austin
Ziegler) )

What Greg said.

-austin
 
J

Joe Peck

FormatType for what? You never mentioned what program you're using
via win32ole (i'm assuming MS Office?). In the future, be sure to do
that so that people know what you're talking about.

-greg

Sorry. Yeah, I'm using MS Office through win32ole.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,160
Messages
2,570,889
Members
47,421
Latest member
StacyTaver

Latest Threads

Top