PDF Editing Issues

Hide an Acrobat PDF Action Button After Saving Under a New Name

Rana GarciaRana Garcia Nov 19, 2026 868 views

Question details

Hide an Acrobat form action button in a renamed copy while keeping it visible in the original PDF template.

Hide an Acrobat PDF Action Button After Saving Under a New Name
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A user completes a PDF form and saves it under a different file name.
Observed behavior
The button should disappear in the renamed copy but remain visible in the original template.
Before you start

Confirm the exact original PDF file name and the button's form field name in Acrobat's Prepare a Form tool. Make sure JavaScript is enabled in the Acrobat or Reader settings used to test the form.

Solution 1Recommended

Hide the button with an Acrobat Did Save script

Use a document action to compare the saved PDF's name with the template name and hide the button in renamed copies.

1
Check the button field name

Open the template in Acrobat and select Tools > Prepare a Form. Select the button and check its exact field name in its properties.

2
Open document actions

Go to Tools > JavaScript > Set Document Actions and select the Did Save action.

3
Add the script

Enter the following code, replacing Button1 with the exact field name and MyDoc.pdf with the original template file name, including its extension: var f = this.getField("Button1"); if (f && this.documentFileName !== "MyDoc.pdf") { f.display = display.hidden; }

4
Save and test the template

Save the template with its original name. Complete a test copy, choose File > Save As, and give it a different name. The Did Save action should hide the button after the first save.

5
Save the renamed copy again

Choose File > Save again to store the changed field visibility, then close and reopen the renamed PDF to check the result.

Hide the button with an Acrobat Did Save script
File names are not security controls: Users can rename or edit PDFs, so this check should not be used to protect sensitive information or enforce access restrictions. JavaScript behavior also depends on the PDF viewer and its settings.
Free Microsoft Office alternative

Work with PDFs and Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface and support for common Office formats, making it easier to move existing files into your workflow. Use Acrobat for the document actions and JavaScript configuration described above.

Open and work with PDFs alongside other documentsCompatible with Microsoft Word, Excel, and PowerPoint formatsFamiliar interface for a smoother transition from Microsoft OfficeFree, lightweight suite for everyday document work
microsoft office alternative - wps office

Frequently Asked Questions

Why do I need to save the renamed PDF twice?

The Did Save action changes the button's visibility after the first save. Choose File > Save again to store that change in the renamed PDF.

How do I find the button's exact field name?

In Acrobat, open Tools > Prepare a Form, select the button, and check its field properties. Use that exact name in this.getField().

Can the button be hidden when someone opens a renamed copy?

Yes. Add the filename check under Tools > JavaScript > Document JavaScripts. Keep the Did Save action as well if the button should also disappear immediately after Save As.

Is checking the file name a secure way to restrict access?

No. A user can rename or edit the PDF, and a viewer may not run the JavaScript. Use appropriate access controls instead of relying on button visibility.