Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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 ?
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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" });
Copy link to clipboard
Copied
The script is executed from a button in the main document,
Thanks for the coding tip. Still doesn't solve my Not Allowed Error.
Copy link to clipboard
Copied
Does it work if you run it from the Console window?
Copy link to clipboard
Copied
Yes
Copy link to clipboard
Copied
Go to Edit - Preferences - Security (Enhanced) and if the "Protected View" mode is turned on, switch it off and try again.
Copy link to clipboard
Copied
I will give that a try. I am working via distance and will relay the tip to the office environment
Copy link to clipboard
Copied
I tried Protected view and Privileged Locations (added the folder that contains the files in question), Still the same error. It seems odd to me that openDoc gives this error. Any other tips would be appreciated,
Copy link to clipboard
Copied
Method openDoc works in local computer environment but not in an office networked environment. Causes a NotAllowedError: Security settings….Adobe’s latest documentation does not mention this. There are supposed to be ways around this: Privileged Locations, Signed and Certified documents, etc. None of them worked for me. I have always used openDoc and I don’t know why I didn’t think of this before, but I simply used the File Open action under button properties. Problem Solved! Thanks.
Copy link to clipboard
Copied
That's hardly the same thing... You can't use any logic in it. Only a fixed file path.
Copy link to clipboard
Copied
Agreed! But, it gets the job done in my project. Still bothers me why File Open is allowed but app.openDoc is not. Thanks again for the coding tip. I am not steeped in javascript but learning.
Copy link to clipboard
Copied
Hi again. I have a 900 page document that has a field on each page that I want to delete. Can you think of some javascript that would delete them all?
Thanks