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

 @Test
    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());
        annotation.setFillColor(Color.getBlueViolet());
        annotation.setColor(Color.getBlack());
        annotation.redact();
        page.getAnnotations().add(annotation);

        document.save("result.pdf");
    }

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

        page.accept(absorber);

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

Original file: testFile.pdf (402.5 KB)

Do you have some workaround for it?

@dkuksa

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.