PDF Opening Issues

Fix a PDF Attachment That Won’t Open from an Acrobat JavaScript Button

Camila MilosovichCamila Milosovich Nov 24, 2026 869 views

Question details

The user needs an embedded PDF attachment to open when a JavaScript button is clicked in a PDF form.

Fix a PDF Attachment That Won’t Open from an Acrobat JavaScript Button
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.
Before you start

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.

Solution 1Recommended

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.

1
Find the attachment

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.

2
Compare the exact name

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.

3
Correct the script

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".

4
Check the console

Open Acrobat’s JavaScript Console, click the button, and inspect any errors. On Windows, press Ctrl+J to open the console.

5
Test the attachment directly

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.

Check the Embedded PDF Name and Acrobat JavaScript Console
Opening an Excel file does not verify the PDF button: Each button can reference a different attachment name, and Acrobat may handle file types or security prompts differently.
Free Microsoft Office alternative

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.

View PDF documents alongside your other office filesOpen and edit compatible Microsoft Word, Excel, and PowerPoint formatsUse a familiar interface to make switching from Microsoft Office easierWork with a free, lightweight office suite
microsoft office alternative - wps office

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.