Skip to main content
Participant
October 29, 2024
Question

censuring words

  • October 29, 2024
  • 4 replies
  • 395 views

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 has been closed for replies.

4 replies

Thom Parker
Community Expert
Community Expert
October 29, 2024

How are you identifying the words?

 

Thom Parker - Software Developer at PDFScriptingUse the Acrobat JavaScript Reference early and often
Participant
October 29, 2024

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);
}
}
}
[...]

Participant
October 29, 2024

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

try67
Community Expert
Community Expert
October 29, 2024

this.applyRedactions();

Participant
October 29, 2024

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

JR Boulay
Community Expert
Community Expert
October 29, 2024

This requires Acrobat Pro.

Acrobat Reader and Acrobat Standard cannot redact documents.

Acrobate du PDF, InDesigner et Photoshopographe
try67
Community Expert
Community Expert
October 29, 2024

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