0 Replies Latest reply on Dec 9, 2013 11:40 AM by jonwilks1

    Signed PDF w/ embedded JavaScript - persisting global variable

    jonwilks1 Level 1

      My goal is to be able to persist a javascript varible within my PDF document. For my example I have created a PDF document using Apache FOP and iText. I have then signed my PDF with a self assigned certifiacte that my machine trusts. I have also embeded the following javascript based on examples in the API documentation here:




      global.setPersistent("x", true);
      incrementMyGlobalVar = app.trustedFunction ( function() {
                if (global.x  === "undefined") {
                                    global.x = 0; 
                          }else {
                                    global.x += 1; 
      app.alert("Hello World! Count is: " + global.x);
      app.alert("Hello World! Count is: "  + global.x);


      my understanding is that I have gained a prevlideged context because my PDF is signed with a trusted cert. Thus referenceing the documentation again the following should be true.

      1. global variables can be defined and accessed in a privileged context


      My javascript preferences are set in the following fashion:

      Screen Shot 2013-12-09 at 2.34.09 PM.png


      Here is reference to the signature:

      Screen Shot 2013-12-09 at 2.35.36 PM.png



      I am recieving the following error via the console

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



      Any help is appreciated.