Redact certain page region with RedactionAnnotation

Aspose.PDF for Java supports the feature to add as well as manipulate Annotations in an existing PDF file. Recently some of our customers requested the Redaction feature, to redact (remove text, image, etc elements from) certain page region of PDF document. In order to fulfill this requirement, a class named RedactionAnnotation is provided, which can be used to redact certain page region or it can be used to manipulate existing RedactionAnnotations and redact them (i.e. flatten annotation and remove the text under it).

Redact Page Region with RedactionAnnotation

In order to redact a page region with RedactionAnnotation, the following steps can be used.

  1. Create a new object of Document class
  2. Define a Rectangle object with desired region parameters
  3. Create an object of RedactionAnnotation with page information
  4. Add annotation to the desired page of Document object
  5. Save the document 

Redact Page Region - Facades approach

com.aspose.pdf.facades namespace also has a class named PdfAnnotationEditor which provides the feature to manipulate existing Annotations inside PDF file. This class contains a method named redactArea(..) which provides the capability to remove certain page regions.