' For complete examples and data files, please go to https://github.com/groupdocs-annotation/GroupDocs.Annotation-for-.NET
''' <summary>
''' Gets image representation of document
''' </summary>
''' <param name="filePath">Source file path</param>
Public Shared Sub GetImageRepresentation(filePath As String)
Try
Dim document As Stream = New FileStream(MapSourceFilePath(filePath), FileMode.Open)
Dim cfg As AnnotationConfig = GetConfiguration()
Dim annotationHandler As New AnnotationImageHandler(cfg)
Dim images As List(Of PageImage) = annotationHandler.GetPages(document, New ImageOptions())
' Save result stream to file.
Using fileStream As New FileStream(MapDestinationFilePath("image.png"), FileMode.Create)
Dim buffer As Byte() = New Byte(images(0).Stream.Length - 1) {}
images(0).Stream.Seek(0, SeekOrigin.Begin)
images(0).Stream.Read(buffer, 0, buffer.Length)
fileStream.Write(buffer, 0, buffer.Length)
fileStream.Close()
End Using
Catch exp As System.Exception
Console.WriteLine(exp.Message)
End Try
End Sub