Skip to main content
Participating Frequently
May 26, 2021
Answered

JavaScript console not allowing app.openDoc

  • May 26, 2021
  • 1 reply
  • 3344 views

I'm using Adobe Acrobat X Version 10.1.16.

Acrobat JavaScript Debugger Functions Version 10.0
Acrobat EScript Built-in Functions Version 10.0
Acrobat SOAP 10.0

 

I paste and run the following code in my JavaScript console. API.pdf is a JavaScript Acrobat API file, and TestFldr is an empty folder with just that file.

app.openDoc("C:\TestFldr\API.pdf");

I receive the following output in the console.

NotAllowedError: Security settings prevent access to this property or method.
App.openDoc:1:Console undefined:Exec

Furthermore, this code doesn't work in my privileged user folder when saved as a JavaScript file, Config.js. My privileged user folder is as follows.

C:\Users\Trey\AppData\Roaming\Adobe\Acrobat\Privileged\10.0\JavaScripts\Config.js

How can I get around this?

This topic has been closed for replies.
Correct answer try67

Your file-path syntax is incorrect.

Use this:

 

app.openDoc("/C/TestFldr/API.pdf");

1 reply

try67
Community Expert
try67Community ExpertCorrect answer
Community Expert
May 26, 2021

Your file-path syntax is incorrect.

Use this:

 

app.openDoc("/C/TestFldr/API.pdf");

Trey5EAEAuthor
Participating Frequently
May 27, 2021

Thank you. I was indeed using the wrong syntax. This fixes the JavaScript console problem. I'm able to open the pdf directly from the console. However, the script in my Config.js now gives the following response.

NotAllowedError: Security settings prevent access to this property or method.
App.openDoc:1:Folder-Level:User:Config.js

 How do I get Acrobat to permit this operation?

Thom Parker
Community Expert
Community Expert
May 27, 2021

Please provide the complete code used in the Config.js file. 

 

Are you using a trusted function?

https://www.pdfscripting.com/public/Using-Trusted-Functions.cfm

 

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often