Skip to main content
Participant
Oct 29, 2024 4:47 PM UTC
Question

censuring words

Hi, I am requesting support to censor words identified in a PDF using JavaScript from the console that incorporates the Acrobat Reader console. Which method can be called so that once that word is identified, the method is executed and censors the words?

I hope this helps!

This topic is closed to new replies. Start a new post to keep the conversation going.

8 replies

Thom Parker
Community Expert
Community Expert
Oct 29, 2024 8:46 PM UTC

How are you identifying the words?

 

Translate
Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
Oct 29, 2024 9:02 PM UTC

add_annot()
[...]
var qd1 = getPageNthWordQuads(page, position);
qd1 = String(qd1).split(',');

rg2 = new RegExp(words[words.length - 1]); // for saving the posible words[-1]
wd2 = this.getPageNthWord(page, position + words.length - 1, false);
if (rg2.test(wd2)) { // checks if rg2 trully is words[-1]
var qd2 = getPageNthWordQuads(page, position + words.length - 1);
qd2 = String(qd2).split(',');


if (qd1[1] == qd2[1]) { //checks if words[0] is in the same line as words[-1]

// qd = [[left, top, right, top, left, bot, right, bot]];
var qd = [[qd1[0], qd1[1], qd2[2], qd1[3], qd1[4], qd1[5], qd2[6], qd1[7]]];

add_annot(page, qd);
} else {
for (var w = 0; w < words.length; w++) {
var qd = getPageNthWordQuads(page, position + w);

add_annot(page, qd);
}
}
}
[...]

Translate
Participant
Oct 29, 2024 6:23 PM UTC

We have the Pro version at work, but we want to censor using JavaScript in the console, but I haven't found the method in the API. At the moment we have a script that marks the words to be censored, but we can't find any direct method to censor from the script.
Thanks soo much

Translate
try67
Community Expert
Community Expert
Oct 29, 2024 7:01 PM UTC

this.applyRedactions();

Translate
Participant
Oct 29, 2024 9:03 PM UTC

Thank you very much, I will try that method.
Where is this in the documentation?

Translate
JR Boulay
Community Expert
Community Expert
Oct 29, 2024 5:52 PM UTC

This requires Acrobat Pro.

Acrobat Reader and Acrobat Standard cannot redact documents.

Translate
Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
Community Expert
Oct 29, 2024 4:58 PM UTC

This is not possible with the free Reader. You would need Acrobat to do it safely using Redactions.

Translate