I use the RedactionAnnotation
class to process PDF documents, but it throw ArgumentException.
Version info:
Aspose.PDF for Net 23.9
The demo code
void Main()
{
var doc = new Aspose.Pdf.Document(@"C:\Users\54390\Downloads\3b0ae39851454c1b90d2c40d18b02e91.pdf");
foreach (var page in doc.Pages)
{
var annot = new RedactionAnnotation(page, new Aspose.Pdf.Rectangle(0, 0, 595, 720));
annot.FillColor = Aspose.Pdf.Color.White;
annot.Color = Aspose.Pdf.Color.White;
page.Annotations.Add(annot);
annot.Redact();
}
doc.Save(@"C:\Users\54390\Downloads\output.pdf");
}
The demo file
3b0ae39851454c1b90d2c40d18b02e91.pdf (2.2 MB)
The screenshot
20231017211548.jpg (147.6 KB)