How to Automate Custom Stamps with Acrobat JavaScript
Question details
The user wants to know if a menu item or folder-level JavaScript can be programmed to automatically trigger a specific custom stamp workflow in Adobe Acrobat.

- Product
- Adobe Acrobat
- Device & OS
- not provided
- Scenario
- Developing an automated PDF workflow where users need to apply specific custom stamps without navigating through the standard interface menus.
- Observed behavior
- Attempting to find a JavaScript command that activates the stamp-selection tool directly, rather than relying on manual user clicks.
Acrobat's JavaScript API imposes security restrictions that prevent scripts from directly activating certain user interface tools, including the manual stamp placement cursor. Ensure you have access to Acrobat Pro to create and test folder-level scripts or dynamic stamps.
Place the Stamp at Predefined Coordinates via Script
While you cannot activate the interactive stamp tool cursor via script, you can use JavaScript to automatically insert a custom stamp at a fixed location on the page.
This workaround programmatically adds an annotation of type 'Stamp' to the document using coordinates. Once the script applies the stamp to the page, the user can manually reposition it.
Navigate to 'Tools' > 'JavaScript' and select 'Document JavaScripts' or open the JavaScript Debugger to input your script.
Use the 'addAnnot' method to create a new stamp annotation. Define the 'type' as 'Stamp', set the 'page' number, and provide the 'rect' coordinates where the stamp should appear.
Specify the 'AP' property of the annotation to match the internal name of your specific custom stamp so the correct graphic is rendered.
Run the script via a custom menu item or button. The stamp will appear at the predefined location, and you can click and drag it to your desired final position.

Embed JavaScript into a Dynamic Custom Stamp
Instead of using a script to place the stamp, you can attach JavaScript to the stamp itself so that it collects data via a dialog immediately upon manual placement.
Need a Simpler Way to Manage PDFs and Documents? Try WPS Office
While advanced JavaScript automation in Adobe Acrobat can be highly complex, WPS Office provides a lightweight, intuitive, and highly compatible alternative for everyday PDF editing and Office document tasks. Manage stamps, edit PDF text, and handle formats easily without writing code.
- 1. Open your PDF: Launch WPS Office and open your PDF document using the built-in PDF editor.
- 2. Access the Stamp Tool: Navigate to the 'Comment' tab on the top ribbon and click on 'Stamp'.
- 3. Apply or Create Stamps: Choose from a library of predefined stamps or click 'Click to Add' to import your own custom stamp image instantly.

Frequently Asked Questions
Why can't JavaScript activate the stamp tool directly in Acrobat?
Acrobat's JavaScript API restricts certain user interface commands for security and operational reasons. Because the stamp tool requires interactive mouse input to determine placement coordinates, a script cannot invoke the tool cursor directly for a specific custom stamp.
What is a dynamic stamp in PDF editing?
A dynamic stamp is a special custom stamp that contains embedded JavaScript. When placed on a document, this script automatically runs to update elements like the current date and time, or it can open a dialog box asking the user to enter custom text that will appear on the stamp.
How do I move a stamp that was placed by a script?
Once a script inserts a stamp at a predefined location on your page, it behaves like any standard annotation. You can simply select it with your mouse and drag it to any other location on the document.
Can I add a custom stamp without using any programming code?
Yes. You can easily add custom stamps manually by navigating to the Stamp tool menu, selecting 'Custom Stamps', and uploading an image or PDF. You only need JavaScript if you want to automate the data inside the stamp or control its automatic placement.




