VintaSoftTwain Control v6.0
VintaSoftTwain Object / Device_JobControl Property
In This Topic
    Device_JobControl Property
    In This Topic
    Description
    Gets or sets a code that defines how to work with batch job separators.
    Property type
    Read-write property
    Syntax
    Visual Basic
    Public Property Device_JobControl As Long
    Return Type
    Valid values:
    Value Action
    0 No job control.
    1 Detect and include job separator and continue scanning.
    2 Detect and include job separator and stop scanning.
    3 Detect and exclude job separator and continue scanning.
    4 Detect and exclude job separator and stop scanning.
    Remarks
    Call this property after Device_Open and before Device_AcquireImage.

    Information about error that occurs during getting property value can be get using the Error and ErrorString properties.
    Example
    This example shows how to enable job separation and acquire images from the device.
    Private VSTwain1 As New VintaSoftTwain()
    Private jobsCounter As Integer
    
    
    ''' <summary>
    ''' Scans images asynchronously.
    ''' </summary>
    Private Sub ScanImages()
        ' open the device manager
        If Not VSTwain1.DeviceManager_Open() Then
            Console.WriteLine(VSTwain1.errorString)
            Exit Sub
        End If
    
        ' open the device
        If Not VSTwain1.Device_Open Then
            Console.WriteLine(VSTwain1.errorString)
            Exit Sub
        End If
    
        ' scan images without UI
        VSTwain1.Device_ShowUI = False
    
        ' specify that acquired image must be added to an existing TIFF file
        VSTwain1.TiffEncoder_MultiPage = True
    
        ' initialize the job counter
        jobsCounter = 0
        ' specify that device must detect and include job separator and continue scanning
        VSTwain1.Device_JobControl = 1
    
        ' subscribe to the device events
        AddHandler VSTwain1.DeviceImageAcquired, AddressOf VSTwain1_ImageAcquired
        AddHandler VSTwain1.DeviceScanCompleted, AddressOf VSTwain1_ScanCompleted
        AddHandler VSTwain1.DeviceScanFailed, AddressOf VSTwain1_ScanFailed
        AddHandler VSTwain1.DeviceScanCanceled, AddressOf VSTwain1_ScanCanceled
    
        ' acquire images asynchronously
        VSTwain1.Device_AcquireImage()
    End Sub
    
    Private Sub VSTwain1_ImageAcquired()
        If VSTwain1.Device_EndOfJob = 1 Then
            jobsCounter = jobsCounter + 1
        Else
            ' get index of acquired image
            Dim imageIndex As Integer = VSTwain1.AcquiredImages_Count - 1
    
            ' save acquired image to TIFF file
            If Not VSTwain1.AcquiredImages_Save(imageIndex, "test.tiff") Then
                Console.WriteLine(VSTwain1.errorString)
            End If
        End If
    End Sub
    
    Private Sub VSTwain1_ScanCompleted()
        Console.WriteLine("Scan is completed.")
    End Sub
    
    Private Sub VSTwain1_ScanFailed(errorString As String)
        Console.WriteLine(String.Format("Scan is failed: {0}.", errorString))
    End Sub
    
    Private Sub VSTwain1_ScanCanceled()
        Console.WriteLine("Scan is canceled.")
    End Sub
    See Also