Skip to main content
Participating Frequently
March 14, 2019
Question

app.openDoc Not Allowed Security Error

  • March 14, 2019
  • 1 reply
  • 1959 views

Hi.  I am new to the forum.

I have a simple javascript in a main pdf document (General Forms).  The script creates a device independent path to second document and opens the document using app.openDoc.

The script is as follows:

str=this.path;

FirstStringLength = str.length - 22

FirstString = str.substring(0,FirstStringLength);

app.openDoc({ cPath: FirstString + "/Test General Forms/Basic Lift Plan Form.pdf", cDest: "Forms TOC" });

The script works fine on my personal computers (Windows and Mac).  However, when I try it in a networked office environment it issues the error:

NotAllowedError: security settings prevent access to this property or method.

App.openDoc: Field General Forms: Mouse Up.

The Javascript reference manual does not state any security issues with the openDoc method.

Any help?  Please.  Jim

This topic has been closed for replies.

1 reply

Inspiring
March 14, 2019

Are you creating the path name you think you are?

What is the value of the FirstString variable?

Is it what you are expecting?

It is possible that how the network directory has been mapped by your network administrator, the name string is not what you are expecting.

Have you looked at the Acrobat JS Reference openDoc ?

Participating Frequently
March 14, 2019

Yes, the path name is correct (i.e. FirstString) and all works fine in my local computer environment (i.e. not networked).

For example, when the files/folders are placed on a networked computer in c:/Users/....the Not allowed error is generated.

try67
Community Expert
Community Expert
March 14, 2019

Where did you place the code?

Also, the first of your code is not very good. As soon as you'll add or remove a character from the file name the code will break.
Use this instead:

var filePath = this.path.replace(this.documentFileName, "");

app.openDoc({ cPath: filePath + "Test General Forms/Basic Lift Plan Form.pdf", cDest: "Forms TOC" });