Fix a PDF Attachment That Won’t Open from an Acrobat JavaScript Button
Question details
The user needs an embedded PDF attachment to open when a JavaScript button is clicked in a PDF form.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- A PDF form uses JavaScript buttons and exportDataObject to open embedded attachments.
- Observed behavior
- An Excel attachment opens successfully, but an attached PDF does not open.
Open the form in Adobe Acrobat and make sure you trust the document and its attachments. Locate the button’s JavaScript and the PDF’s Attachments panel so you can compare the attachment name with the script.
Check the Embedded PDF Name and Acrobat JavaScript Console
Use this method to identify a missing attachment, a mismatched name, or an error reported when the button runs.
Open the PDF in Acrobat and select the paperclip or Attachments icon in the navigation pane. Confirm that the PDF file appears in the list.
In Acrobat’s form-editing tools, open the button’s properties and inspect its JavaScript action. Compare the exportDataObject cName value with the attachment name, including capitalization, spaces, and the .pdf extension.
Edit the button’s JavaScript so cName uses the exact embedded attachment name, then save the form. For example, an attachment named report.pdf requires cName: "report.pdf".
Open Acrobat’s JavaScript Console, click the button, and inspect any errors. On Windows, press Ctrl+J to open the console.
In the Attachments panel, select the PDF attachment and try opening it. If Acrobat displays a security warning or blocks the file, follow your organization’s security guidance rather than bypassing the restriction.

View PDFs and Work with Office Files in WPS Office
WPS Office is a free, lightweight alternative for viewing PDFs and working with Office files in a familiar interface. Its Microsoft Office format support makes moving everyday documents easier. It does not fix Acrobat JavaScript errors, and embedded attachment button behavior may differ.

Frequently Asked Questions
How do I check whether the PDF is actually embedded?
Open the form in Acrobat and select the paperclip or Attachments icon in the navigation pane. The embedded PDF should appear in the attachment list.
Does the cName value need to match the attachment name exactly?
Yes. Compare cName in the button’s exportDataObject call with the name shown in the Attachments panel, including capitalization, spaces, and the file extension.
Where can I see errors from the button’s JavaScript?
Open Acrobat’s JavaScript Console and click the button. On Windows, press Ctrl+J to open the console, then look for an error message related to the action.
What if the attachment name is correct but the PDF still won’t open?
Try opening the file directly from Acrobat’s Attachments panel and check the JavaScript Console. A security warning, attachment restriction, or another script error may explain why the button does not open it.




