How to Redact the Same Area in Multiple PDFs with JavaScript
Question details
The user wants to automate the process of redacting a specific, identical area across multiple PDF files located in a folder using JavaScript.

- Product
- Adobe Acrobat Pro
- Device & OS
- not provided
- Scenario
- Managing multiple PDF files in a batch where the same region (such as a header, footer, or specific form field) needs to be redacted for security or privacy compliance.
- Observed behavior
- Applying redactions manually across many files is highly time-consuming, prompting the need for a programmatic JavaScript-based action to automatically apply and permanently execute redaction annotations.
Ensure you have Adobe Acrobat Pro installed, as standard versions do not support the Action Wizard required for executing batch JavaScript. Always create a backup of your target folder before running automated redaction scripts to prevent irreversible data loss.
Automate Redactions using Acrobat Pro Action Wizard and JavaScript
Use Adobe Acrobat Pro's Action Wizard to run a custom JavaScript that dynamically adds and applies redaction annotations to all PDFs in a selected folder.
This workflow relies on the Acrobat JavaScript API, specifically utilizing the addAnnot method to define the redaction coordinates and the applyRedactions method to permanently strip the underlying content. You must calculate the exact PDF page coordinates (in points) for the area you wish to redact before writing the script.
Launch Adobe Acrobat Pro. Navigate to the 'Tools' tab and select 'Action Wizard'. Click on 'New Action' in the top toolbar to start configuring your batch process.
Under the 'Files to be Processed' section on the left, click 'Add Folder' and browse to the directory containing all the PDF files you want to redact.
Under 'Choose tools to add', expand the 'More Tools' panel and select 'Execute JavaScript'. Click the '+' icon in the center to add it to your Action steps on the right.
Click 'Specify Settings' on the newly added Execute JavaScript step. Input your script using this syntax: var annot = this.addAnnot({type: 'Redact', page: 0, quads: [[x1, y1, x2, y2]]}); followed by this.applyRedactions();. Replace the quad coordinates with your specific target area.
Uncheck the 'Prompt user' checkbox so the script runs automatically for each file. Click 'Save', name your action 'Batch Redact', and then click 'Start' to process the entire folder.

Redact Sensitive Information Easily with WPS PDF
While scripting batch processes requires advanced programming knowledge, WPS PDF provides a highly intuitive and reliable Redact tool. It allows you to quickly and permanently remove sensitive text, images, and data from your PDF documents without writing any code.
- 1. Open the PDF in WPS Office: Launch WPS Office on your device and open the PDF document that contains the sensitive information you need to hide.
- 2. Navigate to the Redact tool: Click on the 'Protect' tab located in the top ribbon menu, then select the 'Redact' feature.
- 3. Mark areas for redaction: Click and drag your cursor over the specific text, images, or custom areas you wish to conceal. A visible outline will indicate the selected region.
- 4. Apply the redactions: Click 'Apply Redactions' in the redaction toolbar. A warning will appear confirming that the underlying information will be permanently removed. Click 'OK' to finalize the process and save your secure document.

Frequently Asked Questions
Can I batch redact PDFs using Adobe Acrobat Standard?
No, Adobe Acrobat Standard does not include the Action Wizard tool. The Action Wizard is required to run automated batch JavaScript processes on multiple files in a folder, so you must use Acrobat Pro.
How do I find the correct coordinates for the addAnnot method?
PDF coordinates are measured in points (72 points per inch) starting from the bottom-left corner (0,0) of the document. You can use Acrobat's 'Measure' tool, the Preflight tool, or a cursor coordinate plugin to determine the exact 'quads' required for your redaction box.
Are redactions applied with JavaScript permanent?
Yes, provided the script includes the applyRedactions() method immediately after addAnnot. Without this method, the redaction is only placed as a draft annotation, meaning the visual black box is present but the underlying text data has not yet been removed from the file.
Why did my batch redaction script leave the text searchable?
If you added a standard black rectangle annotation instead of a true redaction annotation (using type: 'Redact' in your addAnnot parameters), the text underneath remains entirely intact and searchable. Always ensure you are invoking the specific redaction API methods.




