Copy link to clipboard
Copied
The folowing code periodically returns nothing for the JSObject for some files and for others returns the object needed. When I open the PDF files directly (i.e. not through code), the Javascript tool shows the Debugger, Document Javascripts, All Javascripts, and other buttons as selectable. If the same file is opened using the code, and the file displayed (i.e. AcroExch.App.Show), the same buttons are greyed out and the JavaScript button within the Preferences Menu (Edit --> Preferences) does not show up. But, again, it's only for a subset of files that are opened using the programatic interface. The files themselves are NOT read-only, I've checked Access Levels and have even input command line code to ensure that all local users have full control over the file (Call Shell("cmd.exe /C """ & returnFileName & """ /e /p Everyone:f", vbHide)). Additionally, not to overstate, when I open the file directly (from within Adobe Pro), the JavaScript functionality is available to me. The only think I can think of is that opening it from another application intermittently triggers a security response from the adobe application that causes the javascript functionality to be turned off for some reason. It's a really odd issue. Any help would be appreciated. See code snippit below.
--------------------------------------------
Public Function OpenForm(formLoc As String, Optional AVOn As Boolean = False)
formLocation = formLoc
Set gPDDoc = Nothing
Set gAVDoc = Nothing
Set gApp = Nothing
Set gApp = CreateObject("AcroExch.App")
Set gAVDoc = CreateObject("AcroExch.AVDoc")
gApp.Show
If AVOn Then
gAVDoc.Open formLoc, ""
Set gPDDoc = gAVDoc.GetPDDoc
Set jso = gPDDoc.GetJSObject
Else
Set gPDDoc = CreateObject("AcroExch.PDDoc")
gPDDoc.Open formLoc
Set jso = gPDDoc.GetJSObject
End If
End Function
---------------------------------------------------
Copy link to clipboard
Copied
Post the question in the forum for Acrobat SDK.
Copy link to clipboard
Copied
HI,
Depending on your PDF files, it may be that the document is open but not fully loaded by the time you try and get your JSObject,
Can you add a delay in to check.
Copy link to clipboard
Copied
I've added a pause in the code of 5 seconds. I'll let you know if this works. Thank you for you reply!