Skip to main content
Known Participant
March 19, 2016
Answered

Import Icon to Button

  • March 19, 2016
  • 2 replies
  • 2760 views

I have created a form that only I use on my computer. I want to import pictures to various buttons. I have the following code added to a Mouse Up trigger in a Run a JavaScript action on a button. All of the button names are C01Picture, C02Picture, etc. However it doesn't work. Can you please advise me as to what I'm doing wrong?



var a = getField("C01Picture");

var b = getField("C02Picture");

var c = getField("C03Picture");

var d = getField("C04Picture");

var e = getField("C05Picture");

var f = getField("C06Picture");

a.buttonImportIcon("/C/Users/MyComputer/Desktop/Pictures/01.jpg");

b.buttonImportIcon("/C/Users/MyComputer/Desktop/Pictures/02.jpg");

c.buttonImportIcon("/C/Users/MyComputer/Desktop/Pictures/03.jpg");

d.buttonImportIcon("/C/Users/MyComputer/Desktop/Pictures/04.jpg");

e.buttonImportIcon("/C/Users/MyComputer/Desktop/Pictures/05.jpg");

f.buttonImportIcon("/C/Users/MyComputer/Desktop/Pictures/06.jpg");

This topic has been closed for replies.
Correct answer George_Johnson

The easiest method is to simply leave the code as-is and certify the document. Then on each computer set it up so that your certificate is added to the list of trusted certificates and that it's trusted for high privileged JavaScript.

For more information in certifying a document with Acrobat DC, see: https://helpx.adobe.com/acrobat/using/certificate-based-signatures.html

2 replies

Inspiring
March 19, 2016

It can be done if you place the code that imports into a folder-level JavaScript file in a trusted function. You can then call the code in a button. You can also call it from a button if you certify the document and the user chooses to trust your digital certificate for privileged JavaScript. If you need help with either of these options, post again.

senechiaAuthor
Known Participant
March 20, 2016

Please, I need help.

try67
Community Expert
Community Expert
March 19, 2016

From the documentation of buttonImportIcon:

If cPath is specified, this method can only be executed during batch and console events.

senechiaAuthor
Known Participant
March 19, 2016

What does that mean?

try67
Community Expert
Community Expert
March 19, 2016

Exactly what it says.. You can't use it from a MouseUp event.