Skip to main content
Participating Frequently
September 18, 2024
Answered

How to redact same areas on multiple documents

  • September 18, 2024
  • 1 reply
  • 2381 views

I have thousands of documents where I'm trying to redact information that's located in the same position. I can't redact based on searching for text because it's different information on each document. Is there a quick way to do this?

This topic has been closed for replies.
Correct answer PDF Automation Station

I see what you mean, gonna see if that fixes anything


I fixed and tested.  It worked.  If you are going to use this in an Action on several docs at once you should set bShowConfirmation to false so you don't have to dismiss a popup message for each doc.

1 reply

PDF Automation Station
Community Expert
Community Expert
September 18, 2024

First you will need to get the quads of the area you want to redact.  You can do this by using the highlight text commenting tool, selecting the highlight, and running the following script in the console:

this.selectedAnnots[0].quads;

Next, create an Action that Executes a JavaScript.  The script is:

this.addAnnot({
type:"Redact",
page: pg,
quads: qd});
this.applyRedactions();

pg is a variable representing the zero-based page number to apply the redactions to, and qd is a variable representing the quads returned from the previous step.

zg87878Author
Participating Frequently
September 18, 2024

Yeah, I was able to get the information for all of my quads and have that saved. 

 

I was able to plug one of them into this Javascript:

this.addAnnot({
type:"Redact",
page: 0,
quads: [[144.00064086914062, 750.10888671875, 179.34625244140625, 750.10888671875, 144.00064086914062, 732.4360961914062, 179.34625244140625, 732.4360961914062]],
overlayText: ":It's gone:",
alignment: 1, // Center alignment
repeat:true
});

 

But beyond that I can't get it to work when I try plugging quads into the full code that I got from the tutorial I'm looking at. It's from 2008 so I'm not sure if it's out of date information

zg87878Author
Participating Frequently
September 18, 2024

I ran my script and yours (with my quads) and they both worked.  Did you run that script in the console to test?  Any errors?


Yeah, the script I shared works fine (no errors) as far as highlighting one of the lines that I want to redact, but I'm trying to have this done to multiple quads, and not sure how I get multiple into that code.

 

Further, when I moved along into the later part of the tutorial, I try to plugin all of my quads and end up with Syntax error  Missing ; Before statement 9

 

The full code I'm working with:

// Part 1: Quads for the different Redaction areas
var qdFirstName = [[144.00064086914062, 750.10888671875, 179.34625244140625, 750.10888671875, 144.00064086914062, 732.4360961914062, 179.34625244140625, 732.4360961914062]];
var qdLastName = [[83.78219604492188, 714.1087646484375, 175.41897583007812, 714.1087646484375, 83.78219604492188, 699.0541381835938, 175.41897583007812, 699.0541381835938]];
var qdAdress = [[73.30941772460938, 701.0177612304688, 107.34593200683594, 701.0177612304688, 73.30941772460938, 681.38134765625, 107.34593200683594, 681.38134765625]];
var qdCityState = [[89.67312622070312, 685.30859375, 266.40118408203125, 685.30859375, 89.67312622070312, 666.3267211914062, 266.40118408203125, 666.3267211914062]];
var qdSocSec = [[106.69139099121094, 651.2720947265625, 166.90985107421875, 651.2720947265625, 106.69139099121094, 633.5993041992188, 166.90985107421875, 633.5993041992188]];
var qdAlow = [[106.03683471679688, 636.217529296875, 255.27386474609375, 636.217529296875, 106.03683471679688, 618.544677734375, 255.27386474609375, 618.544677734375]];
// Part 2: Function for adding Redact Annotations to a PDF function
AddMyRedacts(quadList) {
	for(var pg=1; pg<this.numPages; pg++) {
		for(var index=0; index<quadList.length; index++) {
			this.addAnnot({
				type:"Redact", page:pg,
				quads:quadList[index],
				overlayText: ":It's gone:",
				alignment: 1, // center alignment
				repeat:true });
			}
		}
	}
// Part3: Applying the redactions
// Code for two different redaction schemes
// Use only one per document
// #1 Run this code to apply redactions to W4 employee name
// and address
AddMyRedacts([qdFirstName, qdLastName, qdAdress, qdCityState, qdSocSec, qdAlow] );
this.applyRedactions({bKeepMarks: false, bShowConfirmation: true, cProgText: "It's going away" });