How to Prevent Adobe Acrobat Dynamic Stamp Scripts from Running Twice
Question details
The user wants to stop custom Acrobat dynamic stamp JavaScript prompts from executing multiple times before the stamp is actually placed on the document.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Using a custom dynamic stamp with JavaScript prompts in a PDF document.
- Observed behavior
- The JavaScript prompt appears twice before stamp placement, and the stamp sometimes fails to appear on scanned documents on the first attempt.
Ensure you have access to the original dynamic stamp PDF file and are familiar with locating the document-level JavaScript editor within Adobe Acrobat's Tools menu.
Qualify the JavaScript to Run Only Upon Stamp Placement
Modify your dynamic stamp script to ensure input dialogs only execute when the stamp is being physically applied to the page, avoiding triggers during menu previews.
Dynamic stamp scripts in Acrobat are inherently triggered multiple times: when the stamp menu is opened (to generate thumbnails), when the stamp is previewed, and when it is finally placed on the document. By wrapping your prompt in an event qualification, you can restrict the execution to the final placement phase only.
Locate and open the specific PDF file containing your custom dynamic stamp in Adobe Acrobat.
Navigate to Tools > JavaScript > Document JavaScripts to locate the script attached to your stamp.
Wrap your prompt or dialog box code within an 'if (event.source.forReal)' conditional statement.
Save the changes to your stamp file, open a new PDF document, and test the stamp to confirm the prompt only appears once.
Verify Stamp Requirements and Field Formatting
Ensure the stamp template complies with Acrobat's strict dynamic stamp formatting rules to prevent rendering failures on scanned documents.
Use WPS Office to Easily Apply Custom Stamps to PDFs
If managing complex JavaScript in Acrobat dynamic stamps is too cumbersome, you can use WPS Office to quickly create, manage, and apply custom stamps to your PDF documents without scripting errors.
- 1. Open Your PDF: Launch WPS Office and open the PDF document you wish to review.
- 2. Navigate to the Comment Tab: Select the 'Comment' tab located on the top navigation ribbon.
- 3. Select the Stamp Tool: Click on the 'Stamp' icon and choose 'Custom Stamp' from the dropdown menu.
- 4. Place Your Custom Stamp: Upload your custom image or select a pre-made text stamp, then click anywhere on your document to place it instantly.

Frequently Asked Questions
Why does my Acrobat dynamic stamp prompt for input twice?
Acrobat triggers document-level scripts during multiple phases, such as when generating the stamp preview in the menu and when actually placing the stamp. If the script isn't properly qualified, the prompt runs in both phases.
How do I stop stamp preview dialogs from opening in Acrobat?
You can prevent preview dialogs by wrapping your interactive JavaScript code inside an 'if (event.source.forReal)' block. This ensures the dialog only triggers during actual placement.
Why does my custom stamp fail to appear on scanned PDFs?
Scanned documents can sometimes be large or complex, causing rendering delays in Acrobat. Ensuring your script is error-free, avoiding heavy calculations, and optimizing the scanned PDF before stamping can help resolve this.




