usmanazizgroupdocs
3/15/2016 - 5:41 PM

AddTextFieldAnnotation.vb

' For complete examples and data files, please go to https://github.com/groupdocsannotation/GroupDocs_Annotation_NET
Try
    ' Get input file stream
    Dim inputFile As Stream = New FileStream(CommonUtilities.MapSourceFilePath(filePath), FileMode.Open, FileAccess.ReadWrite)

    ' Initialize list of AnnotationInfo
    Dim annotations As New List(Of AnnotationInfo)()

    ' Text field annotation
    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 A." _
    }
    ' Add annotation to list
    annotations.Add(textFieldAnnotation)
    ' Export annotation and save output file
    CommonUtilities.SaveOutputDocument(inputFile, annotations, DocumentType.Pdf)
Catch exp As Exception
    Console.WriteLine(exp.Message)
End Try