These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

jsOBJECT syntax in VB for use of javascript openDoc Function

km8415
Registered: Jul 10 2010
Posts: 2

I am using the VB editor from MS Access 2003 and I have Adobe 8.0 Installed

I am attempting to convert a 2003 word document to a pdf format using VBA code launched within MS 2003.

I have been using jsOBJECT from within the VB editor to access some of the javascript functionality for modifying and searching pdf documents.

However, I can't figure out the correct syntax for using the openDoc Javascript function within the VB Editor. I am trying to use this openDOC function to convert a word doc into pdf.

Sub Test()

Dim JSO as Object

Set PDDOC = CreateObject("AcroExch.PDDoc")
Set JSO = PDDOC.getjsobject

'what do I do next?

' I tried JSO.openDOC("C:\test.doc")
'this doesn't work

end sub

Thanks,

My Product Information:
Acrobat Standard 8.0, Windows
shvance12
Registered: Jul 11 2010
Posts: 1
The JsObject interface is documented at the Acrobat Development Center ( http://www.adobe.com/devnet/acrobat/ ) in the "Javascript for Acrobat API Reference" document.

However, it doesn't give you everything you need and there's no way to declare a JsObject so that you can get Intellisense to help you out.

It's a little querky, but in order for your procedure to work, you first have to declare an Acrobat.AcroPDDoc object, use the CreateObject statement to instantiate it, and then open an existing document before you can use the GetJsObject method to return a JsObject reference.

Dim PDDOC as Acrobat.AcroPDDoc
Set PDDOC = CreateObject("AcroExch.PDDoc")
PDDOC.Open "c:\filename.pdf"

Dim JSO as Object
Set JSO = PDDOC.GetJsObject()
JSO.OpenDoc("C:\test.doc")