How to Create a PDF Form File Name from First and Last Name Fields
Question details
The user wants to automatically generate a PDF file name using the entered "First Name" and "Last Name" fields upon form submission.

- Product
- PDF Forms
- Device & OS
- not provided
- Scenario
- Submitting a completed PDF form and needing the resulting file to be automatically named based on the user-entered data.
- Observed behavior
- Standard PDF editors do not have a built-in feature to automatically rename submitted PDFs using form field values when using a standard mail submission button.
Determine whether your PDF form will be used internally within a controlled environment or distributed publicly, as this dictates the type of scripting solution you will need to implement.
Use a Server-Side Script for Public Form Distribution
The most reliable method for forms distributed to the general public is routing the submission through a server-side script to handle the renaming process.
By submitting the form data to a web server instead of directly emailing it via a mailto link, a server-side script (such as PHP, Python, or Node.js) can capture the specific field values, rename the PDF accordingly, and then email or store the file safely.
Create a script on your web hosting server designed to receive PDF form data, parse the incoming file, and extract specific field values.
In your PDF editor's form preparation mode, set the form's 'Submit' button action to route to the URL of your server-side script instead of an email address.
Program the server script to concatenate the first and last name fields into a single string, save the incoming PDF with this new string as the filename, and forward it to your desired email inbox.

Implement a Folder-Level Script for Internal Systems
If you control all the computers where the PDF will be filled out, you can use a local folder-level script to save the form under a new name before submission.
Fill and Rename PDF Forms Easily with WPS Office
While fully automating file names requires complex server scripts, WPS PDF provides an intuitive interface to fill form fields and quickly save your document with a custom name without any coding.
- 1. Open the PDF Form: Launch WPS Office and open your interactive PDF form document.
- 2. Fill the Form Fields: Click on the form fields and type the necessary information into the 'First Name' and 'Last Name' sections.
- 3. Use the Save As Feature: Click on 'Menu' in the top-left corner of the WPS PDF interface and select 'Save As' from the dropdown list.
- 4. Rename and Save: In the dialog box, manually type the first and last name as your new file name, select your destination folder, and click 'Save'.
- 5. Share the Document: Use the built-in 'Share' or email feature in WPS Office to send the newly named PDF directly to the recipient.

Frequently Asked Questions
Why doesn't the standard email submit button rename my PDF?
Standard PDF viewers use the original filename by default when attaching a form to an email via a simple 'mailto:' submit action. They do not have built-in functionality to parse form fields and rename the file dynamically without advanced scripting.
Can I use standard document-level JavaScript inside the PDF to rename the file?
Document-level JavaScript cannot typically save or rename a file due to strict security restrictions in PDF readers. You must use a 'trusted' folder-level script installed directly on the local machine, which is why it only works in controlled internal environments.
Does automated form naming work on mobile PDF viewers?
Native automated renaming via local scripts does not work on most mobile viewers due to app security sandboxing. However, using a server-side script to handle the submission and renaming works across all devices, including mobile.




