GroupDocsGists
10/19/2017 - 11:27 AM

AddAreaAnnotationWithReplies.cs

// For complete examples and data files, please go to https://github.com/groupdocs-annotation/GroupDocs.Annotation-for-.NET
// Get input file stream
Stream inputFile = new FileStream(CommonUtilities.MapSourceFilePath(filePath), FileMode.Open, FileAccess.ReadWrite);
                
// Initialize list of AnnotationInfo
List<AnnotationInfo> annotations = new List<AnnotationInfo>();

// Area annotation with 2 replies
AnnotationInfo areaAnnnotation = new AnnotationInfo()
{
    AnnotationPosition = new Point(852.0, 59.0),
    Replies = new AnnotationReplyInfo[]
{
    new AnnotationReplyInfo
    {
        Message = "Hello!",
        RepliedOn = DateTime.Now,
        UserName = "John"
    },
    new AnnotationReplyInfo
    {
        Message = "Hi!",
        RepliedOn = DateTime.Now,
        UserName = "Judy"
    }
},
    BackgroundColor = 11111111,
    Box = new Rectangle(300f, 200f, 88f, 37f),
    PageNumber = 0,
    PenColor = 2222222,
    PenStyle = 1,
    PenWidth = 1,
    Type = AnnotationType.Area,
    CreatorName = "Anonym A."
};
// Add annotation to list
annotations.Add(areaAnnnotation);

// Export annotation and save output file
CommonUtilities.SaveOutputDocument(inputFile, annotations, DocumentType.Pdf);