NotAllowedError on Identity.name

I'm trying to get a form button that will add a watermark text which would include the user's name as it appears from the program's preferences. In its most basic form, I'm trying to do this:

this.addWatermarkFromText(identity.name);

However, I get the following error:

NotAllowedError: Security settings prevent access to this property or method.
Identity.name:1:Field [...]

Can anybody help?

Thanks!


Mr Gou


Voted Best Answer

You cannot get the identity information form a normal form context. See the documentation for the identity object:

http://help.adobe.com/en_US/acrobat/acrobat_dc_sdk/2015/HTMLHelp/index.html#t=Acro12_MasterBook%2FJS_API_AcroJS%2Fidentity.htm

It says "The identity object properties are only accessible during batch, console and application initialization events to protect the privacy of the user. See Privileged versus non-privileged context for details.".

So, if you need to access the identity information, you will need to install a document level script that establishes a function with a privileged context that you would then call from your form. This means, that you would need to make this change on every computer that is used to process your form.

Karl Heinz Kremer
PDF Acrobatics Without a Net
PDF Software Development, Training and More...
http://www.khkonsulting.com


By Karl Heinz Kremer   


Please specify a reason: