Search code examples
javascriptjavapdffdfacrobat-sdk

Trying to submit PDF form with the image of the signature


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!


Solution

  • 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.