PDF Editing Issues

How to Allow File Attachments in an Acrobat PDF Form

Olivia MillerOlivia Miller Oct 28, 2026 869 views

Question details

The user wants to configure an existing interactive PDF form to allow respondents to upload and embed file attachments while filling it out.

How to Allow File Attachments in an Acrobat PDF Form
Product
Adobe Acrobat 2017
Device & OS
not provided
Scenario
Creating an interactive PDF form designed to collect supporting documents from users filling out the file.
Observed behavior
Needs a method, such as a clickable button or a straightforward tool, to enable users to attach files directly onto the PDF file.
Before you start

Ensure you are using Adobe Acrobat Pro or Standard to edit the form, as the free Adobe Acrobat Reader does not include the tools required to create form fields or add JavaScript actions.

Solution 1Recommended

Add an Attachment Button Using JavaScript

This method creates a clear, user-friendly button on the form that prompts the user to select and attach a file automatically when clicked.

By binding a JavaScript action to a custom button, you avoid relying on users figuring out the comment tools themselves.

When the user clicks the button, the script will generate a file attachment annotation right next to the button's location.

1
Enter Prepare Form Mode

Open your PDF file in Adobe Acrobat 2017, click on 'Tools' in the upper ribbon, and select 'Prepare Form'.

2
Insert a Button Field

Select the 'Add a Button' icon from the top toolbar, then click on the document where you want the button to appear. Name the button clearly (e.g., 'Attach File').

3
Access Button Properties

Right-click the newly created button, select 'Properties...', and navigate to the 'Actions' tab.

4
Add JavaScript Action

Under the 'Select Action' dropdown menu, choose 'Run a JavaScript', and then click the 'Add...' button.

5
Insert the Attachment Script

In the JavaScript Editor, paste the following code to trigger an attachment annotation: var midPos = (event.target.rect[1] + event.target.rect[3]) / 2; this.addAnnot({type: "FileAttachment", page: event.target.page, point: [event.target.rect[2] + 20, midPos]}); Click 'OK' and close the properties panel.

Add an Attachment Button Using JavaScript
Tested the Button: Exit 'Prepare Form' mode by clicking 'Preview' or 'Close'. Click your new button to verify that it successfully opens the 'Add Attachment' dialog.

Easily Manage PDF Attachments and Forms with WPS Office

WPS Office offers a comprehensive, user-friendly PDF editor that allows you to view, edit, fill forms, and manage file attachments seamlessly. It provides an excellent, cost-effective alternative for handling daily PDF tasks.

  1. 1. Open your PDF: Launch WPS Office and open the PDF form or document you need to work on.
  2. 2. Navigate to the Insert Tab: Click on the 'Insert' or 'Comment' tab located in the top menu ribbon.
  3. 3. Select the Attachment Tool: Click the 'Attachment' icon (represented by a paperclip).
  4. 4. Embed Your File: Click on the area of the page where you want the attachment to appear, browse for your desired file, and hit 'Open' to embed it.
Instantly add, read, and extract embedded file attachments in your PDF documents.Fully compatible with standard Adobe Acrobat PDF formats and interactive forms.Lightweight, fast, and equipped with a full suite of office tools.Free to use for everyday document creation, conversion, and editing tasks.
microsoft office alternative - wps office

Frequently Asked Questions

Will users need a paid version of Adobe Acrobat to attach files using the JavaScript button?

No. Once the JavaScript button is configured in Acrobat Pro or Standard by the creator, end users can utilize the free Adobe Acrobat Reader to click the button and attach their files to the form.

Why does nothing happen when users click the attachment button?

If nothing happens, the user's PDF viewer might have JavaScript disabled for security reasons, or they are using a basic browser-based PDF viewer (like Chrome or Edge's built-in reader) that does not support interactive PDF JavaScript commands.

What types of files can be attached to a PDF form?

Users can typically attach almost any file type, including Word documents, Excel sheets, and images. However, certain potentially malicious formats, such as executable files (.exe) or scripts (.bat), may be blocked by the PDF reader for security purposes.

Can I hide the attachment button before printing?

Yes. Right-click the button, select 'Properties', go to the 'General' tab, and change 'Form Field' property under 'Common Properties' from 'Visible' to 'Visible but doesn't print'. This ensures the button won't appear on paper.