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

Free Support Forum - aspose.com

Difference between Facades.PdfAnnotationEditor.RedactArea() and RedactionAnnotation.Redact()?

Hi,

I was wondering if there was a big difference between the functionality of Facades.PdfAnnotationEditor.RedactArea() and RedactionAnnotation.Redact() behind the scenes? I’ve looked at some files redacted by both and haven’t noticed a huge difference from the final product, but the facade implementation seems to be quicker and uses significantly less memory. Is there a big difference beneath the scenes as to how these methods effect a document?

Thanks!

@bvk

Thanks for contacting support.

Can you please share source file along with generated result and sample code so that we may further investigate to help you out.

@Adnan.Ahmad,

Here are a couple examples:

Facade redaction:

var filePath = "ManyPdfObjects.pdf";
using (var document = new Document(filePath))
{
	var editor = new PdfAnnotationEditor(document);
	var page = document.Pages[1];

	editor.RedactArea(page.Number, new Rectangle(0, 0, page.CropBox.Width, page.CropBox.Height), System.Drawing.Color.Black);
	var annotations = page.Annotations;
	document.Save("RedactedWithFacades.pdf");
}

Annotation Redaction:

var filePath = "ManyPdfObjects.pdf";
using (var document = new Document(filePath))
{
	var page = document.Pages[1];
	var annotation =
		new RedactionAnnotation(page, new Rectangle(0, 0, page.CropBox.Width, page.CropBox.Height));

	annotation.Redact();
	var annotations = page.Annotations;

	document.Save("RedactedWithRedactionAnnotation.pdf");
}

Sample files included below with results from redacting with facades and redacting with annotations.
ManyPdfObjects.zip (3.2 MB)

@bvk,

I like to inform that RedactArea just redacts area in the document (i.e remove contents and filling area with required color), RedactAnnotation is specific type of annotation which allows to do the same thing. This annotation allows previously create annotation and redact it later. RedactArea functioning without annotation creation.

@Adnan.Ahmad ,

That’s what I was looking to find out, thank you!

@bvk,

You are very welcome.