Add Redaction Annotations in PDF using Java - Annotations Disappear if redaction applied in Adobe

Hi. I am trying to add redaction annotation in code and apply them in Adobe Pro. But when I click the Apply button in Adobe, all the added redaction annotations disappear. When I do redaction directly in Adobe after applying everything ok (redaction annotation stay in document).

Source file: SAE Narrative.pdf (83.2 KB)
Result: result.pdf (84.2 KB)
Demo: demo.gif (1.3 MB)

Java version: 11
Aspose PDF version: 21.11

Code snippet

  @Test
    void testAdobeRedactionApply() {
        var document = new Document("SAE Narrative.pdf");
        var page = document.getPages().get_Item(1);
        var redactionRectangle = new Rectangle(248.7, 589.416, 292.08, 602.616);

        var annotation = new RedactionAnnotation(page, redactionRectangle);
        annotation.setFillColor(Color.parse("#9bcbeb"));
        annotation.setOverlayText("PI");
        annotation.setRepeat(false);
        annotation.flatten();
        page.getAnnotations().add(annotation);

        document.save("result.pdf");

Did I do something wrong when adding the annotation? Maybe I haven’t added any annotation properties?

@dkuksa

Instead of using above method, please try to use annotation.redact() method and open the PDF in Adobe Reader. In case you still notice any issues, please let us know.

@asad.ali
If I use the redact() method I’ve got another issue described in this topic: Punctuation marks position are changed after redaction nearby standing tokens

I wanna know if there is any annotation option (property) that can help solve the problem described in the current thread?

@dkuksa

We are afraid that there is no such additional property in order to prevent the issue that you are facing. Furthermore, we will only be able to share some feedback once the logged ticket (PDFJAVA-41094) is fully investigated. We will surely inform you in the respective forum thread as soon as some definite updates are available in this regard. Please spare us some time.

We apologize for the inconvenience.