Redact text in PDF using Java - text is not removed if quadPoints were set

Text under RedactionAnnotation is not removed if quadPoints were set: See result example:
mFndKlSKry.gif (106.0 KB)

Java version: 11
Aspose PDF version: 21.10

Code snippet

    @Test
    void testReduction() {
        var document = new Document("testsFile.pdf");
        var page = document.getPages().get_Item(1);
        var textFragment = findTextFragment(page, "REPORT");

        var annotation = new RedactionAnnotation(page, textFragment.getRectangle());
        annotation.setFillColor(Color.getBlueViolet());
        annotation.setColor(Color.getBlack());

        var quadPoints = getTextFragmentQuadPoints(textFragment);
        annotation.setQuadPoints(quadPoints); //when setting this field - the text under the annotation was not removed

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

    private Point[] getTextFragmentQuadPoints(TextFragment textFragment) {
        int offset = 0;
        var quadPoints = new Point[textFragment.getSegments().size() * 4];
        for (var segment : textFragment.getSegments()) {
            var rectangle = segment.getRectangle();
            quadPoints[offset] = new Point(rectangle.getLLX(), rectangle.getURY());
            quadPoints[offset + 1] = new Point(rectangle.getURX(), rectangle.getURY());
            quadPoints[offset + 2] = new Point(rectangle.getLLX(), rectangle.getLLY());
            quadPoints[offset + 3] = new Point(rectangle.getURX(), rectangle.getLLY());
            offset += 4;
        }

        return quadPoints;
    }

Original file: testFile.pdf (402.5 KB)

Do you have some workaround for it?

@dkuksa

We were able to reproduce the issue in our environment. Therefore, have logged it as PDFJAVA-41045 in our issue tracking system. We will further look into its details and keep you informed about its resolution status. Please be patient and spare us some time.

We are sorry for the inconvenience.

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