using GroupDocs.Annotation;
using GroupDocs.Annotation.Models;
using GroupDocs.Annotation.Models.AnnotationModels;
using System.Collections.Generic;
using System;

namespace AddTextRedactionAnnotationinPDFUsingCSharp
{
    internal class Program
    {
        static void Main(string[] args)
        {
            // Set License to avoid the limitations of Annotation library
            License lic = new License();
            lic.SetLicense(@"GroupDocs.Annotation.lic");

            // Instantiate Annotator object by passing path of PDF
            // file to its constructor
            using (Annotator annotator = new Annotator("input.pdf"))
            {
                TextRedactionAnnotation textRedaction = new TextRedactionAnnotation
                {
                    CreatedOn = DateTime.Now,
                    Message = "This is text redaction annotation",
                    FontColor = 16761035,
                    PageNumber = 0,
                    Points = new List<Point>
                    {
                        new Point(80, 730), new Point(240, 730), new Point(80, 650), new Point(240, 650)
                    },
                                Replies = new List<Reply>
                    {
                        new Reply
                        {
                            Comment = "First comment",
                            RepliedOn = DateTime.Now
                        },
                        new Reply
                        {
                            Comment = "Second comment",
                            RepliedOn = DateTime.Now
                        }
                     }
                };
                // Add text redaction annotation
                annotator.Add(textRedaction);
                // Save the final PDF to disk
                annotator.Save("result.pdf");
            }
        }
    }
}