I am developing a java application that can search my system and find all the scanners and lets me select if there are more than one scanner installed and proceed for scanning the document. I understand i should use twain for this. I have a library file in my system path but i have no idea how do i use this. Are there any sample programs on how to use this in my java application.
I have found the below sample code that uses WIA for communicating with the scanners. Is there any jar file to import to my netbeans or is there any other way out.
WIA.DeviceManager manager = new WIA.DeviceManagerClass();
string deviceName = "";
foreach (WIA.DeviceInfo info in manager.DeviceInfos)
{
if (info.Type == WIA.WiaDeviceType.ScannerDeviceType)
{
foreach (WIA.Property p in info.Properties)
{
if (p.Name == "Name")
{
deviceName = ((WIA.IProperty)p).get_Value().ToString();
Console.WriteLine(deviceName);
}
}
}
}
I'm not sure what library you're using, but I'd recommend one of these two:
Morena (low price, good documentation and email correspondence):
mm's computing (open-source LGPL)
If you're willing to pay a small price I'd recommend Morena. With Morena 6 (TWAIN) I was able to make a scan applet (called externally) that returns base64 jpeg data, and only ended up with 145 lines of my own Java code. On top of that they have full working examples and a very good FAQ page that covered almost every error I encountered. I haven't played with mms computing's plugin much because I didn't find out about it until after the Morena project was done.