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

How do I program a button to retreive an image from a users database and insert into a form field?

Guest
Aug 29, 2016 Aug 29, 2016

​I need help (I don't have a clue) with a java script  to program a button to retreive an image from a users database and insert into a form field. Basically to go to the Select Icon menu.

[edited by moderator - there was no body to the post and it was all in one long title header. Shortened the title and pasted the original, full length title as the body to the post]

TOPICS
Acrobat SDK and JavaScript , Windows
1.0K
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

Community Expert , Aug 29, 2016 Aug 29, 2016

OK, that's quite easily done. As the button's MouseUp event, select "Execute JavaScript" and then enter this code:

event.target.buttonImportIcon();

When you then click the button it will open a file selection dialog, and the selected file will be displayed as the button's icon.

Translate
Community Expert ,
Aug 29, 2016 Aug 29, 2016

You can only do that if the script is installed on the user's local machine. And of course, you need to know the full path of the image file.

Otherwise, the used will need to select it manually.

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
Guest
Aug 29, 2016 Aug 29, 2016

That's correct. The intent is for the user to manually select the image file from their computer data base.  I just want the button to re-direct to the button/properties/choose icon/ select icon menu.

Thank you.

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 ,
Aug 29, 2016 Aug 29, 2016

OK, that's quite easily done. As the button's MouseUp event, select "Execute JavaScript" and then enter this code:

event.target.buttonImportIcon();

When you then click the button it will open a file selection dialog, and the selected file will be displayed as the button's icon.

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
Guest
Aug 29, 2016 Aug 29, 2016

Perfect. Thank you very much!

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 ,
Aug 30, 2016 Aug 30, 2016

Two thoughts.

1. We were a bit confused because "data base" means something other than "the files on the user's computer".

2. Note that if your JavaScript is to run in Reader the image must ALREADY be a PDF, it cannot be a JPEG or whatever.

3. If developing for Reader be sure to test on a computer with ONLY Reader, and look at the JavaScript reference to check the Quick Bar for each method used, because many are not in Reader.

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 ,
Aug 30, 2016 Aug 30, 2016
LATEST

2. Note that if your JavaScript is to run in Reader the image must ALREADY be a PDF, it cannot be a JPEG or whatever.

+ + +


Acrobate du PDF, InDesigner et Photoshopographe
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