' For complete examples and data files, please go to https://github.com/groupdocs-annotation/GroupDocs.Annotation-for-.NET
' Create instance of annotator.
Dim cfg As AnnotationConfig = CommonUtilities.GetConfiguration()
Dim annotator As New AnnotationImageHandler(cfg)
Dim documentRepository As IDocumentDataHandler = annotator.GetDocumentDataHandler()
If Not Directory.Exists(cfg.StoragePath) Then
Directory.CreateDirectory(cfg.StoragePath)
End If
' Create document data object in storage.
Dim document = documentRepository.GetDocument("Document.pdf")
Dim documentId As Long = If(document IsNot Nothing, document.Id, annotator.CreateDocument("Document.pdf"))
' Create annotation object
Dim pointAnnotation As New AnnotationInfo() With { _
.AnnotationPosition = New Point(852.0, 81.0), _
.Box = New Rectangle(212.0F, 81.0F, 142.0F, 0.0F), _
.Type = AnnotationType.Point, _
.PageNumber = 0, _
.CreatorName = "Anonym", _
.DocumentGuid = documentId _
}
' Add annotation to storage
Dim createPointAnnotationResult As CreateAnnotationResult = annotator.CreateAnnotation(pointAnnotation)
'=============================================================================
' Create annotation object
Dim textFieldAnnotation As New AnnotationInfo() With { _
.AnnotationPosition = New Point(852.0, 201.0), _
.FieldText = "text in the box", _
.FontFamily = "Arial", _
.FontSize = 10, _
.Box = New Rectangle(66.0F, 201.0F, 64.0F, 37.0F), _
.PageNumber = 0, _
.Type = AnnotationType.TextField, _
.CreatorName = "Anonym", _
.DocumentGuid = documentId _
}
'Add annotation to storage
Dim createTextFieldAnnotationResult As CreateAnnotationResult = annotator.CreateAnnotation(textFieldAnnotation)
' Get annotation from storage