0 Replies Latest reply on May 1, 2016 8:21 AM by Brian3.14

    Hiding contents of PDF based on NON-existence of a password?


      Hi all -


      I'd like to use javascript to "hide" my Livecycle Designer form on open if a password for the pdf is NOT present.  (If someone strips the password, at least I can make it more annoying for them.)


      I understand that if javascript is not enabled on the end-user side, the PDF will still be visible.  But that's ok.  The PDF is javascript heavy and only useable if javascript is active.


      I've had some success, I think (lol), with "securityHandler".


      If I add a password in LCD to the form and then open it with Acrobat, I can use the Console window and type:


      The return is "Standard".


      If no password is added in LCD to the form and then I open it with Acrobat, using Console window and typing:


      The return is "null".


      So we have two different values we could use to establish whether or not a password is on the PDF.


      But I think I'm getting caught up when trying to write the code to reference the securityHandler value.  Documentation seems to indicate that securityHandler is in both Acrobat and LCD.


      Something like:


      var a = this.securityHandler;

      if (a == "Standard"){

          xfa.host.messageBox("There is a password of some type on this PDF");


      if (a == null){

          xfa.host.messageBox("No password on this PDF.")



      Any ideas?  I know this is just a bump to someone who's taken the time to strip the password using 3party software but why not make it a little more confusing for them, right?