views:

442

answers:

4

I have a web app that needs to be able to convert word documents into pdf programmatically just prior to send an email out.

I've been using a 3rd party utility (aspose) but the client writes very complicated word documents and they need the formatting to come out perfectly on the pdf. Aspose isn't rendering everything correctly.

I call Adobe sales and they said Acrobat could create pdfs programmatically. I bought Acrobat, thinking that surely that would do a better job rendering things than aspose.

I set up the COM call correctly and it compiled, but I'm getting the following exception at runtime - Retrieving the COM class factory for component with CLSID {72498821-3203-101B-B02E-04021C009402} failed due to the following error: 80070005.

Some of the things I'm reading indicate that Acrobat may not allow that COM dll to be registered on a server OS. If so, I'm going to be angry.

Help? Surely it can't be THIS hard to create a correct PDF programmatically....

+1  A: 

Why not install the Acrobat print driver (distiller), and print to that? Distiller converts postscript to PDF, and you can use a generic postscript printer driver to generate the postscript.

A search for PDF Print Driver turns up some results, including some free ones.

Tarydon
That would be terrific. Any idea how to do that?
Yoenhofen
Acrobat standard edition installs a print driver. If your application simply prints to that virtual printer, a PDF file is created.
Tarydon
Can you send a word doc to a virtual printer like that?
Yoenhofen
If you are only on Windows and .Net you could also look at printing to XPS. All components you need for generating XPS documents are free, and XPS viewers are also free for distribution. It is equivalent to PDF for distributing electronic documents (though definitely not as popular).
Tarydon
I am sure it should be possible to send a Word doc to a virtual printer. I am not very fluent with the Word programming API, but this is such a basic requirement (selecting a printer and issuing a print command to that printer) that it should be possible.
Tarydon
I agree, and if it was for me I'd be all over that but the client would never go for that.
Yoenhofen
I understand. Have been in similar situations before. The just install PDF printer and print to that.
Tarydon
+1  A: 

There are decent free PDF printer drivers that will work well on the client side. Is that an option for you. I have Distiller but prefer the free version options as I've found them to be faster and easier to use (at least less GUI's to work with for each print).

CutePDF PDF Creator

Sam
The goal of this project is to do it in Acrobat. I've tried 3rd party utilities and had bad rendering results. The rendering has to be VERY true to the original.
Yoenhofen
+1  A: 

You could use iTextSharp. Here's a tutorials page that shows how it's done.

yodaj007
The goal of this project is to do it in Acrobat. I've tried 3rd party utilities and had bad rendering results. The rendering has to be VERY true to the original.
Yoenhofen
I think I misunderstood the question.
yodaj007
A: 

How about you install Microsoft Save as PDF addin; and save word to pdf?

KMan
yeah, that's going to turn out to be the solution. initially, i was reluctant to install word in the production environment, but the sysadmin just agreed to it.
Yoenhofen
Glad I was able to help. I would also look into registering word dlls explicitly, but afaik it requires a licensed version.
KMan