Can Acrobat Rename a PDF Attachment from Form Fields?
Question details
The user is looking to automatically rename a submitted PDF attachment using data extracted from the document's form fields via JavaScript.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Submitting a completed PDF form as an email attachment.
- Observed behavior
- The creator wants the attached PDF to have a dynamic filename generated from field values, but Acrobat's JavaScript engine restricts direct file renaming during the email submission process.
Verify that your PDF form fields are functioning correctly and that you have basic knowledge of Adobe Acrobat's JavaScript console before attempting to modify submission behaviors.
Prompt Users to Save the PDF with a Specific Name Before Submission
Since JavaScript cannot directly rename the file during submission due to security restrictions, the best approach is to prompt the user to manually save the file with the desired name.
By enforcing a naming convention before the email submission triggers, you can guarantee the attachment arrives with the correct filename without needing complex local scripts.
Open your PDF form in Adobe Acrobat and navigate to the 'Prepare Form' tool from the right-hand pane.
Right-click your email submission button, select 'Properties', and then navigate to the 'Actions' tab.
Add a 'Run a JavaScript' action and input a script that checks the document's current filename against your required format.
If the filename is incorrect, use the app.alert function to instruct the user to go to 'File' > 'Save As' and manually rename the file using the required form field values.
Ensure your script prevents the actual email submission function from executing until the filename matches your required condition.

Use a Trusted Folder-Level Script to Save a Copy
If you have control over the users' machines, you can install a trusted script locally that allows the PDF to save a copy under a new name.
Fill and Manage PDF Forms Efficiently with WPS Office
While complex JavaScript workarounds are sometimes needed for specific submission workflows in Acrobat, WPS Office offers a highly intuitive, lightweight, and efficient PDF editor for filling out forms, adding signatures, and easily sharing documents via email.
- 1. Open WPS PDF: Open WPS Office and navigate to the 'PDF' tab to view your document.
- 2. Fill the Form: Open your PDF form and click on the highlighted interactive fields to type your information.
- 3. Save with Custom Name: Go to 'Menu' > 'Save As' to manually save the document with your desired filename based on your data.
- 4. Share via Email: Click the 'Email' button on the top toolbar to quickly send your completed and renamed form as an attachment.

Frequently Asked Questions
Can JavaScript change the email subject line in a PDF form submission?
Yes, you can use the mailDoc or submitForm JavaScript functions in Acrobat to dynamically populate the email subject line and body text using values extracted from the form fields.
Why does Adobe Acrobat prevent scripts from renaming files?
Adobe implemented strict security sandboxing to prevent malicious PDF files from silently creating, renaming, or deleting files on a user's local hard drive without explicit permission.
Is it possible to force a PDF form to submit as an XML data file instead of a full PDF?
Yes, you can configure the submit button properties in Acrobat to send only the form data (such as FDF, XFDF, XML, or HTML) instead of the complete PDF document, which results in a much smaller email attachment.




