HOME

&& Acquire multiples images from twain device to 1 Bpp CCITT4 multipage tif with visual basic and GdPicture Pro ActiveX
&& Download the last version of GdPicture at http://www.gdpicture.com



  
Dim nImageCount As Long
Dim nImageID As Long
Dim Imaging As Object

Set Imaging = CreateObject("gdpicturepro5.imaging")

Imaging.SetLicenseNumber ("0012345678910111213141516") 'Demo code version

If Imaging.TwainOpenDefaultSource() Then
   nImageCount = 0
   Imaging.TwainSetHideUI(True)
   Imaging.TwainSetAutoFeed (True) 'Set AutoFeed Enabled
   Imaging.TwainSetAutoScan (True) 'To  achieve the maximum scanning rate
   Imaging.TwainSetCurrentResolution (200)
   Imaging.TwainSetCurrentPixelType (TWPT_BW) 'BW
   Imaging.TwainSetCurrentBitDepth (1) ' 1 bpp

   While Imaging.CreateImageFromTwain(Me.hWnd) <> 0
         nImageID = Imaging.GetNativeImage
         nImageCount = nImageCount + 1
         If nImageCount = 1 Then
            Call Imaging.TiffSaveAsNativeMultiPage(App.Path & "\multipage.tif", 4)
         Else
            Imaging.TiffAddToNativeMultipage (nImageID)
            Imaging.CloseImage (nImageID)
         End If
   Wend

   Imaging.TiffCloseNativeMultiPage
   Imaging.TwainCloseSource
   MsgBox "Done !"

Else
   MsgBox "can't open default source, twain state is: " & Trim(Str(Imaging.TwainGetState))
End If