
All other viewers tested will only show the red border, with nothing occurring when you hover your cursor over it.

ADOBE ACROBAT REDACT PDF
After testing in multiple browsers and other PDF Viewers like Foxit Reader, it looks like the function to 'preview' what the redaction will look like when applied by hovering your mouse over the red outline is only supported in Acrobat products. (Side note: In my original question, I mention hovering over the redaction's red rectangle in order to preview what the applied redaction will look like. Copies of my test documents can be found in this DropBox folder. Doing this results in a Redact annotation with all of the above entries set. My testing document was made using Acrobat DC Pro, by manually adding a redaction in Acrobat. Finally, if RO is defined, it supersedes pretty much all of the other independent display entries. If you use OverlayText then there must be a DA element defined (DA is a string that provides formatting info for the OverlayText). OverlayText is just one part of the equation. Redact.SetOverlayText(new PdfString("New Text")) Īs answer points out, the PDF Redact Annotation Specification clarifies the underlying redact annotation DOM entries. PdfRedactAnnotation redact = (PdfRedactAnnotation)annotation Var annotations = pdfDoc.GetPage(i).GetAnnotations() Int pageCount = pdfDoc.GetNumberOfPages() PdfDocument pdfDoc = new PdfDocument(new - Original.pdf"), new - Output.pdf"))

Thank you for any advice anyone might be able to offer.
ADOBE ACROBAT REDACT UPDATE
Is there any way that I can trigger the Redaction Annotation update programmatically, without having to open and right-click on every one? I've included my code below. However, when I right-click on the annotation (before applying redactions), the overlay text immediately gets updated to the new text:Īt this point, when I apply redactions, it's the new text that is burned into the PDF. When I open the file and check the overlay text by hovering over a redaction marking with my cursor, however, the original overlay text is still there.Īdditionally, if I apply the redactions, the original overlay text is what gets burned into the page. When debugging and looking at the annotation properties, I can see that the OverlayText has definitely changed. So, I wrote a method that opens a PDF, loops through the pages, then loops through the annotations on each page, and checks if an annotation is a PdfRedactAnnotation. The PdfRedactAnnotation object has a method called SetOverlayText() that looks like it should do what I want. I am trying to alter the text contained within every redaction annotation in a PDF, using iText7. The desired result is to be able to change the text that appears when applying redactions from "Original Overlay Text" to any other value, such as "New Text". If you need a sample to test with, this DropBox folder has a file called 01 - Original.pdf that you can use as the source document.


I've kept my original question and the follow-up with what I've personally tried below. While I would prefer to use iText7, I will also consider solutions using other libraries that I can reasonably access (I do have a small budget that I could use to purchase another library, if I need to). My original question specified iText7, as that was the library that got me the closest in my own attempts. I have added a bounty of 150 reputation, as I don't think that I will be able to work out a solution on my own. I don't need to alter the text that is shown in the preview, just what is shown after redactions are applied. It also seems like the preview is maintained separately from the actual redaction that is applied. In my attempts, I have discovered that the "preview" that is available in Acrobat products when hovering your cursor over a redact box is unique to Acrobat, and most other viewers won't show the preview. The code will be ran prior to the redactions being applied. My goal is to overwrite what was selected by the user with a system defined value. In Acrobat, you can set up a collection of "redaction codes" that can be used to identify why you are marking something as redacted. I am trying to alter the redaction annotation to change the underlying text that gets burned into a PDF when you apply redactions.
