Copy link to clipboard
Copied
Is there a way to do insert a form field into an AcroForm that allow Reader users to browse and insert a picture into that form field?
I know that LiveCycle can do this, but I need to do this using an AcroForm. Or maybe there's a third-party plug-in that can be used in an AcroForm to do this?
Copy link to clipboard
Copied
No, you don't need Acrobat 11 to create a form that uses this method, but your Reader users will need to upgrade. I don't see that they've announce the release date for Reader yet, but in the past it has usually been within about a month of the announcement.
Copy link to clipboard
Copied
Jay,
The new version of Reader, which was announced today (see AcrobatUsers.com), will now allow you to use the field.buttonImportIcon method: http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.737.html
For a bit more information, see: http://forums.adobe.com/thread/743823
Here's the minimum code that can be used in the Mouse Up event of a button that's configured with a layout that's something other than "Label only":
// Mouse Up script for a button
event.target.buttonImportIcon();
Since this isn't backwards compatible with Reader, you'll probably want to add additional code to test what version is being used and alert the user if it's pre-11. You should also check the return value to see if anything went wrong. The hard part is getting everyone to upgrade, but this and a number of other features should make it worth it.
Copy link to clipboard
Copied
Thank you, George. This is great news.
Do I need Adobe Acrobat XI Pro in order to create a button that Reader users can click to import their images?
When will Reader XI be available for download?
Copy link to clipboard
Copied
No, you don't need Acrobat 11 to create a form that uses this method, but your Reader users will need to upgrade. I don't see that they've announce the release date for Reader yet, but in the past it has usually been within about a month of the announcement.
Copy link to clipboard
Copied
George,
It occurred to me that as far as having both a label and an icon, I could have two separate buttons: one that has a label "click here to insert picture" and another that is set to Icon. But, if I do that, when the user clicks the button with a label, is there a way to have the picture inserted into the other button, the one set to icon?
And I still have the issue of whether a JPEG or other file format can be inserted using Reader.
Copy link to clipboard
Copied
Unfortunately, with Reader the source of the icon has to be a PDF, but it's farily easy these days to convert an image to a PDF. You can even do it with an XFA form that you set up for this purpose, but it will have to be Reader-enabled even when used with Reader 11. I have hope that they may change this with a future version. Please post a feature request if you'd like to see this too.
You have the ability with JavaScript to dynamically set the button label (see the field.buttonSetCaption method). The buttonImportIcon returns a code that allows you to determine whether the icon was successfully imported, and you can alter the button label based on it.
To have one button cause another button to be populated, the code would be something like:
// Get a reference to the button we want to populate
var f = getField("IMAGE_BUTTON");
// Prompt the user to import an image
f.buttonImportIcon();
This would be the Mouse Up script of the "Click Here to Insert Picture" button.
Copy link to clipboard
Copied
Thank you, George. The code you provided works great.
I submitted an enhancement request for more file formats using Reader.
Until Reader users can click to import file formats other than PDF, this feature won't be nearly as useful to me as I was hoping. Even an 'easy' extra step is too much for users that are not all that computer savvy.
Copy link to clipboard
Copied
+1 to allow jpeg format for the end users on Adobe Reader
Copy link to clipboard
Copied
Do you mean that Acrobat version 11.0.1 allows users to insert a picture that is JPG format?
Copy link to clipboard
Copied
For Adobe Reader, it does not that I'm aware. That would be a nice improvement. Currently I believe it only allows insertion of PDF.
Acrobat on the other hand (the full version) will allow you to insert other image types as far as I know.
Copy link to clipboard
Copied
jmohr-weco,
Thanks for this info. Of course, what I need is for Reader users to insert JPGs 😞
I hope that Adobe will consider adding this feature to Reader.
Copy link to clipboard
Copied
George,
I inserted a button and used the JavaScript that you provided:
// Mouse Up script for a button
event.target.buttonImportIcon();
A couple of questions:
- When clicking the button, is it possible to insert a JPEG, or file format other than PDF, using Reader? (I noticed it was possible with Acrobat.)
- Is it possible to have a label, something like "click here to insert picture" and have the ability to click the button to insert a picture, and then have the label disappear once the picture is inserted? (When there is a label, it doesn't seem to be possible to insert any picture.)
Thanks for any help you can provide.
Copy link to clipboard
Copied
Everyone - this is great. I have noticed that when you bring in the files into the PDF it retains all of the resolution of that file. I incorrectly assumed that the "icon" was just the thumbnail view of the page therefore would create a small file when saved. Unfortunately I am bring in high resolution PDF files that were created for print that are sometimes huge, so a file created by bringing in 6 pages will go above 100mb routinely. Is it possible to create this with a low resolution version only using the thumbnail that is embedded in the imported PDF?
Thanks! Any help is greatly appreciated.
Copy link to clipboard
Copied
If you're using Acrobat you have the ability to optimize the file after you import images. You cannot do this with Reader though.
Copy link to clipboard
Copied
Is there a way to have the picture take the whole space of the button rather than just put it in the middle?
Copy link to clipboard
Copied
Yes, go to the button's Properties, Options, Advanced, and select the Fit to Bounds option.
Copy link to clipboard
Copied
This is very helpful information!! I have added your script to a report we use and it does just what we need with a little help from a photo resizer/pdf converter.
My question: Is there a script to clear the images? I cannot seem to find a way to include clearing the pictures (button icons) in the reset form function.
Message was edited by: rhiannonstrange
Copy link to clipboard
Copied
You need to somehow get an icon object that represents a blank icon. There are several ways to do this, but what I usually do is use the field.buttonGetIcon method (http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.736.html) to retrieve a blank icon from an existing button (e.g., a hidden one placed just for this purpose). You can then use the blank icon with the field.buttonSetIcon method to effectively clear the icon.
Copy link to clipboard
Copied
PURE GENIUS! Thank you!
Copy link to clipboard
Copied
George,
I have a PDF with a button to insert a picture, but having trouble figuring out how to create the Clear button that you described. Do you have a simple sample PDF that would demonstrate the Clear button?
Copy link to clipboard
Copied
I'll be able to put one together later today.

Copy link to clipboard
Copied
George,
This whole forum post has been VERY HELPFUL. Unfortunately, I got stumped at the same point as Jay and was also interested in seeing if you had a sample PDF demonstrating the "Clear Buttom" method.
Copy link to clipboard
Copied
Sure, anything for someone from Margaritaville (that's Jimmy in my avatar): https://workspaces.acrobat.com/?d=Y8yNh5pIkMTlreBhZ5CUHQ
There's a hidden button in the upper-left corner of the page that's used as the source of a blank icon.
Copy link to clipboard
Copied
George,
Thank you for the example!!!
Copy link to clipboard
Copied
Thanks so much for the info, George.
By chance is there any way to export the photo into Excel like you can the rest of the field info. We are sending out a form, which now can contain a photo, thanks to you. When we receive the form with the photo back from multiple recipients, we want to export the field info into Excel. Is there any way to make that photo appear in the exported Excel file? Thanks! MJinTX

