0

I am trying to add a signature in pdf forms using adobe plugins in firefox browser. My code is not working with Adobe Reader and is showing this error "NotAllowedError: Security settings prevent access to this property or method."

function addSignature(image){
    try {
        app.alert("add image");
        this.createDataObject({cName: "my_signature", cValue: image});
        oFile = util.streamFromString( image, "utf-8");
        this.setDataObjectContents("my_signature", oFile);
        this.submitForm({
            cURL: VIS_SIGN_SERVER_URL , // + "#FDF",
            cSubmitAs: "PDF" // the default, not needed here
        });
    } catch (e) {
        app.alert(e);
    }
}

But when I have Adobe Pro installed it works perfectly. Even why I have read the documentation and search for this problem I cannot find the solution to make it works in Adobe Reader or any documentation that shows that it is not possible to do in Adobe Reader but only in Adobe Pro.

Thank You In Advance!

mkl
  • 90,588
  • 15
  • 125
  • 265
java programming
  • 125
  • 2
  • 11

1 Answers1

1

According to the JavaScript™ for Acrobat® API Reference from the Adobe® Acrobat® DC SDK:

createDataObject |5.0|D||D|

setDataObjectContents |7.0|||D|

where the D in the fourth column is defined to mean:

The property or method is allowed in Acrobat Pro and Acrobat Standard. It can be accessed in Adobe Reader (version 5.1 or later) depending on additional usage rights that have been applied to the document:

...

● D — Requires file attachment rights

Thus, you apparently will have to Adobe-Reader-enable your PDF (apply usage rights) to make it work in Adobe Reader.

Community
  • 1
  • 1
mkl
  • 90,588
  • 15
  • 125
  • 265
  • Thank you for your answer let me know please How this can be done.? While creating the pdf documents or not? – java programming Feb 03 '20 at 14:47
  • 1
    You can do so using Adobe Acrobat. I'm not sure which Acrobat version nowadays is required for that. You first create the PDF and then use Acrobat to apply the usage rights signature. – mkl Feb 03 '20 at 16:59
  • Yes but if I change the pdf with saving it like this"Acrobat Pro XI and above: Click 'File' and then 'Save as Other'; Then 'Reader Extended PDF' and 'Enable More Tools (includes form fill and save)';" https://www.adapteddigitalexams.org.uk/getting-started/making-digital-prelim-papers/extend-rights-for-adobe-reader/ – java programming Feb 03 '20 at 17:06
  • After saving the pdf form like the referred above I got this error when trying to edit it in the browser. "This document enabled extended features in Adobe Acrobat Reader. The document has been changed since it was created and use of extended features is no longer available. Please contact the author for the original version of this document." – java programming Feb 03 '20 at 17:17
  • 1
    Well, Reader-enabling applies a signature. Only very specific changes are allowed thereafter, and they have to be done as incremental updates to not invalidate the digital signature. Apparently your attempt to *"edit it in the browser"* either applies non-allowed changes or does not save as incremental update. – mkl Feb 03 '20 at 17:21
  • Is there any other way to make this possible to work.? – java programming Feb 04 '20 at 13:00
  • 1
    Where do you get that image from? Does image setting and form submitting have to work in one go? – mkl Feb 04 '20 at 14:09
  • Ok, the image cames from capture signature "function" and this I want to putt on the field selected. – java programming Feb 04 '20 at 15:01
  • 1
    Is the field in question a button? There are methods to set button icons... – mkl Feb 04 '20 at 15:17
  • No, it is a simple field. – java programming Feb 04 '20 at 15:27
  • 1
    What do you mean by "simple field"? The pdf standard does not know anything like am image field. Adobe usually emulates image fields using buttons but you appear to use different fields. Text fields? Digital signature fields? – mkl Feb 04 '20 at 22:34
  • Yes, in fact, I can add a signature like an image in each field I want whatever it is "text filed " or something else. And I am doing this on the Back-End using http://www.itextpdf.com/ and adding the image after the pdf is submitted as I have explain in the question. Now the problem is that I can run the function to submit the pdf with all the parameters needed only in Adobe Pro not in Adobe Reader. – java programming Feb 05 '20 at 08:46
  • This because I am using: 'this.createDataObject({cName:"my_signature", cValue: image}); this.setDataObjectContents("my_signature", oFile);' this is not allowed in Adobe Reader becouse the user rights. Now I do not know if exists another way to submitForm pdf with the image without creating an object and set data to it. I hope to be clear. – java programming Feb 05 '20 at 08:47