GroupDocsGists
10/19/2017 - 11:28 AM

AddUnderLineAnnotation.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)()

    ' Underline annotation
    Dim underlineAnnotation As New AnnotationInfo() With { _
          .Box = New Rectangle(CSng(248.57), CSng(1135.78), CSng(222.67), 27), _
          .PageNumber = 1, _
          .SvgPath = "[{""x"":248.57,""y"":503.507},{""x"":471,""y"":503.507},{""x"":248.57,""y"":468.9},{""x"":471,""y"":468.9}]", _
          .Type = AnnotationType.TextUnderline, _
          .CreatorName = "Anonym A." _
    }
    ' Add annotation to list
    annotations.Add(underlineAnnotation)
    ' Export annotation and save output file
    CommonUtilities.SaveOutputDocument(inputFile, annotations, DocumentType.Pdf)
Catch exp As Exception
    Console.WriteLine(exp.Message)
End Try