usmanazizgroupdocs
3/15/2016 - 5:44 PM

RemoveAnnotation.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 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 _
}

' Get all annotations from storage
Dim listAnnotationsResult As ListAnnotationsResult = annotator.GetAnnotations(documentId)

' Get annotation  
Dim annotation = annotator.GetAnnotation(listAnnotationsResult.Annotations(0).Guid)


' Delete single annotation
Dim deleteAnnotationResult = annotator.DeleteAnnotation(annotation.Id)

'Delete all annotations