We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Redact certain text in PDF using Aspose.PDF for .NET - Redaction does not work correctly on rotated page

Dear support team,
if I use following code to blacken a section of the following document, the text that is deleted from the pdf-document is not under the annotation.
The page is rotated to 180 degrees.
If I try the same scenario with no rotation it works fine.

Document: TestDocumentRedactionRotatedOn180.pdf (30.4 KB)

using (var inputStream = new MemoryStream(content))
{
using (var document = new Document(inputStream))
{
Page page = document.Pages[1];

                RedactionAnnotation annot = new RedactionAnnotation(page, new Rectangle(168,386,546,694))
                {
                    FillColor = Color.Black,
                    Color = Color.Black,
                    BorderColor = Color.Black
                };

                document.Pages[1].Annotations.Add(annot, true);
                annot.Redact();                    

                document.Save(@"C:\temp\WrongRedaction.pdf");
            }
        }

@christian.schmidt.lf

Thanks for contacting support.

We have tested the scenario in our environment and were able to notice the issue. However, would you please share an expected PDF document output, which you need to generate using API. We will log an issue along with expected and current results and share the ID with you.

We are sorry for the inconvenience.

I have following docment: TestDocRotated0DegreesWirhoutRedaction.pdf (26.7 KB)

I use following Code to Redact a specific area like in the Code example:
using (var inputStream = new MemoryStream(content))
{
using (var document = new Document(inputStream))
{
Page page = document.Pages[1];

                RedactionAnnotation annot = new RedactionAnnotation(page, new Rectangle(200,300,500,600))
                {
                    FillColor = Color.Black,
                    Color = Color.Black,
                    BorderColor = Color.Black
                };

                document.Pages[1].Annotations.Add(annot, true);
                annot.Redact();                    

                document.Save(@"C:\temp\testDocRedacted.pdf");
            }
        } 

The result document is: TestDocRotated0DegreesWITHRedaction.pdf (27.0 KB)

So far everything is working fine and correctly.

But if I Rotate the Page to 90 degrees like this document: TestDocRotated90DegreesWirhoutRedaction.pdf (26.8 KB)

And use the same code with the same coordinates for the rectangle the result is: TestDocRotated90DegreesWITHRedaction.pdf (27.4 KB)

But I thought that if I Add a annotation to a page and set the considerRotation variable to true like in the code: document.Pages[1].Annotations.Add(annot, true);
the position of the annotation will be recalculated according to the page rotation.
Another problem is that not only the postion is wrong you can also select the text under the annotation like in the document: TestDocRotated90DegreesWITHRedaction.pdf

I expect that the redactionAnnotation is right positioned and the text under the annotation is extracted/deleted so that nobody can select th text under the annotation.

@christian.schmidt.lf

Thanks for sharing more details.

We have logged an issue as PDFNET-45083 in our issue tracking system for the sake of correction. We will further investigate the logged issue and keep you posted with the status of its rectification. Please be patient and spare us little time.

We are sorry for the inconvenience.

Has there been any resolution on this issue?

@cormack.milyli

We regret to share that issue has not been yet resolved due to other high priority issues. We will surely inform within this forum thread as soon as it is rectified. Please spare us little time.

We are sorry for the inconvenience.