Solved

Programmatically convert .doc to .pdf

Posted on 2008-10-27
9
1,087 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Enroll in May's Course of the Month

May’s Course of the Month is now available! Experts Exchange’s Premium Members and Team Accounts have access to a complimentary course each month as part of their membership—an extra way to increase training and boost professional development.

 
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
 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

One of the questions I get asked again and again is how to validate a field value in an AcroForm with a custom validation script. Adobe provided a lot of infrastructure to do that with just a simple script. Let’s take a look at how to do that wit…
Inserting page numbers in Portable Document Files not only enhances manageability but also makes them look professional. With numbered pages, the file appears more organized and it becomes easier to search for a particular page. The size and the vol…
In this video, we show how to convert an image-only PDF file into a PDF Searchable Image file, that is, a file with both the image (typically from scanning) and text, which is created in an automated fashion with Optical Character Recognition (OCR) …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

738 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