Fax VB.NET - Retrieve Inbound Fax Image with GetImageChunk
This fax VB.NET example uses GetImageChunk to retrieve a fax image in multiple chunks (chunk size is configurable). To retrieve the fax image, you need the fax message ID and file size. These can be retrieved using the GetList method.
The following snippet uses GetImageChunk to retrieve an image for an inbound (received) fax with VB.NET:
Sub Main() Dim username As String = "my username" Dim password As String = "my password" Dim chunkSize As Integer = 50000 Dim messageID As Integer = 212708286 Dim imageChunk() As Byte = Nothing Dim ifws As New interfax.Inbound Dim totalSize As Integer = 150058 ' this can be obtained by the GetList() method ' create a new local file Dim fs As New IO.FileStream("c:\temp\in.tif", IO.FileMode.Create) For i = 0 To totalSize - 1 Step chunkSize Dim st As Long = ifws.GetImageChunk(username, password, messageID, False, chunkSize, fs.Position, imageChunk) If st <> 0 Then Console.WriteLine("Result is: " & st & "; this is an error") Exit Sub End If fs.Write(imageChunk, 0, imageChunk.Length) Next fs.Close() Console.WriteLine("Image properly saved to file") End Sub

