?
Solved

Programmatically convert .doc to .pdf

Posted on 2008-10-27
9
Medium Priority
?
1,097 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
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 1000 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

This article focuses on how to remove password security from multiple PDF files by Adobe Acrobat program. Sometimes it is essential to access the stored data items and to print, edit as well as copy content from Portable Document Format files in abs…
PDF files have been in the limelight due to its unmatched features.  Personal documents, emails, business reports and eBooks are all converted into PDF files owing to peerless features provided by it. Adding watermark to a PDF file is a method to se…
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…
We often encounter PDF files that are pure images, that is, they do not have text characters, but instead contain only raster graphics. The most common causes of this are document scanning software and faxing software/services that create image-only…
Suggested Courses
Course of the Month14 days, 11 hours left to enroll

771 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