Hi,
I’m trying to redact annotation on a PDF file (generated from JPG file) using Aspose.PDF library (ver 21.11.0.0) using code similar to what’s provided on Aspose site https://docs.aspose.com/pdf/net/extra-annotations/#redact-certain-page-region-with-redaction-annotation-using-asposepdf-for-net.
Code sample…
// For complete examples and data files, please go to https://github.com/aspose-pdf/Aspose.PDF-for-.NET
// The path to the documents directory.
string dataDir = RunExamples.GetDataDir_AsposePdf_Annotations();
// Open document
Document doc = new Document(dataDir + "input.pdf");
// Create RedactionAnnotation instance for specific page region
RedactionAnnotation annot = new RedactionAnnotation(doc.Pages[1], new Aspose.Pdf.Rectangle(200, 500, 300, 600));
annot.FillColor = Aspose.Pdf.Color.Black;
annot.BorderColor = Aspose.Pdf.Color.Yellow;
annot.Color = Aspose.Pdf.Color.White;
// Text to be printed on redact annotation
annot.OverlayText = "Confidential";
annot.TextAlignment = Aspose.Pdf.HorizontalAlignment.Center;
// Repat Overlay text over redact Annotation
annot.Repeat = false;
// Add annotation to annotations collection of first page
doc.Pages[1].Annotations.Add(annot);
// Flattens annotation and redacts page contents (i.e. removes text and image
// Under redacted annotation)
annot.Redact();
dataDir = dataDir + "RedactPage_out.pdf";
doc.Save(dataDir);
When we use Adobe Pro to open saved PDF file and try to edit, we can select and move redaction and that exposes original image that should have been removed by redaction. I came across old article in this support forum Redaction of Vector Images in PDFs . I don’t know if issue i’m describing is exactly same as this article or not. Can you let me know why its not sticking redaction?