Add resource redaction annotation

On this page

Resource redaction annotation fills black rectangle with fixed position to hide a text as shown in the picture below:

You can specify the following properties of the ResourcesRedactionAnnotation class:

  • Box defines the annotation on the page

To add a resource redaction annotation, follow these steps:

  1. Instantiate the Annotator class. Specify the input document path or stream.
  2. Instantiate the ResourceRedactionAnnotation class. Specify the appropriate properties (position, page number, etc).
  3. Call the Add method. Specify the ResourceRedactionAnnotation class.
  4. Call the Save method. Specify the output document path or stream. 

The following code snippet shows how to add ResourcesRedactionAnnotation to the document:

//Add resource redaction annotation to the document from local disk
using (Annotator annotator = new Annotator("input.pdf"))
{
	ResourcesRedactionAnnotation resourcesRedaction = new ResourcesRedactionAnnotation
    {
    	Box = new Rectangle(100, 100, 100, 100),
        CreatedOn = DateTime.Now,
        Message = "This is resources redaction annotation",
        PageNumber = 0,
        Replies = new List<Reply>
        {
        	new Reply
            {
            	Comment = "First comment",
                RepliedOn = DateTime.Now
            },
            new Reply
            {
            	Comment = "Second comment",
                RepliedOn = DateTime.Now
            }
        }
   };
   annotator.Add(resourcesRedaction);
   annotator.Save("result.pdf");
} 

On this page