Как отсканировать верхнюю сторону страницы с помощью TWAIN-сканера?
В этом разделе
Класс Vintasoft.Twain.DeviceImageLayout позволяет управлять компоновкой изображения на устройстве.
Вот пример, который демонстрирует, как получить только верхнюю сторону страницы:
/// <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;
// specify that page size is undefined
device.PageSize = Vintasoft.Twain.PageSize.None;
// 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
' specify that page size is undefined
device.PageSize = Vintasoft.Twain.PageSize.None
' 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