How to Allow File Attachments in an Acrobat PDF Form
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.

- 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.
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.
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.
Open your PDF file in Adobe Acrobat 2017, click on 'Tools' in the upper ribbon, and select 'Prepare Form'.
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').
Right-click the newly created button, select 'Properties...', and navigate to the 'Actions' tab.
Under the 'Select Action' dropdown menu, choose 'Run a JavaScript', and then click the 'Add...' button.
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.

Instruct Users to Attach Files via Commenting Tools
A simpler alternative that avoids coding by asking respondents to use the built-in attachment features in their PDF reader.
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. Open your PDF: Launch WPS Office and open the PDF form or document you need to work on.
- 2. Navigate to the Insert Tab: Click on the 'Insert' or 'Comment' tab located in the top menu ribbon.
- 3. Select the Attachment Tool: Click the 'Attachment' icon (represented by a paperclip).
- 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.

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.




