VintaSoft Twain .NET SDK 14.1: Руководство для .NET разработчика
В этом разделе
    Как сканировать страницы из автоматического лотка подачи документов (ADF) TWAIN сканера?
    В этом разделе
    Класс Vintasoft.Twain.DocumentFeeder позволяет управлять лотком подачи документов TWAIN сканера.



    Вот C#/VB.NET код, который демонстрирует, как использовать лоток подачи документов TWAIN сканера:
    /// <summary>
    /// Acquire images from the document feeder.
    /// </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 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 document feeder.
    ''' </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(200F, 200F)
    
            ' if device has 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