Solved

Programmatically convert .doc to .pdf

Posted on 2008-10-27
9
1,079 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Adobe DC 20 55
Indexing and searching a network drive? 5 62
PDF File Shrinker 10 117
Is there a 64bit version of Adobe Acrobat XI? 2 50
The ability to edit PDF documents can be useful, however it may not be a straight forward process. Many non-technical people don't realise that a PDF document is basically an image rather than a text file, even if it contains nothing but text. If…
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 first video of the three-part Xpdf series, we introduce and describe Xpdf, a library containing nine command line utilities that perform various functions on PDF files. We show where the library is located and how to download it, discuss its…
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…

947 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

23 Experts available now in Live!

Get 1:1 Help Now