Copy link to clipboard
Copied
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");
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
Copy link to clipboard
Copied
From the documentation of buttonImportIcon:
If cPath is specified, this method can only be executed during batch and console events.
Copy link to clipboard
Copied
What does that mean?
Copy link to clipboard
Copied
Exactly what it says.. You can't use it from a MouseUp event.
Copy link to clipboard
Copied
I guess a better way to ask my question is... How do I import pictures from a folder on my Desktop named Pictures with jpg files in it, to buttons on my form?
Copy link to clipboard
Copied
As mentioned, this needs to be done via a trusted function, which can be set up using a certificate or a folder-level script.
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
Please, I need help.
Copy link to clipboard
Copied
I will be using this form on more than one computer, specifically 4 computers.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
Ok, I certified the document and it works. However I was not done working on the document, and now I can't make changes. How do I uncertify my document?
Copy link to clipboard
Copied
Before I suggest anything more, does this need to work with Reader? If so, you won't be able to import anything other than PDF, so the images will have to be fist converted to PDF.
When certifying a document, you're supposed to save to a new file. But you can remove it by right-clicking on the signature in the signature panel on the left side and select "Clear signature".
Copy link to clipboard
Copied
I was able to retrieve the document. Everything is working as you said. Thanks for your help.
Copy link to clipboard
Copied
‌Many things cannot be undone so backups are vital. You are lucky verification can be removed. Always keep an editing copy and a final copy prepared from that.
Copy link to clipboard
Copied
I hope this can be done as I have over 1200 form fields on my form.
Copy link to clipboard
Copied
Is this something that needs to be done once? If so, then you should use a batch process, aka an Action, in Acrobat Pro.
As the documentation I mentioned says, you can specify the file path for the icon when calling this method in a batch, so it should work as is, and you won't have to certify the file, etc.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now