How do I lock PDF before e-mailing so that it cannot be altered by the recipient?

Avatar

Avatar

Steve_Coxon

Avatar

Steve_Coxon

Steve_Coxon

12-10-2011

[Thread Edited By Adobe]

/*Don’t forget to meet and greet your fellow peers virtually by telling them about yourself here

Go ahead and to it now: https://adobe.ly/3eDnB4v */

 

Actual Question:

I've created a form in LiveCycle which will be seen and filled by users who only have Reader.

 

Once the form is completed, the user has to click three buttons: one prints the page (for a specific paper-based usage required by the filler of the form). The same button  sends the entire form to one e-mail address.

 

The second button prepares the form for submission to a second e-mail recipient. This recipient must not be able to see some of the filled fields on the form. As well as setting these fields to invisible, the second button also hides key fields behind a text message, telling the second recipient where to find the information that is most useful to them on the form. Again, this recipient will be using only Acrobat Reader.

 

Everything works fine, apart from when it comes to e-mailing the form to the second recipient. I've used various scripts I've found on this forum and elsewhere to lock fields before sending and I've extended Reader rights in Acrobat. But, whatever I do, the form received by the recipients is STILL editable, the "invisible" fields are visible again and also editable,  and the test box that obscured key fields has become invisible again.

 

I've already tried using a range of scripts that I've found both on this forum and elsewhere (including Paul Guerrett's 'Lock All Fields' and 'Lock All Fields Not Buttons' scripts. I've also tried using the scripts in different 'events' - mouse up, mouse down, click etc.

 

What am I doing wrong? I've spent days trying to figure this out and I'm getting nowhere.

 

I am  a JavaScript novice, by the way. So please keep it simple and (better still) provide working script! Thanks to anyone who can help

View Entire Topic

Avatar

Avatar

George_Florenti

Avatar

George_Florenti

George_Florenti

22-05-2013

This is the system that I use and it workes perfectly:

/**
* Loop through all elements of eForm, except button named "view", and set the access to "protected"
*/
function LockForm() {
     // Get the field containers from each page.
     for (var nPageCount = 0; nPageCount < xfa.layout.pageCount(); nPageCount++) {
          var oFields = xfa.layout.pageContent(nPageCount, "field");
          var nNodesLength = oFields.length;

          // Set the field property.
          for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
               if (!(oFields.item(nNodeCount).ui.oneOfChild.className == "button" && oFields.item(nNodeCount).name == "view")) {
                    oFields.item(nNodeCount).access = "protected";
               }
          }
     }
}

function unLockForm() {
     // Get the field containers from each page.
     for (var nPageCount = 0; nPageCount < xfa.layout.pageCount(); nPageCount++) {
          var oFields = xfa.layout.pageContent(nPageCount, "field");
          var nNodesLength = oFields.length;

          // Set the field property.
          for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
               oFields.item(nNodeCount).access = "open";
          }
     }
}