// For complete examples and data files, please go to https://github.com/groupdocs-annotation/GroupDocs.Annotation-for-Java
try {
AnnotationConfig cfg = Utilities.getConfiguration();
AnnotationImageHandler annotator = new AnnotationImageHandler(cfg);
IDocumentDataHandler documentRepository = annotator.getDocumentDataHandler();
// Create document data object in storage
Document document = documentRepository.getDocument(fileName);
long documentId = document == null ? annotator.createDocument(fileName) : document.getId();
// Set document access rights
annotator.setDocumentAccessRights(documentId, AnnotationReviewerRights.All);
} catch (Exception e) {
System.out.println("Exception: " + e.getMessage());
e.printStackTrace();
}