Solved

Programmatically convert .doc to .pdf

Posted on 2008-10-27
9
1,076 Views
Last Modified: 2012-06-27
Hi Experts.

I am using Visual Basic 6.0 and need to convert a Word document to a PDF file programmatically.

I have Adobe Acrobat  6.0 Professional installed in my development machine.  I figured I should have the components (OCX, DLL) I would need to make this happen.

Can someone please help me?  Please?

Thanks very much for your anticipated assitance.
0
Comment
Question by:winpiglet
  • 5
  • 2
  • 2
9 Comments
 
LVL 2

Expert Comment

by:jbuzzard
ID: 22812048
Why do you need to do it in VB? I would suggest making the 'program' make an external call to 'cutePDF' printer or the like.
0
 

Author Comment

by:winpiglet
ID: 22812136
I need it to be in VB because the file will be emailed to clients (as their invoices)..  What does cutePDF do?
0
 
LVL 2

Expert Comment

by:jbuzzard
ID: 22812226
cutePDF is a free pdf printer; you could get your program to autoinstall that at the start, and then use it to write to pdf before emailing. It's easier than writing it yourself...
0
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 250 total points
ID: 22812268
Why is it that somebody always has to bring up tools like cutePDF or PDF995 - even though the asker clearly states that they have the full version of Acrobat?

winpiglet: You can do this with what you have (Word, Acrobat and VB). However: Keep in mind that the Acrobat EULA does not allow you to run Acrobat on a server (or in a server like environment).

And, another caveat: This task will be much easier with a newer version of Acrobat. Starting with Acrobat 7, Adobe provided a documented way to name PDF files. Acrobat 6 does not have that, so it gets a bit more complicated. If  you have a chance to upgrade, please do, it will make your life a lot easier.

The general method is this:

You need to create a PostScript printer that allows you to write to file (that is the setup part and needs to be done outside of your software).

In your VB program, you automate Word to open one file at a time, and print it to the just created PostScript printer - ending up with a PostScript file.
Then you VB program takes that file and hands it over to Distiller. You can download the Distiller API documentation from Adobe's web site (http://www.adobe.com/devnet/acrobat).
There are two ways you can do this: You can either use the command line interface, or you can use the automation interface. Both are described in the Distiller API documentation.

In Acrobat 7 and later, you set a registry key with the PDF file name before you start your print process in Word, then you just select the "Adobe PDF" printer and print to that printer. Distiller will automatically create the PDF file for you.

Regardless of what you do, you cannot mimic the behavior of the PDFMaker (which will convert Word links and bookmarks as well). The interface to PDFMaker is not published, and people who tried to reverse  engineer it have been bitten by software updates that render their solutions useless.
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 2

Expert Comment

by:jbuzzard
ID: 22812319
The reason for bringing up tools like CutePDF is because it is free, and doesn't require a full (and paid for) version of Acrobat on every computer. It can then act in the exact manner you are referring to above. I thought it was relevant...
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 22812345
Yes, but the asker has a full (and paid for - I hope) license for Acrobat...
0
 
LVL 2

Expert Comment

by:jbuzzard
ID: 22812467
Sorry, explain a bit more - I kinda thought he/she may be writing a program for distribution over more than just one computer.
If he/she's just using one computer, then acrobat is fantastic. However, more than one means more than one license; not good for end price.
0
 

Author Comment

by:winpiglet
ID: 22812563
ok guys.... thank you very much for your comments and suggestion.  I appreciate them.

Yes, I have full and paid for version of Acrobat 6.0 Prof
Yes, the program should be running on at least 20 computers in our local area network.  So a solution that is portable is the best solution.

I will look into the cutePDF then khkremer's solution.  And see what best fit my needs.  I'll get back on this issue as soon as I've tried both.

Thanks very much to you both.
0
 
LVL 2

Expert Comment

by:jbuzzard
ID: 22812679
No worries - hope you get it working.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

In a previous article published here at Experts Exchange, Signature Image with Transparent Background (http://www.experts-exchange.com/Web_Development/Document_Imaging/A_12380-Signature-Image-with-Transparent-Background.html), I explained how to cre…
PaperPort is a popular document imaging/management product from Nuance Communications (http://www.nuance.com/). It is in widespread use by both individuals (http://www.nuance.com/for-individuals/by-product/paperport/index.htm) and businesses (http:/…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Sometimes we receive PDF files that are in the wrong orientation. They may be sideways or even upside down. This most commonly happens with scanned or faxed documents. It is possible to rotate the view of these PDFs with the free Adobe Reader produc…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now