How to create a redaction annotation without applying it and set the color of the redacted section?

Product: PDFNet, Java

Product Version: 9.2.0 & 9.4.0

Please describe your issue and provide steps to reproduce it:
I’m creating a redaction annotation on a page and setting its color and opacity. This works Ok in 9.2.0.
When I open a file in a PDF-editor (PDFXchangeEditor or Adobe Pro) and want to apply the redaction (in the right-click context menu), then the redacted section will appear as white (or background?).

Is there a way to set the color of the redacted section? I want that color to be different from the color of the redaction annotation. From the API documentation, it seems that calling ‘setAppFormXO’ should do what I want, but I’m not sure what value to pass.

Also in version 9.4.0 the redaction annotations look different. They appear as a border instead of a filled in rectangle.

I’ve uploaded the resulting files to OneDrive, as well as the code I use to create the redactions. Find the link below.

Please provide a link to a minimal sample where the issue is reproducible:
https://iqser-my.sharepoint.com/:f:/p/viktor_seifert/EiykWvXoM6RKvzcIl15uD-wBZq2aOR3nMqeh2hgQ4v_IzA?e=fGeV9L

Viktor Seifert
Software Architect
IQser Technologie GmbH

I’ve tried this on Linux (in Docker) and on Windows (in my dev setup), both with the same results.

Thank you for contacting us about this. Please set the interior color using the following code, as this will allow the third party readers to properly add the color as expected:

ColorPt overlayfillcolor = new ColorPt(0, 0, 0); // RGB values
Obj icArray = redact_annot.GetSDFObj().PutArray("IC");
icArray.pushBackNumber(overlayfillcolor.get(0));
icArray.pushBackNumber(overlayfillcolor.get(1));
icArray.pushBackNumber(overlayfillcolor.get(2));

Make sure to add this code before calling the refreshAppearance() method.

That code does exactly what I need.
Thank you for your help!

But the code only seems to work for PDFNet 9.2.0. For 9.4.0 it seems to have no effect.

Thank you for your response. I created the following file using the following redaction code, and it appears that redacting from Adobe Reader works as expected:

Redaction redactionAnnotation = Redaction.create(doc, new Rect(0,0,100,100));
        ColorPt overlayfillcolor = new ColorPt(0, 1, 0.666667); // RGB values
        Obj icArray = redactionAnnotation.getSDFObj().putArray("IC");
        icArray.pushBackNumber(overlayfillcolor.get(0));
        icArray.pushBackNumber(overlayfillcolor.get(1));
        icArray.pushBackNumber(overlayfillcolor.get(2));
        redactionAnnotation.setColor(overlayfillcolor, 3);
        redactionAnnotation.setInteriorColor(overlayfillcolor, 3);
        redactionAnnotation.setOpacity(.5);
        redactionAnnotation.refreshAppearance();

Click here for the example output file from the above code.

If you are still able to reproduce the issue, could you please provide us with the full code you are using to create the annotation? Thank you.

Hello Shakthi or anyone else in the Apryse Team,
Can you please send the complete code of this - annotating the PDF first and saving of the annotating the PDF doc. I am trying myself but not able to see the annotation in the saved PDF.
Thanks