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

Error: security settings prevent acces to this property or method

jcessar
Registered: Jul 13 2011
Posts: 5
Answered

Hello everybody,
 
I'm facing an error when i open up a portfolio which i've performed some javascript. This script has the function to position over a specific document contained in portfolio and when i open up it through Adobe Reader, it shows me the following error:
 
NotAllowedError: Security settings prevent access to this property or method. Collecition.initialDoc:6:Document-level:onOpen
 
I checked reader properties in preferences and javascript is allowed.
 
How can i resolve this issue?
 
Thanks.

My Product Information:
Acrobat Pro 10.1, Windows
gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
What is the code you are trying to execute?

Have you checked the requirements for executing this code?
It might no be allowed to be run in the manner you have setup.

George Kaiser

jcessar
Registered: Jul 13 2011
Posts: 5
Hi,

I've been using openDataObject function to open up a specific document into my portfolio, this function throws an exception when permissions is forbidden by opening documents, therefore I also disabled "Enabled protected Mode at Startup" to avoid sandbox security.

This is the script that i performed on my portfolio:

try{
var objects = this.dataObjects;
for(i in objects){
var openDoc = this.openDataObject(objects[i].name);
for(j in openDoc.info){
if(j == "Keywords")
if(openDoc.info[j] == "SOMETHING") this.collection.initialDoc = objects[i].name;
}
openDoc.closeDoc();
}
}catch(e){
app.alert("Operation failed");
}

Is there a way to resolve this?

Thanks in advance.

JCessar



gkaiseril
Online
Expert
Registered: Feb 23 2006
Posts: 4307
What version of Reader?

dataObjects - introduced in version 5
openDataObject - introduced in version 7
closeDoc - introduced in version 5

Why are you not showing more data in the captured error.

app.alert("Operation failed" + e.toString());

George Kaiser

jcessar
Registered: Jul 13 2011
Posts: 5
Hi

I'm performing some tests on Adobe Reader 10.1

I used toString() function and debugger shows me the same exception:

Operation failed NotAllowedError: Security settings prevent access to this property or method.

Is there a property in Adobe Reader that it allows me to avoid this exception?

Thanks in advance.

JCessar


thomp
Expert
Registered: Feb 15 2006
Posts: 4411
The "collection.initialDoc" property modifies the structure of the PDF. "initialDoc" is actually a value that is stored inside the PDF. Since you cannot change the structure of a PDF in Reader(unless the PDF has special Rights Enabling), you cannot modify this property in Reader. The reference is wrong. It should have shown a "D" in the second column of the rights bar and an "X" or specific Right in the last column.

The script you've shown is the kind of thing that is run when the document is created, not when it is viewed by users. It is not a document script, but rather an automation script for setting up the document.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

jcessar
Registered: Jul 13 2011
Posts: 5
Hi thomp

Thanks for answer. I'm a newbie in scripting PDFs and i'm trying to set up a default document when the portfolio is open up through Adobe Reader. This default document would change on-demand.

The portfolio is created by a Livecycle service which assembly a bunch of documents into a portfolio and when the user wants to looking for it, a service is invoked then it embeds the above script.

Is there a function either to set up a default document without change the PDF's structure or to handle the nav buttons of the portfolio? or may i have to add a policy rule for special rights?

Thanks in advance.

JCessar
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Accepted Answer
Since the property is not properly documented I don't know which right would need to be applied to the PDF, if any. The best solution, the only real solution, is to set initial document before delivering the PDF to the user, i.e., at the time the PDF is assembled. I don't know how you could do this on the server side using the LC servers. You need to ask an LC server expert.

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script