Copy link to clipboard
Copied
Is it possible to replace highlighted text with a redaction?
My college highligted the text to redact (he only has the reader).
I have to redact all highlights.
I would like to do this all at once instead of going through the whole document.
Copy link to clipboard
Copied
Sure. Change the middle part to this:
if (annot.type=="Highlight") {
annot.type = "Redact";
annot.fillColor = color.black;
}
Copy link to clipboard
Copied
Yes, this can be done with a script:
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots[i];
if (annot.type=="Highlight") annot.type = "Redact";
}
}
Copy link to clipboard
Copied
Thank you!
It works great, but the redactions are in white, and I would like them in black.
Is this possible?
Copy link to clipboard
Copied
Sure. Change the middle part to this:
if (annot.type=="Highlight") {
annot.type = "Redact";
annot.fillColor = color.black;
}
Copy link to clipboard
Copied
Thank you, I knew it was simple 🙂
Copy link to clipboard
Copied
Can you give me step by step on how to do this.
Copy link to clipboard
Copied
Is there any way to actually apply redactions to these after completing the script? Thanks!
Copy link to clipboard
Copied
Sure, add this line:
this.applyRedactions();
Copy link to clipboard
Copied
Thank you so much! Is there anyway I could also add something in there to redact shapes? I have also been using rectangles to highlight text in images that I would like to redact
Copy link to clipboard
Copied
If that text is part of the image, you can redact the whole image or nothing. You can, however, edit the image in Photoshop and “redact” manually.
Copy link to clipboard
Copied
Another question actually - is there a script to redact highlights/shapes after you have flattened the document?
Copy link to clipboard
Copied
You can redact anything, but you can't use a script to detect highlights or shapes after they were flattened. Only text, or meta-objects (such as comments, fields, links, etc.).
Copy link to clipboard
Copied
Hi! Is there a way to do the opposite? Redact everything NOT highlighted? I've been searching all over and this is the closest I've found. Sorry to ask a different question.
I'm working with a document that has many lines. And I want to keep say 20 that i've highlighted and redact everything else not highlighted. Or perhaps there is an easier way?
Copy link to clipboard
Copied
It's doable, but not a trivial task. You would need to calculate the areas for all the rectangles between the highlights, and then place Redaction annotations over them, and apply them.
Copy link to clipboard
Copied
Hello
Total newbie here,
i get this in the debugger "NotAllowedError: Security settings prevent access to this property or method.
Doc.applyRedactions:7:Document-Level:Redact" when running
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots[i];
if (annot.type=="Highlight") annot.type = "Redact";
this.applyRedactions();
}
}
Could anyone point me to what i need to do to apply the redactions.
Copy link to clipboard
Copied
Use the script in the JavaScript console.
Why do you apply the redactions in the for loop?
Copy link to clipboard
Copied
Move this line to be the last one in your code:
this.applyRedactions();
Copy link to clipboard
Copied
I have add:
this.applyRedactions();
But does not apply the redactions. Text text is still visible, but only redacts if I hover over. I wanting to redact what is highlighted and save the file as redacted version.
Copy link to clipboard
Copied
Post your full code, please.
Copy link to clipboard
Copied
Also a newbie, but running into a similar situation as described above.
Text is still visible on the document and only disappears when I hover over it. Everything still shows in the Comments pane, but instead of Highlight, they all read "Redact"
The code I used was:
{this.syncAnnotScan();
var annots = this.getAnnots();
if (annots!=null) {
for (var i in annots) {
var annot = annots[i];
if (annot.type=="Highlight") annot.type = "Redact";
annot.fillColor = color.white}
}
this.applyRedactions();}
Copy link to clipboard
Copied
Your code has some issues. Try this:
this.syncAnnotScan();
var annots = this.getAnnots();
if (annots != null) {
for (var i in annots) {
var annot = annots[i];
if (annot.type == "Highlight") {
annot.type = "Redact";
annot.fillColor = color.white
}
}
}
this.applyRedactions();
Copy link to clipboard
Copied
Thank you for the quick reply!
Unfortunately, I am running into the same issue as described above. All text still appears until I hover over it, all comments changed from Highlight to Redact.
Debugger says: "NotAllowedError: Security settings prevent access to this property or method." (As noted in the top post.) I have Global Object Security turned off - is there something else I need to do?
Thank you again!
Copy link to clipboard
Copied
Are you running this code in Acrobat?
Is the file secured or digitally signed?
Copy link to clipboard
Copied
Thank you again for all of your help!
I was running the code in Acrobat and the file was set to "No security" and not digitally signed.
I had to add the file/folder to my Privileged Locations under Security (Enhanced) and then this worked like a charm.
Cheers!