We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Java Redaction Sample

  1. I have redaction working but I am unable to change the colors?
  2. When extracting via TextFragmentAbsorber() what happens if iterate over this taking the first, would it automatically iterate over the different instances?

textFragmentAbsorber = new TextFragmentAbsorber(deidReq.getText() );
document.getPages().accept(textFragmentAbsorber);
textFragmentCollection = textFragmentAbsorber .getTextFragments();

			textFragment = textFragmentCollection.get_Item(1);

@george.soto,
Which color of the redact area, you are seeking to change. We can change fill, border and text color with the latest version 17.8 of Aspose.Pdf for Java API as below:

[Java]

RedactionAnnotation annot = new RedactionAnnotation(doc.getPages().get_Item(1), rect);
annot.setFillColor(Color.getBlack());
annot.setBorderColor(Color.getYellow());
annot.setColor(Color.getBlue());

The TextFragmentAbsorber class helps to search a target text string and returns all matching text fragments. However, if you are seeking to search multiple text strings, then you can iterate through the initialization TextFragmentAbsorber, and retrieve a collection text fragment for each target string. Kindly let us know in case of any further assistance or questions.