VintaSoft Twain .NET SDK v10.2
How to scan the top part of page?

DeviceImageLayout class allows to control the image layout of the device.


Example: Here is an example that shows how to acquire only the top part of page.

''' <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
              
/// <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();
}