How to detect that paper is loaded in automatic document feeder of TWAIN image scanner?
In This Topic
If you need to detect that paper is loaded in automatic document feeder of TWAIN image scanner, you need to do the following steps:
- First, check if TWAIN image scanner can detect the paper in the automatic document feeder - this can be done using the DocumentFeeder.PaperDetectable property.
- Next, check if paper is loaded in the automatic document feeder - this can be done using the DocumentFeeder.Loaded property.
Here is an example that demonstrates how to detect if paper is loaded in the automatic document feeder of TWAIN device:
/// <summary>
/// Acquire images from the automatic document feeder of TWAIN device.
/// </summary>
public void AcquireImagesFromAdf(Vintasoft.Twain.Device device)
{
// disable UI
device.ShowUI = false;
// open the device
device.Open();
// specify that color images must be acquired
device.PixelType = Vintasoft.Twain.PixelType.RGB;
// set the inches as unit of measure
device.UnitOfMeasure = Vintasoft.Twain.UnitOfMeasure.Inches;
// set the desired resolution of acquired images
device.Resolution = new Vintasoft.Twain.Resolution(200f, 200f);
// if device has the automatic document feeder
if (device.HasFeeder)
{
// enable feeder
device.DocumentFeeder.Enabled = true;
// specify that application want to acquire all pages from the feeder
device.XferCount = -1;
// if pages can be scanned in duplex mode
if (device.DocumentFeeder.DuplexMode != Vintasoft.Twain.DuplexMode.None)
// enable duplex scanning
device.DocumentFeeder.DuplexEnabled = true;
// if feeder can detect paper
if (device.DocumentFeeder.PaperDetectable)
{
// if feeder is loaded
if (device.DocumentFeeder.Loaded)
// acquire images asynchronously
device.Acquire();
}
// if feeder cannot detect paper
else
// acquire images asynchronously
device.Acquire();
}
}
''' <summary>
''' Acquire images from the automatic document feeder of TWAIN device.
''' </summary>
Public Sub AcquireImagesFromAdf(device As Vintasoft.Twain.Device)
' disable UI
device.ShowUI = False
' open the device
device.Open()
' specify that color images must be acquired
device.PixelType = Vintasoft.Twain.PixelType.RGB
' set the inches as unit of measure
device.UnitOfMeasure = Vintasoft.Twain.UnitOfMeasure.Inches
' set the desired resolution of acquired images
device.Resolution = New Vintasoft.Twain.Resolution(200.0F, 200.0F)
' if device has the automatic document feeder
If device.HasFeeder Then
' enable feeder
device.DocumentFeeder.Enabled = True
' specify that application want to acquire all pages from the feeder
device.XferCount = -1
' if pages can be scanned in duplex mode
If device.DocumentFeeder.DuplexMode <> Vintasoft.Twain.DuplexMode.None Then
' enable duplex scanning
device.DocumentFeeder.DuplexEnabled = True
End If
' if feeder can detect paper
If device.DocumentFeeder.PaperDetectable Then
' if feeder is loaded
If device.DocumentFeeder.Loaded Then
' acquire images asynchronously
device.Acquire()
End If
Else
' if feeder cannot detect paper
' acquire images asynchronously
device.Acquire()
End If
End If
End Sub