3 Replies Latest reply on Dec 23, 2010 12:38 PM by Fat Willie

    How can I change document security properties with JavaScript?

    Fatso4n5bb

      Hi,

      I have "painted myself into a corner"


      I am creating a form with fields I want users to fill in but I do not want them to modify the form itself.  I set document security properties to:

                 Password Security, Changes Allowed    Commenting, filling in fields, and signing existing signature fields".


      The form is designed to go to three organizations in sequence with a manager's signature at the end of each.  Since the first two pages of the form are instructions, they will no longer be needed when the third manager signs it.


      I want to delete the first two pages when the third manager signs.  I added an action to the third signature block: "Mouse Up Run a JavaScript" to run this script
                        this.deletePages({nStart: 0, nEnd: 1});.


      The JavaScript works perfectly when the document security properties are turned off, but does not work when they are active.  Is there a way I can get JavaScript to remove the protection, then delete the pages, then reestablish the protection?

        • 1. Re: How can I change document security properties with JavaScript?
          Dave Merchant MVP & Adobe Community Professional

          Scripts embedded within a document cannot access the security settings of the document, so the simple answer is "you can't".

           

          If you're not using certifying signatures then you could retrieve the PDF from the third manager, remove the security (as you alone know the password), delete the pages and re-apply it; but doing so will of course break a certifying signature. It's also possible to achieve a similar effect by hiding the pages - but to do that requires LiveCycle Designer templates and XFA forms, rather than PDF forms. It's not trivial but it does work, and there are some discussions about how to do it on the AcrobatUsers.com forums.

          • 2. Re: How can I change document security properties with JavaScript?
            Steven.Madwin Adobe Employee

            Hi,

             

            As Dave said, you can't delete pages from a signed file regardless of the encryption status. It would break the signature, be it a certifying signature or a regular approval signature. When someone applies a digital signature to a document they have the reasonable expectation that the fidelity and integrity of the document will remain unchanged post singing if their signature is going to remain valid. Removing a page definitely will violate those rules, thus that functionality is blocked in the signed file.

             

            You know that the pages you want to remove aren't really part of the signed data, but Acrobat doesn't know that. The instruction pages were signed just as the meat and potatoes portion of the document was signed and they get the same protection.

             

            Steve

            • 3. Re: How can I change document security properties with JavaScript?
              Fat Willie

              Thank you all for trying to help.  I guess I will have to live with the form as it is