VintaSoft Twain .NET SDK Discussions
Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.
Board index < VintaSoft Twain < VintaSoft Twain .NET SDK Discussions
Dim mem As MemoryStream = VSTwain1.GetImageAsStream(0, ImageFileFormat.PDF)And here is an example that shows how to save all acquired images as a single PDF document in a stream:
Public Sub ScanWithUI()
Dim mem As MemoryStream
VSTwain1.AppProductName = "MyTwainApplication"
Try
VSTwain1.StartDevice()
VSTwain1.SelectSource()
VSTwain1.ShowUI = true
VTwain1.MaxImages = 1
Dim firstImage As Boolean = True
While VSTwain1.AcquireModal()
If firstImage Then
' Create memory stream and place the first image to it
mem = VSTwain1.GetImageAsStream(0, ImageFileFormat.PDF)
firstImage = False
Else
' Add second and next images to the stream
VSTwain1.SaveImageToStream(0, mem, ImageFileFormat.PDF)
End If
End While
Catch ex As TwainException
MsgBox ex.Message
Catch ex As ImagingException
MsgBox ex.Message
End Try
...
' Upload stream data to server or something else...
...
End Sub
Best regards, Alexander