Как создать предопределенную настройку сеанса для сканера TWAIN с большим рабочим объемом?
В этом разделе
SDK позволяет загружать/сохранять предопределенные настройки сеансов для сканеров TWAIN среднего и большого объема.
Вот пример, который демонстрирует, как сохранить текущие настройки устройства в xml-файл:
/// <summary>
/// Saves the device settings.
/// </summary>
public void SaveDeviceSettings(Vintasoft.Twain.Device device)
{
// open the device
device.Open();
using (System.IO.FileStream fs = new System.IO.FileStream("scanner-setup.xml", System.IO.FileMode.Append, System.IO.FileAccess.Write))
{
device.SaveSettings(fs);
}
}
''' <summary>
''' Saves the device settings.
''' </summary>
Public Sub SaveDeviceSettings(ByVal device As Vintasoft.Twain.Device)
' open the device
device.Open()
Using fs As New System.IO.FileStream("scanner-setup.xml", System.IO.FileMode.Append, System.IO.FileAccess.Write)
device.SaveSettings(fs)
End Using
End Sub
Вот пример, который демонстрирует, как загрузить в устройство ранее сохраненные настройки устройства:
/// <summary>
/// Loads the device settings.
/// </summary>
public void LoadDeviceSettings(Vintasoft.Twain.Device device)
{
// open the device
device.Open();
using (System.IO.FileStream fs = new System.IO.FileStream("scanner-setup.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read))
{
device.LoadSettings(fs);
}
}
''' <summary>
''' Loads the device settings.
''' </summary>
Public Sub LoadDeviceSettings(ByVal device As Vintasoft.Twain.Device)
' open the device
device.Open()
Using fs As New System.IO.FileStream("scanner-setup.xml", System.IO.FileMode.Open, System.IO.FileAccess.Read)
device.LoadSettings(fs)
End Using
End Sub