VintaSoft Twain .NET SDK 14.0: Documentation for .NET developer
In This Topic
    How to scan the top part of page?
    In This Topic
    DeviceImageLayout class allows to control the image layout of the device.


    Here is an example that demonstrates how to acquire only the top part of page:
    /// <summary>
    /// Acquire a part of image.
    /// </summary>
    public void AcquireImagePart(Vintasoft.Twain.Device device)
    {
        // disable UI
        device.ShowUI = false;
    
        // open the device
        device.Open();
        // specify that black-white images must be acquired
        device.PixelType = Vintasoft.Twain.PixelType.BW;
        // set the inches as unit of measure
        device.UnitOfMeasure = Vintasoft.Twain.UnitOfMeasure.Inches;
        // get current image layout
        System.Drawing.RectangleF imageLayout = device.ImageLayout.Get();
        // set the image layout (get only the top half of the page)
        device.ImageLayout.Set(0, 0, imageLayout.Width, imageLayout.Height / 2); 
    
        // acquire images asynchronously
        device.Acquire();
    }
    
    ''' <summary>
    ''' Acquire a part of image.
    ''' </summary>
    Public Sub AcquireImagePart(ByVal device As Vintasoft.Twain.Device)
        ' disable UI
        device.ShowUI = False
    
        ' open the device
        device.Open()
        ' specify that black-white images must be acquired
        device.PixelType = Vintasoft.Twain.PixelType.BW
        ' set the inches as unit of measure
        device.UnitOfMeasure = Vintasoft.Twain.UnitOfMeasure.Inches
        ' get current image layout
        Dim imageLayout As System.Drawing.RectangleF = device.ImageLayout.[Get]()
        ' set the image layout (get only the top half of the page)
        device.ImageLayout.[Set](0, 0, imageLayout.Width, imageLayout.Height / 2)
    
        ' acquire images asynchronously
        device.Acquire()
    End Sub