Fix an Acrobat Add PDF Button That Does Not Open a File Picker
Question details
The user needs an Acrobat JavaScript dialog's Add PDF button to open a file picker and attach a selected PDF.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A custom Acrobat JavaScript dialog includes a button for selecting and attaching a PDF.
- Observed behavior
- Clicking Add PDF does not open a file selection dialog.
Open the PDF and the JavaScript code that defines the dialog in Acrobat. Check Acrobat's JavaScript preferences and note any error displayed when you click Add PDF.
Isolate the Acrobat button, file picker, and attachment code
Use this approach to identify which part of the dialog workflow prevents the file picker or attachment from working.
Open Acrobat's JavaScript console with Ctrl+J on Windows or Command+J on macOS, then click Add PDF and review any messages in the console.
Inspect the dialog definition and its Add PDF event handler. Add a temporary console.println() message to the handler, reopen the dialog, and click the button to see whether the message appears.
In the JavaScript console, test app.browseForDoc() independently of the dialog and attachment code. Check whether a file picker opens or Acrobat reports an error.
Once file selection works, test the attachment or annotation creation code independently with a known PDF. Check the console for errors and confirm the selected file information is passed to that code.
Place the working selection and attachment code in the appropriate button event handler, reopen the dialog, and click Add PDF to test the complete workflow.

Work with PDFs and Office files in WPS Office
WPS Office is a free, lightweight alternative for everyday PDF and Office work, with a familiar interface and support for common Microsoft Office formats to ease migration. It does not fix Acrobat-specific JavaScript dialog or button errors.

Frequently Asked Questions
How can I tell whether the Add PDF button event is firing?
Add a temporary console.println() statement to the button's event handler, open the JavaScript console, and click Add PDF. If the message does not appear, inspect the dialog's button event definition.
What should I do if app.browseForDoc() works in the console but not in the dialog?
Check the console for errors after clicking the button, then review the handler and the execution-context and security requirements for app.browseForDoc() in Acrobat's JavaScript documentation.
Why test attachment creation separately from file selection?
A separate test helps determine whether the problem is opening the picker, passing the selected file information, or creating the attachment or annotation. Review the JavaScript console after each test.
Can WPS Office repair an Acrobat JavaScript button?
No. The button and its JavaScript run in Acrobat, so troubleshoot them in Acrobat. WPS Office can be used separately for everyday PDF and Office document work.




