PDF Editing Issues

How to Batch Replace Custom PDF Stamps with an Acrobat Script

Huma Ashraf ChHuma Ashraf Ch Nov 3, 2026 869 views

Question details

The user needs a method to batch replace the appearance of custom stamps across thousands of PDF files using an Acrobat JavaScript while preserving the original size and location.

How to Batch Replace Custom PDF Stamps with an Acrobat Script
Product
Adobe Acrobat Pro
Device & OS
not provided
Scenario
Updating outdated or incorrect stamp graphics (e.g., changing 'Approved' to 'Not Approved') on a large volume of PDF documents simultaneously.
Observed behavior
The user needs to programmatically scan for existing stamp annotations and modify their AP (appearance) property without altering their physical placement on the pages.
Before you start

Ensure you have Adobe Acrobat Pro installed, as standard versions do not support the Action Wizard required for batch processing scripts. Always create a secure backup of your PDF files before running bulk JavaScript operations.

Solution 1Recommended

Use JavaScript and the Action Wizard in Acrobat Pro

Execute a custom JavaScript using Acrobat Pro's Action Wizard to identify and replace the specific stamp appearance (AP property) across multiple files.

Acrobat JavaScript allows you to manipulate PDF annotations programmatically. By iterating through a document's annotations and locating the specific AP (appearance) property, you can replace the stamp graphic while keeping its original dimensions and coordinates untouched.

1
Find the Target Stamp's AP Value

Place the target stamp on a blank PDF page. Select the stamp with your cursor, open the JavaScript console (Ctrl+J on Windows or Cmd+J on Mac), type 'this.selectedAnnots[0].AP', and press Enter to retrieve its exact AP value.

2
Prepare the Replacement Script

Write a script utilizing the 'syncAnnotScan()' function to scan all annotations in the document. Create a loop that checks if an annotation's AP matches the old stamp (e.g., 'SBApproved') and replaces it with the new stamp's AP value (e.g., 'SBNotApproved').

3
Create a New Batch Action

Open Adobe Acrobat Pro, navigate to 'Tools' > 'Action Wizard', and click 'New Action'. Under 'More Tools', add the 'Execute JavaScript' tool to your action steps and paste your completed replacement script into the prompt.

4
Run the Action on Multiple Files

In the Action workflow, click 'Add Folder' to select the directory containing your thousands of PDFs. Click 'Start' to process the files and automatically update all custom stamps.

Use JavaScript and the Action Wizard in Acrobat Pro
Script Precision: Ensure the new stamp's AP value is already defined or loaded in your Acrobat environment so the script can reference the new appearance correctly.
Free Microsoft Office alternative

Manage PDFs and Documents with WPS Office

While running complex Acrobat JavaScripts requires an expensive Adobe subscription, WPS Office provides a lightweight, highly compatible, and free alternative for your daily PDF editing, stamping, and document management needs.

  1. 1. Open WPS PDF: Launch WPS Office and open your PDF document using the built-in WPS PDF editor.
  2. 2. Access the Stamp Tool: Navigate to the 'Comment' tab on the top ribbon and click on the 'Stamp' button.
  3. 3. Apply Custom Stamps: Choose from a variety of pre-made stamps or click 'Custom Stamp' to upload your own design and apply it directly to the page.
Easily add, modify, and manage custom stamps in your PDF documents without complex coding.Highly compatible with standard PDF formats and Adobe Acrobat files.Includes a comprehensive suite of Word, Excel, PowerPoint, and PDF tools in one lightweight application.Familiar user interface makes migrating from other office suites seamless and straightforward.
microsoft office alternative - wps office

Frequently Asked Questions

Can I run this batch JavaScript in Adobe Acrobat Reader?

No. The Action Wizard and advanced batch JavaScript execution are exclusive features of Adobe Acrobat Pro. Acrobat Reader users can only execute basic, document-level scripts and cannot process multiple files in batch.

How do I find the exact AP (Appearance) value of a newly created stamp?

You can find any stamp's AP value by placing the desired stamp on a blank PDF page, selecting it, opening the JavaScript debugger console (Ctrl+J or Cmd+J), and running the code 'this.selectedAnnots[0].AP'.

Will the replacement script change the size or location of my custom stamps?

No. By exclusively modifying the AP property of the stamp annotation, the Acrobat script preserves the original bounding box, dimensions, and exact page coordinates of the original stamp.