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

namespace AddTextFieldAnnotationinPDFusingCSharp
{
    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"))
            {
                // Create an instance of TextFieldAnnotation class
                // and set some properties
                TextFieldAnnotation textfield = new TextFieldAnnotation
                {
                    BackgroundColor = 65535,
                    Box = new Rectangle(100, 100, 100, 100),
                    CreatedOn = DateTime.Now,
                    Text = "Some text",
                    FontColor = 65535,
                    FontSize = 12,
                    Message = "This is text field annotation",
                    Opacity = 0.7,
                    PageNumber = 0,
                    PenStyle = PenStyle.Dot,
                    PenWidth = 3,
                    FontFamily = "Arial",
                    TextHorizontalAlignment = HorizontalAlignment.Center,
                    Replies = new List<Reply>
                    {
                        new Reply
                        {
                            Comment = "First comment",
                            RepliedOn = DateTime.Now
                        },
                        new Reply
                        {
                            Comment = "Second comment",
                            RepliedOn = DateTime.Now
                        }
                    }
                };
                // Add text field annotation to Annotator
                annotator.Add(textfield);
                // Save the final PDF to disk
                annotator.Save("result.pdf");
            }
        }
    }
}