Skip to main content
MediaCenter_Rotterdam
Participant
Sep 25, 2018 6:38 PM UTC
Question

NotAllowedError: simple script used to work but not anymore

Hi,

Have a form with 2 fields and a button. When filling in the fields and pressing the button, the button is hidden and the form is flatten. That is, it did in previous versions of Acrobat. Now I get this error:

NotAllowedError: Toegang tot deze eigenschap of methode is niet mogelijk vanwege de beveiligingsinstellingen. (Translates as: access to this property or method is not possible due to the security settings.)

Doc.flattenPages:15:Field FLATTEN:Mouse Up

This is the (complete) script:

// The text in a Question Alert Box is usually in two parts.  A short explaination

// and the actual question.  It's a good practice to separate the question from the

// explaination by a line, In the text below, this separation is accomplished

// with the escaped line feed characters "\n\n"

//

// The alert box will only show about 6 lines of text, so both explainations and

// text should be kept short

var cMsg = "Zeker weten? Als u nu Ja kiest, wordt het document afgevlakt en kan er niets meer gewijzigd worden. Dit is ook niet te herstellen.";

var nRtn = app.alert(cMsg,2,2,"Question Alert Box");

if(nRtn == 4)

{// A yes Response

  // Code for doing the thing you do on a yes

  getField("FLATTEN").display = display.hidden;

  this.flattenPages();

}

else if(nRtn == 3)

{ // No Response

  console.println("The Response Was No");

}

else  

{ //Unknown Response

  console.println("The Response Was somthing other than Yes/No: " + nRtn);

}

Is there a simple solution?

Thanks for your help.

Jeroen de Haan

the Netherlands

This topic is closed to new replies. Start a new post to keep the conversation going.

11 replies

try67
Community Expert
Community Expert
Sep 25, 2018 6:40 PM UTC

Are you using it in Acrobat or in Reader? What's the exact version number?

Translate
MediaCenter_Rotterdam
Participant
Sep 25, 2018 6:55 PM UTC

Mine is Acrobat Reader DC 18.011.20063 for the Mac.

My client uses Reader for Windows. Don't now the version, but I assume also DC.

Neither work.

Translate
try67
Community Expert
Community Expert
Sep 25, 2018 7:26 PM UTC

OK, that explains it. The flattenPages method can't be used in Reader.

The closest you can get to it is to set the fields as read-only, or (better yet), digitally sign the file using a Signature field that is set to lock the fields when signed.

Translate