PDF Editing Issues

Save an Adobe Acrobat PDF with Read-Only Form Fields

Elise WilliamsElise Williams Nov 19, 2026 868 views

Question details

The user needs a button script to save a renamed PDF with its form fields set to read-only.

Save an Adobe Acrobat PDF with Read-Only Form Fields
Product
Adobe Acrobat
Device & OS
not provided
Scenario
A PDF button uses form field values to determine the name of the saved file.
Observed behavior
The form fields become editable again when the saved PDF is reopened.
Before you start

Open the PDF in Adobe Acrobat and locate the button's existing JavaScript action. Identify where the script builds the file name and calls saveAs.

Solution 1Recommended

Set all form fields to read-only before saving

Update the button script so the saved copy includes the read-only field properties.

1
Open the button action

In Acrobat, open Prepare a Form, select the button, and open its Properties. On the Actions tab, edit the existing JavaScript action.

2
Add the read-only loop

After the script obtains the field values needed for the file name, but before its saveAs call, add: for (var i = 0; i < this.numFields; i++) { var field = this.getField(this.getNthFieldName(i)); if (field) field.readonly = true; }

3
Save after applying the properties

Keep the existing saveAs call after the loop, then close the JavaScript editor and save the PDF. The save operation must run after the read-only properties are set.

4
Test the saved copy

Click the button, close the document, and reopen the newly saved file. Try entering text in several fields to confirm they remain read-only.

Set all form fields to read-only before saving
Saving and security: Acrobat may restrict scripted saveAs operations depending on the execution context and security permissions. Read-only fields prevent ordinary editing but are not a security measure against someone who can change the form properties.
Free Microsoft Office alternative

Work with PDFs and Office files in WPS Office

WPS Office is a free, lightweight alternative with a familiar interface for working with PDFs and Office documents. Its format compatibility makes it easy to bring existing files into your workflow. It does not fix Acrobat button scripts or their save permissions.

Open and review PDFs alongside other documentsCompatible with Microsoft Word, Excel, and PowerPoint formats, including DOCX, XLSX, and PPTXFamiliar interface for a smoother transition from Microsoft OfficeFree, lightweight office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why are my fields editable after I reopen the saved PDF?

The script may be setting the read-only properties after saveAs runs. In the button's JavaScript action, place the read-only loop before the saveAs call and test the newly saved copy.

How does the script find every form field?

Use this.numFields to iterate through the fields, this.getNthFieldName(i) to get each name, and this.getField(name) to retrieve the field before setting its readonly property.

Why does saveAs fail from my Acrobat button?

Scripted saveAs operations can be restricted by Acrobat security. Check whether the save operation is allowed in the script's execution context and whether the destination path and permissions are valid.

Does making a field read-only secure its contents?

No. The read-only property prevents normal form editing, but someone with permission to edit the form can change that property. Use appropriate PDF security controls if stronger protection is needed.