WIA Scanning Problems

Thanks for reading,

I am attempting to write a VB.NET application using WIA 2.0. I can scan fine using the method “ShowAcquireImage”. Using this method, it opens the WIA common Dialog and I can select my feeder tray and page size and everything is good except it only creates one image file.

I need to scan multiple documents and create multiple image (TIFF) files.

I then attempt to use the below code.

Dim manager As WIA.DeviceManager = New WIA.DeviceManager()
Dim device As WIA.Device = Nothing

        For Each info As WIA.DeviceInfo In manager.DeviceInfos
            If info.DeviceID = deviceID Then
                device = info.Connect()
                Exit For
            End If
        Next

        Dim item As Item = device.Items(1)

SetDeviceProperty(device, WIA_PROPERTIES.WIA_DPS_DOCUMENT_HANDLING_SELECT, source)

        Dim handlingStatus As Integer = GetDeviceProperty(device, WIA_PROPERTIES.WIA_DPS_DOCUMENT_HANDLING_STATUS)

        If (source = ScanSourceTray.DocumentFeeder AndAlso handlingStatus = WIA_DPS_DOCUMENT_HANDLING.FEEDER) OrElse
            (source = ScanSourceTray.Flatbed AndAlso handlingStatus = WIA_DPS_DOCUMENT_HANDLING.FLATBED) Then

            Do
                Dim wiaImage As ImageFile = Nothing

                Try
                    wiaImage = DirectCast(item.Transfer(WIAScanner.WIA_IMAGE_FORMAT_TIFF), ImageFile)

But this will NOT recognize my feeder tray on the scanner. It always scans my flatbed instead of feeder tray.

Also, when I set the paper size for the device property it throws an error saying “range is not supported”.

Please help… I am desperate and my company says I cannot buy a 3rd party tool to implement this functionality.

Thanks

.NET Foundation Website | Blog | Projects | Code of Conduct