User roles

Starting from version 22.11 it is possible to specify a user role for each user.

While working with the replies, you can attach a User object to any Reply. This user object often represents the author of the reply. From now you can also secify a role of the user. If the user role is “Viewer”, his replies will not be applied to the document. If the user role is “Editor”, his replies will be applied. This functionality allows you to control whether user can or cannot leave his comments on the document.

This sample shows how you can add a user role:


using (Annotator annotator = new Annotator("input.pdf-file"))
{
  AreaAnnotation area = new AreaAnnotation
  {
    BackgroundColor = 65535,
    Box = new Rectangle(100, 100, 100, 100),
    CreatedOn = DateTime.Now,
    Message = "This is area annotation",
    Opacity = 0.7,
    PageNumber = 0,
    Replies = new List<Reply>
    {
        new Reply 
        {
            Comment = "This comment will be applied",
            RepliedOn = DateTime.Now,
            User = new User(1, "Reviewer", Role.Editor)
        },
        new Reply
        {
            Comment = "This comment will NOT be applied",
            RepliedOn = DateTime.Now,
            User = new User(1, "Member", Role.Viewer)
        }
    }
  };

  annotator.Add(area);
  annotator.Save("result_export");
}

More resources

GitHub Examples

You may easily run the code above and see the feature in action in our GitHub examples:

Free Online App

Along with full-featured .NET library we provide simple but powerful free Apps. You are welcome to annotate your PDF, DOC or DOCX, XLS or XLSX, PPT or PPTX, PNG and other documents with free to use online GroupDocs Annotation App.