Interactive PDF forms have something called an “add an image” field. This allows the user of the form to click on an area in a form, choose an image from their harddrive, and add it to the form.

Although InDesign has (fairly minimal) interactive PDF capabilities, there is no way to create an “add an image” field natively with InDesign.

But it can be done in InDesign with FormMaker.

Instructions

It’s important to realize that an “add an image” field in Acrobat is just a plain old button field, to which Acrobat automatically adds a 1-line Action script which is triggered on Mouse Up:

So, to do the same with FormMaker in InDesign:

(1) Draw a rectangle and turn it into a button field (in the Button and Forms panel):

(2) Select the button field, and, in FormMaker, go to the Actions tab and tell it to “Run a JavaScript on Mouse Up”.

(3) Click on the Edit button, and add this one-line script. It is exactly the same script as Acrobat adds to turn a button into a “select-an-image” field:

event.target.buttonImportIcon();

That’s it! Export the interactive PDF with FormMaker, run the FormMaker command in Acrobat (it’s available at the bottom of the Edit menu), and you will have an add-an-image field in your PDF, created in InDesign!

Bonus Points

Empty image fields in Acrobat have an outline, and a little icon to show the user that it’s a clickable “add-an-image” field. It looks like this in Acrobat:

To make your InDesign add-an-image field look like Acrobat’s:

(1) Add a grey stroke round the button in InDesign.

(2) Create a small icon like the one in Acrobat, give it large margins, and turn this graphic into a button in InDesign.

One last point: When the user selects an image in Acrobat, it is automatically scaled to fit the button (the equivalent of InDesign’s “fit proportionally” option). But if you’ve followed the instructions here so far, you will find that the button that is created in Acrobat does not scale the selected image to fit the available button area.

To fix this, add an additional line to the FormMaker script. The entire 2-line script should now look as follows:

event.target.buttonImportIcon();
event.target.buttonScaleWhen = scaleWhen.always;

Once the button looks good in InDesign, and is properly set up in FormMaker, you might want to save it as an InDesign snippet. This way it can be easily reused, and will come with the required FormMaker script shown above already embedded, so all that remains is to place it into your document and resize as needed.

Acknowledgments

Thanks to Jan-gxplus whose question on the Id-Extras forum prompted this blog post. The original discussion is here: https://forum.id-extras.com/d/246-add-an-image-field