PDF Editing Issues

How to Create a Custom Stamp That Displays the File Name in Adobe Acrobat

Bushra ParveenBushra Parveen Nov 24, 2026 869 views

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.

How to Create a Custom Stamp That Displays the File Name in Adobe Acrobat
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.
Before you start

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.

Solution 1Recommended

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.

1
Create the base custom stamp

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.

2
Locate the stamp file

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.

3
Add a text field

Use the Prepare Form tool to add a new Text Field to the stamp where you want the file name to appear.

4
Apply the calculation script

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, '');

5
Save and test the stamp

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.

Add JavaScript to a Dynamic Stamp Text Field
JavaScript Execution: The property event.source.source refers to the target document where the stamp is being placed. If testing within the stamp file itself, the script may return an error or blank value until it is actually applied to a new document.
Efficient PDF Management

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. 1. Open your PDF in WPS Office: Launch WPS Office and open the PDF document you want to review or stamp.
  2. 2. Access the Stamp tool: Navigate to the 'Comment' tab on the top ribbon and click on the 'Stamp' icon.
  3. 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. 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.
Easily insert preset or custom text and image stamps into any PDF document.Fully compatible with Adobe PDF formats and Microsoft Office files.Lightweight software with an intuitive, familiar user interface.Comprehensive PDF reading, editing, and annotation tools.
microsoft office alternative - wps office

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.