In This Topic
SANE stands for "Scanner Access Now Easy" and is an application programming interface (API) that provides standardized access to any raster image scanner hardware.
libsane is a library, which implements SANE API in Linux. Libsane file has the following path "/usr/lib/x86_64-linux-gnu/libsane.so.1" in Debian/Ubuntu. Libsane file has the following path "/usr/lib64/libsane.so.1" in Fedora.
VintaSoft TWAIN .NET SDK provides the SANE device manager that provides access to SANE devices using libsane library.
For working with SANE device manager it is necessary to create an instance of
SaneLocalDeviceManager class. The
SaneLocalDeviceManager.IsSaneAvailable property allows to check if SANE is available (libsane library is installed) in the system. The
SaneLocalDeviceManager.SaneLibPath property allows to define a custom path to the libsane library.
Here is an example that demonstrates how to check if SANE is available in the system:
/// <summary>
/// Checks that SANE is available in the system.
/// </summary>
void CheckSane()
{
// create the SANE device manager
using (Vintasoft.Sane.SaneLocalDeviceManager deviceManager = new Vintasoft.Sane.SaneLocalDeviceManager())
{
if (deviceManager.IsSaneAvailable)
System.Console.WriteLine("SANE is available.");
else
System.Console.WriteLine("SANE is NOT available.");
}
}
''' <summary>
''' Checks that SANE is available in the system.
''' </summary>
Private Sub CheckSane()
' create the SANE device manager
Using deviceManager As New Vintasoft.Sane.SaneLocalDeviceManager()
If deviceManager.IsSaneAvailable Then
System.Console.WriteLine("SANE is available.")
Else
System.Console.WriteLine("SANE is NOT available.")
End If
End Using
End Sub
Here is an example that demonstrates how to open SANE device manager and display information about all available SANE devices:
/// <summary>
/// Opens SANE device manager and displays information about available local SANE image scanners.
/// </summary>
void GetSaneDevicesInfo()
{
// create SANE device manager
using (Vintasoft.Sane.SaneLocalDeviceManager deviceManager = new Vintasoft.Sane.SaneLocalDeviceManager())
{
// open device manager
deviceManager.Open();
Vintasoft.Sane.SaneLocalDeviceCollection devices = deviceManager.Devices;
// for each SANE device
for (int i = 0; i < devices.Count; i++)
{
// output the device name
System.Console.WriteLine(string.Format("Device '{0}'", devices[i].Name));
}
}
}
''' <summary>
''' Opens SANE device manager and displays information about available local SANE image scanners.
''' </summary>
Private Sub GetSaneDevicesInfo()
' create SANE device manager
Using deviceManager As New Vintasoft.Sane.SaneLocalDeviceManager()
' open device manager
deviceManager.Open()
Dim devices As Vintasoft.Sane.SaneLocalDeviceCollection = deviceManager.Devices
' for each SANE device
For i As Integer = 0 To devices.Count - 1
' output the device name
System.Console.WriteLine(String.Format("Device '{0}'", devices(i).Name))
Next
End Using
End Sub