• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Using buttonImportIcon from within button field

New Here ,
May 23, 2020 May 23, 2020

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

 

TOPICS
Acrobat SDK and JavaScript

Views

680

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Community Expert , May 23, 2020 May 23, 2020

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.

Votes

Translate

Translate
Community Expert , May 23, 2020 May 23, 2020

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

 

 

Votes

Translate

Translate
Community Expert ,
May 23, 2020 May 23, 2020

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 23, 2020 May 23, 2020

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

 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 24, 2020 May 24, 2020

Copy link to clipboard

Copied

LATEST

Thank you

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines