Here is the code I use to configure the scanner. I am offering three scan types for the customer to choose from (identified by the enum - B&W, Grayscale, and Color).
Perhaps I'm doing something incorrect?
Code: Select all
Private Sub Configure(ByVal settings As Settings)
m_gd.TwainSetHideUI(True)
m_gd.TwainSetAutoBrightness(True)
m_gd.TwainSetAutoFeed(settings.useADF)
m_gd.TwainEnableDuplex(settings.duplexScanning)
m_gd.TwainSetResolution(settings.dpi)
If (settings.paperSize <> GdPicture.TwainPaperSize.NONE) Then
m_gd.TwainSetAutoSize(False)
m_gd.TwainSetPaperSize(settings.paperSize)
Else
m_gd.TwainSetAutoSize(True)
End If
Select Case CType(settings.scanType, RGSettings.ScanningColorDefault)
Case RGSettings.ScanningColorDefault.BW
m_gd.TwainSetPixelType(TwainPixelType.TWPT_BW)
m_gd.TwainSetBitDepth(1)
Case RGSettings.ScanningColorDefault.Grayscale
m_gd.TwainSetPixelType(TwainPixelType.TWPT_GRAY)
m_gd.TwainSetBitDepth(1)
Case RGSettings.ScanningColorDefault.Color
m_gd.TwainSetPixelType(TwainPixelType.TWPT_RGB)
m_gd.TwainSetBitDepth(24)
Case RGSettings.ScanningColorDefault.Unknown
m_gd.TwainSetPixelType(TwainPixelType.TWPT_GRAY)
m_gd.TwainSetBitDepth(1)
End Select
End Sub