// For complete examples and data files, please go to https://github.com/groupdocs-annotation/GroupDocs.Annotation-for-.NET
// Create instance of annotator.
AnnotationConfig cfg = CommonUtilities.GetConfiguration();
AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);
IDocumentDataHandler documentRepository = annotator.GetDocumentDataHandler();
if (!Directory.Exists(cfg.StoragePath))
{
Directory.CreateDirectory(cfg.StoragePath);
}
// Create document data object in storage
var document = documentRepository.GetDocument("Document.pdf");
long documentId = document != null ? document.Id : annotator.CreateDocument("Document.pdf");
// Create annotation object
AnnotationInfo pointAnnotation = new AnnotationInfo
{
AnnotationPosition = new Point(852.0, 81.0),
Box = new Rectangle(212f, 81f, 142f, 0.0f),
Type = AnnotationType.Point,
PageNumber = 0,
CreatorName = "Anonym",
DocumentGuid = documentId
};
// Add annotation to storage
var createPointAnnotationResult = annotator.CreateAnnotation(pointAnnotation);
// Add simple reply to created annotation
var addSimpleReplyResult = annotator.CreateAnnotationReply(createPointAnnotationResult.Id, "first question");
// Edit created reply
var editReplyResult = annotator.EditAnnotationReply(addSimpleReplyResult.ReplyGuid, "changed question");
// Create child reply. This reply will be linked to previously created reply.
var addChildReplyResult = annotator.CreateAnnotationReply(createPointAnnotationResult.Id, "answer", addSimpleReplyResult.ReplyGuid);
// Delete annotation reply by guid
var deleteReplyResult = annotator.DeleteAnnotationReply(addChildReplyResult.ReplyGuid);
// Delete all replies from annotation
annotator.DeleteAnnotationReplies(createPointAnnotationResult.Id);
// List of replies after deleting all replies
var listRepliesResultAfterDeleteAll = annotator.ListAnnotationReplies(createPointAnnotationResult.Id);