Add replies to annotation

On this page

GroupDocs.Annotation allows you to collaborate over document using annotations and annotation replies.

To update an annotation reply, follow these steps:

  1. Instantiate the Annotator class. Specify the input document path or stream.
  2. Instantiate the User class.
  3. Instantiate the Reply class(es).
  4. Instantiate the annotation object of the appropriate type. Available annotation types are listed here.
  5. Assign the User class to Reply.User property (by default it is “Guest”).
  6. Assign the Reply class(es) to the Replies collection created at previous steps.
  7. Call the  Add method of the Annotator class. Specify the annotation.
  8. Call the Save method. Specify the output document path or stream.

The following code snippet shows how to add replies to annotation:

using (Annotator annotator = new Annotator("input.pdf"))
{
	User user1 = new User
	{
		Id = 1,
		Name = "Tom",
		Email = "somemail@mail.com"
	};
	User user2 = new User
	{
		Id = 2,
		Name = "Jack",
		Email = "somebody@mail.com"
	};
	AreaAnnotation area = new AreaAnnotation
	{
		Box = new Rectangle(100, 100, 100, 100),
		CreatedOn = DateTime.Now,
		Message = "This is an area annotation",
		PageNumber = 0,
		Replies = new List<Reply>
		{
			new Reply
			{
				Id = 1,
				Comment = "First comment",
				RepliedOn = DateTime.Now,
				User = user1
			},
			new Reply
			{
				Id = 2,
				Comment = "Second comment",
				RepliedOn = DateTime.Now,
				User = user2,
			}
		}
	};
annotator.Add(area);
annotator.Save("result.pdf");
}

On this page