VintaSoft Twain .NET SDK v10.2
DeviceCameraCollection Class
Members  Example 




Vintasoft.WpfTwain Namespace : DeviceCameraCollection Class
Class that represents a collection of cameras supported by device.
Object Model
DeviceCameraCollection Class
Syntax
'Declaration
 
Public Class DeviceCameraCollection 
'Usage
 
Dim instance As DeviceCameraCollection
public class DeviceCameraCollection 
public __gc class DeviceCameraCollection 
public ref class DeviceCameraCollection 
Example
This example shows how to use Dual Stream feature of Kodak scanner.
Private Shared Sub AcquiredImagesWithDualStream()
    ' create the device manager
    Using deviceManager As New DeviceManager()
        ' open the device manager
        deviceManager.Open()
            
        ' get reference to Kodak scanner
        Dim device As Device = deviceManager.Devices.Find("KODAK Scanner: i1410/i1420/i1440")
            
        ' disable UI
        device.ShowUI = False
            
        ' open device
        device.Open()
            
        ' set inches as units of measure
        device.UnitOfMeasure = 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 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 Resolution(200, 200)
        ' enable black-white camera
        device.Cameras.EnableSelectedCamera()
            
            
        ' modally acquire images from the scanner
        Dim acquireModalState1 As AcquireModalState = AcquireModalState.None
        Dim acquiredImageInfo As ImageInfo
        Do
            ' acquire image from scanner
            acquireModalState1 = device.AcquireModal()
            
            ' write information about acquired image
            If acquireModalState1 = AcquireModalState.ImageAcquired Then
                ' get info about acquired image
                acquiredImageInfo = device.AcquiredImage.ImageInfo
                ' output info about acquired image
                Console.WriteLine(acquiredImageInfo.PixelType.ToString() + " " + acquiredImageInfo.Resolution.ToString())
            
                ' dispose the acquired image
                device.AcquiredImage.Dispose()
            End If
        Loop While acquireModalState1 <> AcquireModalState.None
            
            
        ' close the device
        device.Close()
            
        ' close TWAIN device manager
        deviceManager.Close()
    End Using
End Sub
private static void AcquiredImagesWithDualStream()
{
    // create the device manager
    using (DeviceManager deviceManager = new DeviceManager())
    {
        // open the device manager
        deviceManager.Open();
            
        // get reference to Kodak scanner
        Device device = deviceManager.Devices.Find("KODAK Scanner: i1410/i1420/i1440");
            
        // disable UI
        device.ShowUI = false;
            
        // open device
        device.Open();
            
        // set inches as units of measure
        device.UnitOfMeasure = 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 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 Resolution(200, 200);
        // enable black-white camera
        device.Cameras.EnableSelectedCamera();
            
            
        // modally acquire images from the scanner
        AcquireModalState acquireModalState = AcquireModalState.None;
        ImageInfo acquiredImageInfo;
        do
        {
            // acquire image from scanner
            acquireModalState = device.AcquireModal();
            
            // write information about acquired image
            if (acquireModalState == AcquireModalState.ImageAcquired)
            {
                // get info about acquired image
                acquiredImageInfo = device.AcquiredImage.ImageInfo;
                // output info about acquired image
                Console.WriteLine(acquiredImageInfo.PixelType.ToString() + " " + acquiredImageInfo.Resolution.ToString());
            
                // dispose the acquired image
                device.AcquiredImage.Dispose();
            }
        }
        while (acquireModalState != AcquireModalState.None);
            
        // close the device
        device.Close();
            
        // close TWAIN device manager
        deviceManager.Close();
    }
}
Inheritance Hierarchy

System.Object
   Vintasoft.WpfTwain.DeviceCameraCollection

Requirements

Target Platforms: Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

See Also

Reference

DeviceCameraCollection Members
Vintasoft.WpfTwain Namespace