usmanazizgroupdocs
3/15/2016 - 5:45 PM

SetBackgroundColorResult.vb

' 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 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)

' Set background color of annotation