Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

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

Brian3_14
Level 3
Level 3

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:

this.securityHandler

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:

this.securityHandler

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?

Thanks!!!

Brian

0 Replies