2

This is what I want to do:

.this.getField('imageField').importImage('path_to_img');

I know this code is not correct, but is there a way to do this? I couldn't find the solution in Acrobat's documentation.

I need to do it using javascript because path_to_image is a variable I'm pulling from a database...

mirta
  • 644
  • 10
  • 25
  • 1
    You may want to look at [this other question](http://stackoverflow.com/q/25323427/924) about inserting images into a PDF using JavaScript. It appears you can, there are just some interesting things to work around in Acrobat depending on the version (like importing the image as an icon). – Brandon Haugen Apr 18 '16 at 14:56

1 Answers1

0

I got an anwser on Adobe forums. Here is the full discussion: https://forums.adobe.com/message/8694023#8694023

var f = this.getField("btnImage");
f.buttonSetCaption("Title");
  if (f.buttonImportIcon("/C/image.pdf") == 0){  // if 0 == no error
      f.buttonImportIcon("/C/image.pdf");
  }

Also when you are setting a button you have to select an option "Icon only" for this to work.

mirta
  • 644
  • 10
  • 25