Redaction "bleeds" to other pages

Hi! We have issues with redaction where the redact annotations bleed into other pages. We have tested with both Aspose.PDF 24.8, 24.9 and 24.10.

Test with PDF document from Testfile.org https://testfile.org/all-pdf-sample-test-file-download-direct/.

When I redact this using RedactionAnnotation.Redact() method, this is the result.
image.png (52.0 KB)

It seems like a redaction on page 1, bleeds into page 2, and vice versa.

Relevant code:

public Stream RedactPdfDocument(Stream pdfDocument, List<RedactionCoordinate> redactionCoordinates, string overlay = null)
{
    var document = new Document(pdfDocument);
    foreach (var redactionCoordinate in redactionCoordinates)
    {
        var pageNr = redactionCoordinate.PageNr;

        var rectangle = new Rectangle(
            redactionCoordinate.LLX,
            redactionCoordinate.LLY,
            redactionCoordinate.URX,
            redactionCoordinate.URY);

        var redactionAnnotation = new RedactionAnnotation(document.Pages[pageNr], rectangle)
        {
            FillColor = Color.Black,
            BorderColor = Color.Black,
            Color = Color.Black,
        };

        document.Pages[pageNr].Annotations.Add(redactionAnnotation, true);

        redactionAnnotation.Redact();
    }

    var memoryStream = new MemoryStream();
    document.Save(memoryStream);

    return memoryStream;
}

@simensnc

Can you please share which coordinates are you using to add redaction annotation? Maybe you can share one or two sets of values with which we can replicate the issue and address accordingly.

@asad.ali

To elaborate, for this document, the issue shows as purple rectangles where redaction happens on other pages. These bleeding rectangles seems to behind the text.
It fails with all the different coordinates we’ve tried, but I have some that I know causes issues.

This is the input to the function:

[{"PageNr":1,"LLX":86.58,"LLY":777.5550000000001,"URX":142.35750000000002,"URY":690.1425},
{"PageNr":2,"LLX":156.51,"LLY":548.6175000000001,"URX":439.56,"URY":494.505},
{"PageNr":3,"LLX":424.575,"LLY":750.0825,"URX":471.195,"URY":685.1475},
{"PageNr":5,"LLX":190.6425,"LLY":521.9775,"URX":377.955,"URY":484.515},
{"PageNr":6,"LLX":259.74,"LLY":756.7425000000001,"URX":287.21250000000003,"URY":642.69}]

And these are the respective rectangles:

{"Width":55.77750000000002,"Height":87.41250000000002,"LLX":86.58,"LLY":690.1425,"URX":142.35750000000002,"URY":777.5550000000001,"IsTrivial":false,"IsEmpty":false,"IsPoint":false}
{"Width":283.05,"Height":54.11250000000007,"LLX":156.51,"LLY":494.505,"URX":439.56,"URY":548.6175000000001,"IsTrivial":false,"IsEmpty":false,"IsPoint":false}
{"Width":46.620000000000005,"Height":64.93499999999995,"LLX":424.575,"LLY":685.1475,"URX":471.195,"URY":750.0825,"IsTrivial":false,"IsEmpty":false,"IsPoint":false}
{"Width":187.31249999999997,"Height":37.46249999999998,"LLX":190.6425,"LLY":484.515,"URX":377.955,"URY":521.9775,"IsTrivial":false,"IsEmpty":false,"IsPoint":false}
{"Width":27.472500000000025,"Height":114.05250000000001,"LLX":259.74,"LLY":642.69,"URX":287.21250000000003,"URY":756.7425000000001,"IsTrivial":false,"IsEmpty":false,"IsPoint":false}

The issue seems to be related to removing text underneath.

@simensnc

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-58393

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.