Expand my Community achievements bar.

SOLVED

"Add an image" function in a PDF

Avatar

Level 2

Is there a way to have a button that will upload an image into your PDF? I want to do something similiar to having a 120px x 180px area and a button underneath it that says "Upload pic". When you click the button, it asks where to get image. Then when you select it the file, it places it into the blank area.

Or, is there a way to dynamically add attachements(image, text document, spreadsheet, etc.) to a form?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Hi,

In the Object Library there is an imageField that when clicked at runtime will prompt the user to select an image. You could put a static text behind it - "Click here". Alternatively you could put instructions in the caption area of the imageField.

Niall

View solution in original post

9 Replies

Avatar

Correct answer by
Level 10

Hi,

In the Object Library there is an imageField that when clicked at runtime will prompt the user to select an image. You could put a static text behind it - "Click here". Alternatively you could put instructions in the caption area of the imageField.

Niall

Avatar

Former Community Member

You mention to add static text to the image fields i.e. "Click Here".  Can you explain how to add static text. If there is JS, please include it.

Thanks.

Avatar

Level 10

Hi,

What I was suggesting was to drag a "text" object from the Object Library and when it is on the page, change it to "Click here".

You could then drag the text object and place it behind the imageField object, so that when the imageField object is blank, the user sees "Click here". But when the image is imported it hides the text.

Hope that helps,

Niall

Avatar

Former Community Member

Thanks for the advice...my next option is to have a button that will invoke the file chooser to add an image, i.e. how HTML works. Can you point me to some scripts for this?

Avatar

Level 10

Hi,

I don't believe you can achieve this.

The imageField object has in-built functions to add an image when clicked. There isn't a way to access this or fire this behaviour from a separate button (afaik).

Niall

Avatar

Former Community Member

So there is no way to invoke an object or image object from another object using JS?

Avatar

Level 10

Hi,

Yes, you can fire a script in one object, from a separate object, using execEvent(). For example this script in one button will fire the script in the click event of "button2":

button2.execEvent("click");

However when it comes to an imageField object, it does not have script that you can access. So as far as I know, you cannot force the browser window to open for an imageField from a different object - the user must click the imageField object itself.

Niall

Avatar

Former Community Member

I tried that already, I was wondering if there was another way.