Expand my Community achievements bar.

Guidelines for the Responsible Use of Generative AI in the Experience Cloud Community.
SOLVED

JavaScript to Launch Designer Form PDF w/ password

Avatar

Level 3

Hi,

Trying to solve the perennial problem for small developers, in my case eLearning, to provide some way to protect unauthorized use of a PDF form via password restriction. I have an eLearning package (KnowledgePresenter) which in its latest version has the ability to add JavaScript routines for example to launch a PDF. So, if I were to create a Designer form, password protect/encrypt its PDF version, in order to open it in the eLearning lesson, the lesson would need to do 2 operations: (1) launch the PDF and (2) for deterring unauthorized use, enter the PDF's password in the JavaScript launch of the form. Not sure if # 2 is possible, especially since I am not very skilled at writing JS routines, plus this PDF launch with a password, all in one action, may not even be possible for a Designer PDF?

The 'fall-back' would be to give the student the password to open the launched PDF form themselves. But, if the password could be hard-coded into the lesson's JS/HTML scripting, as described above, then no one would need to know the password. It would open from inside the lesson. And, since password protected, while it could be copied for external use, it would not open without the password.

Any suggestions would be appreciated, especially any ideas about what the JS routine would look like.

Kind Regards,

saratogacoach

1 Accepted Solution

Avatar

Correct answer by
Level 10

*sign... kicked off after typing long response. This is an abridged version*

We used this script to change the values of objects.

The "close" script will only close the PDF form not the application. Also I have tested and it looks like any "app.execMenuItem" script will not work when opened in a browser. I suspect that this is because it is opened in a browser plugin, rather than Acrobat/Reader.

I would recommend dropping the "app.execMenuItem" script and placing a white rectangle over the form contents in LC Designer (it could also include some notice/warning). Set this rectangle's presence to hidden.

Then in docReady script you would change its presence to visible if the url test failed to match the required url.

If this works you would need to extend the test to Acrobat/Reader, so that if someone saved it to their computer, they still would not be able to view the content.

Niall

View solution in original post

21 Replies

Avatar

Level 3

Thanks, Niall.

I can now get this working using my URL. Tested and it works.

Fantastic!

I also am studying my mistakes so I can learn from these.

Much thanks!

Kind Regards,

saratogacoach