How to Create a Custom Stamp That Displays the File Name in Adobe Acrobat
Question details
The user needs to create a dynamic custom stamp in Adobe Acrobat that automatically retrieves and displays the current PDF's file name, excluding the .pdf extension.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Setting up a dynamic text field within a custom PDF stamp to automatically populate with the active document's file name when applied.
- Observed behavior
- Requires a JavaScript calculation script to dynamically extract the file name and strip the file extension during the stamp application process.
Ensure you are using Adobe Acrobat Pro or Standard, as the free Adobe Acrobat Reader does not support the creation and JavaScript configuration of dynamic stamps.
Add JavaScript to a Dynamic Stamp Text Field
Use this method to inject a custom JavaScript calculation script into your stamp's text field, allowing it to dynamically pull the file name when placed.
To make a stamp dynamic, you must create a standard custom stamp first, locate its background PDF file in your system's Adobe app data folder, and then add a text field equipped with a calculation script.
In Adobe Acrobat, go to Tools > Stamp > Custom Stamps > Create. Select a PDF to act as your base stamp design and assign it to a category.
Navigate to the hidden Acrobat stamps folder on your computer (typically located at C:\Users\[YourUsername]\AppData\Roaming\Adobe\Acrobat\[Version]\Stamps on Windows) and open the newly generated PDF file.
Use the Prepare Form tool to add a new Text Field to the stamp where you want the file name to appear.
Right-click the text field, choose Properties, and navigate to the Calculate tab. Select 'Custom calculation script', click Edit, and paste the following code: event.value = event.source.source.documentFileName.replace(/\.pdf$/i, '');
Click OK, save the PDF document, and close it. Open a different PDF file and apply your new custom stamp to verify that the file name appears correctly without the .pdf extension.

Create Custom Stamps Easily with WPS Office
While Adobe Acrobat relies on complex JavaScript for dynamic stamps, WPS Office provides an intuitive PDF editor where you can easily create, manage, and apply custom text and image stamps without coding. It is a lightweight, fully compatible alternative for all your PDF and document needs.
- 1. Open your PDF in WPS Office: Launch WPS Office and open the PDF document you want to review or stamp.
- 2. Access the Stamp tool: Navigate to the 'Comment' tab on the top ribbon and click on the 'Stamp' icon.
- 3. Create a custom stamp: Click 'Click to Add' or choose 'Custom Stamp' to design your own stamp using custom text, images, or signature files.
- 4. Apply the stamp to your document: Select your newly created custom stamp from the dropdown menu and click anywhere on the PDF page to apply it instantly.

Frequently Asked Questions
Where does Adobe Acrobat save custom stamp files?
Acrobat saves custom stamps in a specific user directory. On Windows, it is typically located at C:\Users\[Username]\AppData\Roaming\Adobe\Acrobat\[Version]\Stamps. You must open the specific PDF file in this folder to add dynamic form fields.
Why isn't my dynamic stamp updating when I apply it?
If the stamp doesn't update dynamically, ensure that you placed the JavaScript in the 'Custom calculation script' area of the text field, not in the 'Validate' or 'Format' tabs. Additionally, make sure the text field is not set to Read Only before the calculation executes.
Can I use JavaScript to add the current date to an Acrobat stamp?
Yes. You can use a custom calculation script like event.value = util.printd('mm/dd/yyyy', new Date()); in a dynamic text field to automatically display the current date whenever the stamp is placed on a document.




