Skip to main content
Participating Frequently
October 25, 2007
Question

How to convert word Doc, Excel into PDF using Adobe API in VB6.0

  • October 25, 2007
  • 39 replies
  • 74450 views
Dear All,
I'm having the Adobe Acrobat SDk 8.0 and I need to convert our Word Documentent and Excel Sheets into PDF format thru our VB6.0 program. I'm able to manage to open the PDF documents and printing. I don't know hoe to convert the documents thru VB program.
This topic has been closed for replies.

39 replies

New Participant
January 23, 2008
> The supported way would be to automate Word, Excel etc. to make
> them print to the Adobe PDF printer. Using the information in
> the Distiller API you can stop the prompt for PDF destination.

> Note that there is no supported way to give all of the features of
> the Create PDF button in Word (links, bookmarks etc.)

My problem is similar to the thread starter but I use WScript as my language. Is it for real there is no programatic way to simulate the "Create PDF" button? My current understanding is that is does a 3 step process:

1. Find the position of the hyperlinks and TOC in the document

2. Print the document through the Adobe PDF/Distiller printer driver.

3. Insert the TOC and hyperlinks extracted in step #1.

I have no problem achieving #2 but how do I do the other steps.

My task is to automated the compilation and PDF-generation of a few user manuals which seems like a very standard task at a SW company.

Are there other Adobe products for this (I am using Adobe 8.1 Standrd)?
Participating Frequently
January 23, 2008
>My problem is similar to the thread starter but I use WScript as my language. Is it for real there is no programatic way to simulate the "Create PDF" button? My current understanding is that is does a 3 step process

It does much more than that in steps 1 and 3, but you have the
essence. One way to achieve the additional PDF features is to add
PDFMark instructions between creating the PostScript and distilling
it. Word Basic/VBA can be used to analyse the contents of the Word
document.


Aandi Inston
Participating Frequently
January 16, 2008
Dear All,
Still i'm working on that. Now i'm trying to use the distiller for that. Could anyone helpme how to use distiller thru APIs. Any doc would be helpful.
Participating Frequently
January 16, 2008
> Any doc would be helpful.

The Distilller API document is part of the Acrobat SDK. Is there any
information missing that you need?


Aandi Inston
New Participant
December 28, 2007
Hi Vijayakumari !

Thank for your code. I am able to convert word documents into pdf documents.I am not getting any pop-pu options during conversion.

U have to set the following properties in Adobe PDF Setting Printer:

1.Right click the Adobe PDF Printer.Select Properties menu
2.Select Advanced tap in that window.
3.Select printing Defaults command in Advanced Tap.
Participating Frequently
October 29, 2007
Actually, Aandi - the AVConversion APIs that are available to plugins FULLY support the creation of "rich" PDFs with bookmarks, links, etc. in fact, the caller can choose which features they want and which they do not using the ASCab "settings".

Examples of the AVConversion APIs for plugins can be found in the Binder sample in the Acrobat SDK.
Participating Frequently
October 29, 2007
Hi Aandi Inston,
Thanks for your quick reply. Do you have link for the API refernce documents. I tried to get those but can't.
Participating Frequently
October 29, 2007
They are just part of the SDK. I assumed you already had it. Try:

http://www.adobe.com/devnet/acrobat/

Aandi Inston
Participating Frequently
October 29, 2007
Anyone Please help me to provide the snippet of the C++ or VC++ to convert word doc into PDF. No need for links & bookmarks etc. My objective is to convert the document thats it.
Participating Frequently
October 29, 2007
You need to use two different APIs. The Word (or Excel) API to open a
file, choose a printer, and print. The Distiller API (very simple
registry setting) to choose a destination filename.

If you need any help understanding the Acrobat SDK documentation just
let us know which part is difficult. I do NOT post sample code, I
want people to learn, not copy. Sorry if this sounds harsh.

Aandi Inston
Participating Frequently
October 29, 2007
Hi Aandi,
Thanks for your reply. I got this idea from google search. I tried that one in my machine and able to create pdf. If there is a proper way to create pdf using Adobe Api, please help me.
I came to know that API is available for C/C++. Could you please help me to give the snippet of the C++ or VC++. So that i will try to create an dll and use it in VB.
Participating Frequently
October 29, 2007
The supported way would be to automate Word, Excel etc. to make them
print to the Adobe PDF printer. Using the information in the Distiller
API you can stop the prompt for PDF destination.

Note that there is no supported way to give all of the features of the
Create PDF button in Word (links, bookmarks etc.)

Aandi Inston
Participating Frequently
October 27, 2007
Dear Leonard,
Thanks for you reply. I have managed to create the PDF by using 'Adobe PDF' printer. But whenever I used the conversion it opens the PDF Application even though I specified the Application Hide.
Could you please help me to stop the application pop-up, I want to use this as background and user shouldn't know the conversion is taken place.

Code Snip pet
/***************************************************************/
Dim AcroApp As Object
Dim AcroAVDoc As Object
Dim AcroPDoc As Object
Dim oJS As Object
Dim nPages As Long

Set AcroApp = CreateObject("AcroExch.App")
Set AcroAVDoc = CreateObject("AcroExch.AVDoc")
Set AcroPDoc = CreateObject("AcroExch.PDDoc")

AcroApp.Hide

If AcroAVDoc.Open("c:\input.doc", "") = False Then
Exit Function

End If

Set AcroPDoc = AcroAVDoc.GetPDDoc

If AcroPDoc.GetFileName = "" Then
Exit Function
End If

AcroPDoc.Save 1, "c:\input.pdf"
AcroPDoc.Close
AcroAVDoc.Close True
AcroApp.CloseAllDocs
AcroApp.Exit

Set AcroPDoc = Nothing
Set AcroAVDoc = Nothing
Set AcroApp = Nothing

/***************************************************************/
Participating Frequently
October 27, 2007
AVDoc.Open is documented and supported only as a method for opening
PDF files. It is neither documented nor supported as a conversion
tool, it works by accident and could fail or be withdrawn.

Aandi Inston
Participating Frequently
October 26, 2007
Acrobat's APIs for document conversion are only for plugins (C/c++) at this time.

Leonard