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

Free Support Forum - aspose.com

Add Redaction Annotation in PDF using Java - Part of nearby token removed

Part of nearby token removed after using RedactionAnnotation on punctuation marks. Example:
image.png (45.9 KB)

Java version: 11
Aspose PDF version: 21.10

Code snippet

    void testReduction() {
        var document = new Document("testFile.pdf");
        var page = document.getPages().get_Item(1);
        var textFragment = findTextFragment(page, ":");

        var annotation = new RedactionAnnotation(page, textFragment.getRectangle());


    private TextFragment findTextFragment(Page page, String searchValue) {
        var absorber = new TextFragmentAbsorber(searchValue);


        return absorber.getTextFragments().get_Item(1);

Original file: testFile.pdf (402.5 KB)

Do you have some workaround for it?


We were able to replicate a similar issue in our environment. Therefore, it has been logged as PDFJAVA-41044 in our issue management system. We will look into its details and keep you posted with the status of its rectification. Please be patient and spare us some time.

We are sorry for the inconvenience.

The issues you have found earlier (filed as PDFJAVA-41044) have been fixed in Aspose.PDF for Java 22.3.