Copy link to clipboard
Copied
I have a piece of script that was run by a mouse up event within a button field that used to work on a previous version of Acrobat Professional on a Mac (I may have had to change a setting or something to get it to work but I can't for the life of me remember what). I have upgraded to Catlalina and due to non-64 bit software being allowed I am now using DC but I am now getting a security error. The script and error are below, if anyone could help resolve that would be appreciated.
On Mouse Up run javascript
a = this.getField("HiddenText").valueAsString; b = this.getField("RelevantIcon").valueAsString; console.println(a+b); event.target.buttonImportIcon(a+b);
Console message:
/Macintosh HD/Users/xxxxx/Desktop/001.pdf NotAllowedError: Security settings prevent access to this property or method. Field.buttonImportIcon:4:AcroForm:Button1:Annot1:MouseUp:Action1
2 Correct answers
It must have been a very old version of Acrobat if it worked.
You can no longer specify the path of the file to import, unless you run the code from a trusted context, such as a folder-level script installed on the user's local machine.
Yes, there was a time when field.buttonImportIcon() worked with path input, even though the reference has shown it as restricted since Acrobat 7. But it is restricted.
https://www.pdfscripting.com/public/Trust-and-Privilege-in-Acrobat-Scripts.cfm?sd=40
Copy link to clipboard
Copied
It must have been a very old version of Acrobat if it worked.
You can no longer specify the path of the file to import, unless you run the code from a trusted context, such as a folder-level script installed on the user's local machine.
Copy link to clipboard
Copied
Yes, there was a time when field.buttonImportIcon() worked with path input, even though the reference has shown it as restricted since Acrobat 7. But it is restricted.
https://www.pdfscripting.com/public/Trust-and-Privilege-in-Acrobat-Scripts.cfm?sd=40
Use the Acrobat JavaScript Reference early and often
Copy link to clipboard
Copied
Thank you

