VintaSoft Twain .NET SDK 15.3: Documentation for .NET developer
In This Topic
    How to use the Dual Stream feature of Kodak scanner?
    In This Topic
    VintaSoft TWAIN .NET SDK allows to use the Dual Stream feature of Kodak scanners.

    Dual Stream feature means that scanner has some "cameras" and can make some snapshots of each acquired page. Each camera has predefined settings (pixel type and page side) and customizable settings (resolution, brightness, contrast, threshold, filters, etc).

    For example, most of Kodak scanners has 6 cameras:

    Here is an example that demonstrates how to acquire both sides of page as black-white and color images with different resolutions:
    /// <summary>
    /// Synchronously acquire images from Kodak scanner and uses Kodak dual stream feature.
    /// </summary>
    public void SynchronouslyAcquireImagesFromKodakScannerAndUseDualStreamFeature()
    {
        try
        {
            using (Vintasoft.Twain.DeviceManager deviceManager = new Vintasoft.Twain.DeviceManager())
            {
                // open the device manager
                deviceManager.Open();
    
                // get reference to the default device
                Vintasoft.Twain.Device device = deviceManager.DefaultDevice;
    
                // set scanning settings
                device.TransferMode = Vintasoft.Twain.TransferMode.Memory;
                device.ShowUI = false;
    
                // open the device
                device.Open();
    
                // set inches as units of measure
                device.UnitOfMeasure = Vintasoft.Twain.UnitOfMeasure.Inches;
                // enable duplex
                device.DocumentFeeder.DuplexEnabled = true;
    
                // select color camera
                device.Cameras.SetSelectedCamera("/Camera_Color_Both");
                // set resolution for color images
                device.Resolution = new Vintasoft.Twain.Resolution(300, 300);
                // enable color camera
                device.Cameras.EnableSelectedCamera();
    
                // select black-white camera
                device.Cameras.SetSelectedCamera("/Camera_Bitonal_Both");
                // set resolution for black-white images
                device.Resolution = new Vintasoft.Twain.Resolution(200, 200);
                // enable black-white camera
                device.Cameras.EnableSelectedCamera();
    
                // synchronously acquire image(s) from TWAIN device
                Vintasoft.Twain.AcquireModalState acquireModalState;
                do
                {
                    acquireModalState = device.AcquireModal();
                    switch (acquireModalState)
                    {
                        case Vintasoft.Twain.AcquireModalState.ImageAcquired:
                            // get info about acquired image
                            Vintasoft.Twain.ImageInfo acquiredImageInfo = device.AcquiredImage.ImageInfo;
                            // show message box with info about acquired image
                            System.Console.WriteLine(string.Format("{0} {1}", acquiredImageInfo.PixelType, acquiredImageInfo.Resolution));
    
                            // dispose the acquired image
                            device.AcquiredImage.Dispose();
                            break;
    
                        case Vintasoft.Twain.AcquireModalState.ScanCompleted:
                            // output current state
                            System.Console.WriteLine("Scan completed.");
                            break;
    
                        case Vintasoft.Twain.AcquireModalState.ScanCanceled:
                            // output current state
                            System.Console.WriteLine("Scan canceled.");
                            break;
    
                        case Vintasoft.Twain.AcquireModalState.ScanFailed:
                            // output current state
                            System.Console.WriteLine(string.Format("Scan failed: {0}", device.ErrorString));
                            break;
                    }
                }
                while (acquireModalState != Vintasoft.Twain.AcquireModalState.None);
    
                // close the device
                device.Close();
    
                // close the device manager
                deviceManager.Close();
            }
        }
        catch (Vintasoft.Twain.TwainException ex)
        {
            System.Console.WriteLine("Error: " + ex.Message);
        }
    
        System.Console.ReadLine();
    }
    
    ''' <summary>
    ''' Synchronously acquire images from Kodak scanner and uses Kodak dual stream feature.
    ''' </summary>
    Public Sub SynchronouslyAcquireImagesFromKodakScannerAndUseDualStreamFeature()
        Try
            Using deviceManager As New Vintasoft.Twain.DeviceManager()
                ' open the device manager
                deviceManager.Open()
    
                ' get reference to the default device
                Dim device As Vintasoft.Twain.Device = deviceManager.DefaultDevice
    
                ' set scanning settings
                device.TransferMode = Vintasoft.Twain.TransferMode.Memory
                device.ShowUI = False
    
                ' open the device
                device.Open()
    
                ' set inches as units of measure
                device.UnitOfMeasure = Vintasoft.Twain.UnitOfMeasure.Inches
                ' enable duplex
                device.DocumentFeeder.DuplexEnabled = True
    
                ' select color camera
                device.Cameras.SetSelectedCamera("/Camera_Color_Both")
                ' set resolution for color images
                device.Resolution = New Vintasoft.Twain.Resolution(300, 300)
                ' enable color camera
                device.Cameras.EnableSelectedCamera()
    
                ' select black-white camera
                device.Cameras.SetSelectedCamera("/Camera_Bitonal_Both")
                ' set resolution for black-white images
                device.Resolution = New Vintasoft.Twain.Resolution(200, 200)
                ' enable black-white camera
                device.Cameras.EnableSelectedCamera()
    
                ' synchronously acquire image(s) from TWAIN device
                Dim acquireModalState As Vintasoft.Twain.AcquireModalState
                Do
                    acquireModalState = device.AcquireModal()
                    Select Case acquireModalState
                        Case Vintasoft.Twain.AcquireModalState.ImageAcquired
                            ' get info about acquired image
                            Dim acquiredImageInfo As Vintasoft.Twain.ImageInfo = device.AcquiredImage.ImageInfo
                            ' show message box with info about acquired image
                            System.Console.WriteLine(String.Format("{0} {1}", acquiredImageInfo.PixelType, acquiredImageInfo.Resolution))
    
                            ' dispose the acquired image
                            device.AcquiredImage.Dispose()
                            Exit Select
    
                        Case Vintasoft.Twain.AcquireModalState.ScanCompleted
                            ' output current state
                            System.Console.WriteLine("Scan completed.")
                            Exit Select
    
                        Case Vintasoft.Twain.AcquireModalState.ScanCanceled
                            ' output current state
                            System.Console.WriteLine("Scan canceled.")
                            Exit Select
    
                        Case Vintasoft.Twain.AcquireModalState.ScanFailed
                            ' output current state
                            System.Console.WriteLine(String.Format("Scan failed: {0}", device.ErrorString))
                            Exit Select
                    End Select
                Loop While acquireModalState <> Vintasoft.Twain.AcquireModalState.None
    
                ' close the device
                device.Close()
    
                ' close the device manager
                deviceManager.Close()
            End Using
        Catch ex As Vintasoft.Twain.TwainException
            System.Console.WriteLine("Error: " + ex.Message)
        End Try
    
        System.Console.ReadLine()
    End Sub