How to create a button form field to insert a PDF file with Acrobat XI
Learn how to add a button to a PDF form that can be used to attach PDF files.
In this infographic, learn how to create a button form field
that can be used to attach PDF files. For this to work in Reader, Acrobat version XI or later is required.
View transcript
How to create a button form field to insert a PDF file with Acrobat XI
Donna Baker February 21, 2014
- In the Tools pane, select the Interactive Objects panel.
- Click the Button tool, and draw your button on the page. Click All Properties to open the Button Properties dialog.
- On the General tab, type the field’s name, and add a tooltip for user information.
- On the Appearance tab, choose visual options, such as the border and fill colors.
- On the Options tab,click the Layout drop-down and choose Icon only. Click Advanced to open the Icon Placement dialog.
- Click the When to Scale drop-down and choose Always, then click the Scale drop-down and choose Proportionally. Select the Fit to Bounds check box and click OK.
- On the Actions tab, click the Select Trigger drop-down and choose Mouse Up, then click the Select Action dropdown and choose Run a JavaScript. Click Add.
- In the JavaScript Editor, type this code: event.target.buttonImportIcon(); and click OK.
- Click Close in the Button Properties dialog and save your document.
- To insert an image,click the button to open the Select Icon dialog. Click Browse to locate and select a PDF document to load into the Sample area.
- Click OK to close the dialog and insert the image in the button.
11 comments
Comments for this tutorial are now closed.
Guy Damato
8, 2015-09-18 18, 2015We populate the PDF form using a look up table, the table has a path to an image that is associated with it. I can get the path to the image, but cannot figure out how to import that image into the PDF Form. Everything else works beautifully.
thanks for your time
Lori Kassuba
6, 2015-09-15 15, 2015Hi Rijivan,
Try posting your question here and be sure to select the JavaScript category so our experts can help you with your question:
https://answers.acrobatusers.com/AskQuestion.aspx
Thanks,
Lori
Rijivan
7, 2015-09-14 14, 2015I need to insert an attachment in PDF Forms but it could validate the file size after that attach which one below 250KB.
Lori Kassuba
3, 2015-04-02 02, 2015Hi Kevin,
This tutorial explains how to create a button that makes a new page:
https://acrobatusers.com/tutorials/how-to-build-a-button-that-creates-a-new-page
Thanks,
Lori
Kevin
1, 2015-03-27 27, 2015Can you use a button to duplicate and add a form page? We want a button that will allow the user to add a product by creating an additional fillable form. I know i can have additional pages created and then navigate via bookmarks but when we print the form it will print every page (16 pages). Also can a “allowing printing” button be created?
Lori Kassuba
7, 2015-02-16 16, 2015Hi DDennis,
Make sure you’re opening your PDF in the Adobe PDF browser plugin. You can find more details on this here:
http://blogs.adobe.com/acrobat/getting-the-best-pdf-browser-experience-by-using-adobe-pdf-add-ons/
Thanks,
Lori
Lori Kassuba
7, 2015-02-16 16, 2015Hi George - thanks for clarifying the details on how it works.
Lori
DDennis Davis
12, 2015-02-16 16, 2015how do you open a pdf file so you can print it out, using adobe reader off an e-mail.
THANKS DENNIS
George Johnson
12, 2015-02-15 15, 2015Note that this doesn’t embed a PDF file, but rather a flattened version of a page from a PDF.
If used with Acrobat, it can be anything that Acrobat knows how to convert to PDF, but still just a single page. This includes most image formats. Unfortunately, Reader isn’t currently capable of importing images using this JavaScript method, but it is relatively easy to convert images to PDF these days.
Lori Kassuba
7, 2015-02-13 13, 2015Hi Donna Mobley,
In order for this to work, end-users must be using Reader XI (not earlier versions).
Thanks,
Lori
Donna Mobley
12, 2015-02-12 12, 2015Still cannot get pdf file open.
Ahmed Naufal
10, 2014-12-11 11, 2014Thank you,it was really good.
Lori Kassuba
9, 2014-10-09 09, 2014Hi abu nahasapeenapetulan,
Thanks for letting us know how you resolved this.
Lori
abu nahasapeenapetulan
10, 2014-10-07 07, 2014Thanks for replying Lori - I should have posted that this was resolved. It was a fluke how I found the resolution as I made the same mistake the end user did. Apparently when you open the PDF in Mac using “Preview” it somehow corrupts the pdf, not allowing any scripts to run. Once I re-saved the file in acrobat with a different name and ensured that it was opened in Adobe Reader XI, it worked just fine, for both myself and the end user.
Lori Kassuba
10, 2014-10-07 07, 2014Hi Abe,
Are you very sure they’re using Reader XI? Do they have JavaScript turned on in Reader (Preferences)?
Lori
Abe
4, 2014-10-01 01, 2014Hello.
I have recently added a button like this and am ok having it upload a pdf file. I created this form in Adobe Acrobat XI on a Mac and it works great when I use it in Reader. However, when I sent the PDF document to someone else (also on a Mac and also using the latest version of Reader, it won’t work. the mouse turns into a hand, and when the user clicks, the box area becomes shaded, but no pop-up box allowing them to browse for the file to upload. Computer has been rebooted. Any thoughts?
Lori Kassuba
2, 2014-09-29 29, 2014Hi Katherine,
Check out this article for more information on how to do this for non-PDF files:
http://alltamedia.com/2014/06/09/how-to-add-attachments-to-a-pdf-form/
Thanks,
Lori
Katherine
12, 2014-09-27 27, 2014How to create a image field where you can insert an image file instead of a PDF? Thanks
Jodi
6, 2014-08-05 05, 2014Nevermind, I figured it out…
// Get a reference to the button we want to populate
var f = getField(“IMAGE_BUTTON”);
// Prompt the user to import an image
f.buttonImportIcon();
Jodi Stammer
6, 2014-08-05 05, 2014Is there a way to have a button load a PDF in another area instead of having the area itself being the button?
Lori Kassuba
5, 2014-07-15 15, 2014Hi luv,
As mentioned in the tutorial description, for this to work in Reader you specifically need version XI.
Thanks,
Lori
luv
9, 2014-07-11 11, 2014This code just works when I open my form in acrobat, not in adobe reader. Did I miss something?
JRB
2, 2014-06-09 09, 2014Beware: unlike “real” attachments, a PDF embedded as an icon in a button is not exported with other data when the form is submitted.
Lori Kassuba
2, 2014-06-06 06, 2014Hi Charles Khondowe,
This session can help you get started using JavaScript in PDF forms:
https://acrobatusers.com/tutorials/using-acrobat-javascript-with-forms
Thanks,
Lori
Charles Khondowe
11, 2014-06-05 05, 2014Excellent, I wonder if you can give me a link where I can start learning
Adobe javascript
Lori Kassuba
1, 2014-05-23 23, 2014Hi Derek,
Glad you found the tutorial helpful. You make a great suggestion about other file formats, which you can feel free to post here:
https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform
Thanks,
Lori
Derek
11, 2014-05-20 20, 2014An excellent facility, very clearly described. I just wish I could insert JPGs rather than PDFs!
Comments for this tutorial are now closed.