• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

replace highlight with redaction

Explorer ,
Jul 17, 2023 Jul 17, 2023

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.

 

TOPICS
Edit and convert PDFs , How to

Views

2.9K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
1 ACCEPTED SOLUTION
Community Expert ,
Jul 17, 2023 Jul 17, 2023

Copy link to clipboard

Copied

Sure. Change the middle part to this:

 

		if (annot.type=="Highlight") {
			annot.type = "Redact";
			annot.fillColor = color.black;
		}

View solution in original post

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 17, 2023 Jul 17, 2023

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";
	}
}

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 17, 2023 Jul 17, 2023

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?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 17, 2023 Jul 17, 2023

Copy link to clipboard

Copied

Sure. Change the middle part to this:

 

		if (annot.type=="Highlight") {
			annot.type = "Redact";
			annot.fillColor = color.black;
		}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 17, 2023 Jul 17, 2023

Copy link to clipboard

Copied

Thank you, I knew it was simple 🙂

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jul 09, 2024 Jul 09, 2024

Copy link to clipboard

Copied

Can you give me step by step on how to do this. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 21, 2023 Oct 21, 2023

Copy link to clipboard

Copied

Is there any way to actually apply redactions to these after completing the script? Thanks! 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 22, 2023 Oct 22, 2023

Copy link to clipboard

Copied

Sure, add this line:

 

this.applyRedactions();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 22, 2023 Oct 22, 2023

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 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 22, 2023 Oct 22, 2023

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.

ABAMBO | Hard- and Software Engineer | Photographer

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Oct 22, 2023 Oct 22, 2023

Copy link to clipboard

Copied

Another question actually - is there a script to redact highlights/shapes after you have flattened the document? 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 22, 2023 Oct 22, 2023

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.).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 11, 2024 Jan 11, 2024

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? 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 11, 2024 Jan 11, 2024

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 08, 2024 May 08, 2024

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. 

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 08, 2024 May 08, 2024

Copy link to clipboard

Copied

Use the script in the JavaScript console.
Why do you apply the redactions in the for loop?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 09, 2024 May 09, 2024

Copy link to clipboard

Copied

Move this line to be the last one in your code:

this.applyRedactions();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 30, 2024 May 30, 2024

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 31, 2024 May 31, 2024

Copy link to clipboard

Copied

Post your full code, please.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 16, 2024 Dec 16, 2024

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();}

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 16, 2024 Dec 16, 2024

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();

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 16, 2024 Dec 16, 2024

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Dec 16, 2024 Dec 16, 2024

Copy link to clipboard

Copied

Are you running this code in Acrobat?

Is the file secured or digitally signed?

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 18, 2024 Dec 18, 2024

Copy link to clipboard

Copied

LATEST

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!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines