How to Create a PDF Filename from Form Field Values in Acrobat
Question details
The user wants to save a completed PDF form with an automatically generated filename derived from specific form field values.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Dynamically saving completed PDF forms based on user input to streamline document management.
- Observed behavior
- The goal is to automatically extract data from fields (like first name, last name, and ID) and use that data to construct the target filename when saving the PDF.
Ensure you have permission to edit the PDF form and possess basic familiarity with Adobe Acrobat's JavaScript functionalities and security settings.
Use Acrobat JavaScript to Construct and Save the Filename
Utilize Acrobat's JavaScript API to extract field values and execute a save action using trusted functions.
To save a file dynamically based on form data, you must use Acrobat JavaScript. Because saving files silently poses inherent security risks, Adobe requires such scripts to be executed in a privileged context. This typically requires setting up a folder-level script or properly configuring trust properties.
Open your PDF in Acrobat's form editing mode. Assign a JavaScript action to a 'Save' button that retrieves the required values using the syntax: var firstName = this.getField('FirstName').value;
Concatenate the retrieved variables into a single string to form your desired file path and name. For example: var newName = '/C/MyFolder/' + firstName + '_' + lastName + '.pdf';
Because standard document-level scripts cannot execute silent saves, you must create a trusted folder-level script using app.trustedFunction. Place this script in Acrobat's privileged JavaScript folder to allow the this.saveAs() method to execute without security blocks.

Easily Manage and Save PDF Forms with WPS Office
While advanced JavaScript automation requires complex folder-level scripting, WPS Office provides a highly intuitive PDF editor allowing you to fill, manage, and export form data with incredible ease.
- 1. Open the PDF Form: Launch WPS Office and open your PDF document containing the interactive form fields.
- 2. Fill the Form Data: Click directly on the fields to input your specific data, such as first name, last name, and identification number.
- 3. Save with a Custom Name: Navigate to Menu > Save As, and manually name the file using your key input data to keep your records perfectly organized.

Frequently Asked Questions
Can I use document-level JavaScript to save a PDF without prompting the user?
No, for security reasons, modern PDF readers restrict silent saving from within the document itself. You must use a folder-level script with trusted functions to safely bypass the standard 'Save As' dialogue.
What is a folder-level script in Acrobat?
A folder-level script is a JavaScript file (.js) placed in a specific privileged application directory on the user's local machine, allowing it to execute higher-level security functions like saving files directly to the file system.
Why doesn't my JavaScript Save button work in other PDF readers?
Advanced JavaScript functions like this.saveAs() and trusted privilege configurations are specific to Adobe Acrobat's engine and are generally not supported by third-party PDF viewers due to distinct security architectures.




