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

Import Icon to Button

New Here ,
Mar 19, 2016 Mar 19, 2016

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");

TOPICS
Acrobat SDK and JavaScript , Windows
2.5K
Translate
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 1 Correct answer

LEGEND , Mar 19, 2016 Mar 19, 2016

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

Translate
Community Expert ,
Mar 19, 2016 Mar 19, 2016

From the documentation of buttonImportIcon:

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

Translate
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 ,
Mar 19, 2016 Mar 19, 2016

What does that mean?

Translate
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 ,
Mar 19, 2016 Mar 19, 2016

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

Translate
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 ,
Mar 19, 2016 Mar 19, 2016

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?

Translate
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 ,
Mar 19, 2016 Mar 19, 2016

As mentioned, this needs to be done via a trusted function, which can be set up using a certificate or a folder-level script.

Translate
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
LEGEND ,
Mar 19, 2016 Mar 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.

Translate
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 ,
Mar 19, 2016 Mar 19, 2016

Please, I need help.

Translate
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 ,
Mar 19, 2016 Mar 19, 2016

I will be using this form on more than one computer, specifically 4 computers.

Translate
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
LEGEND ,
Mar 19, 2016 Mar 19, 2016

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

Translate
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 ,
Mar 19, 2016 Mar 19, 2016

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?

Translate
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
LEGEND ,
Mar 19, 2016 Mar 19, 2016

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".

Translate
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 ,
Mar 20, 2016 Mar 20, 2016
LATEST

I was able to retrieve the document. Everything is working as you said. Thanks for your help.

Translate
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
LEGEND ,
Mar 20, 2016 Mar 20, 2016

‌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.

Translate
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 ,
Mar 19, 2016 Mar 19, 2016

I hope this can be done as I have over 1200 form fields on my form.

Translate
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 ,
Mar 20, 2016 Mar 20, 2016

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.

Translate
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