javatwain may be a powerful solutionyou can go to wwwgnomesk to download the newest package
JavaTwain version is a part of the Morena Framework now
below is an simple example:
/*
* $Id: ExampleShowjavav // :: mmotovsk Exp $
*
* Copyright (c) Gnome spol s ro All Rights Reserved
*
* This software is the confidential and proprietary information of
* Gnome spol s ro You shall not disclose such Confidential
* Information and shall use it only in accordance with the terms
* of the license agreement you entered into with Gnome
*/
// JavaTwain package version
/**
ExampleShow demonstrates how to scan an image using defaults
from the Twain source <BR>
*/
import javaawt*;
import javaawtevent*;
import SKgnometwain*;
public class ExampleShow extends Frame
{ Image image;
public void paint(Graphics g)
{ if (null!=image)
gdrawImage(image this);
}
WindowListener windowAdapter=new WindowAdapter()
{ public void windowClosing(WindowEvent e)
{ Systemexit();
}
};
public ExampleShow()
{ try
{ addWindowListener(windowAdapter);
setTitle(ExampleShow Frame Application);
// Open TWAIN select source dialog box
// and initialize the source selected by the user
TwainSource source=TwainManagerselectSource(null);
image=ToolkitgetDefaultToolkit()createImage(source);
// wait for the image to be completed
MediaTracker tracker=new MediaTracker(this);
trackeraddImage(image );
// this is the moment the scanner user interface pops up
Systemerrprintln(Start loading image );
try
{ trackerwaitForAll();
}
catch (InterruptedException e)
{ Systemerrprintln(Image loading was interrupted!);
eprintStackTrace();
}
trackerremoveImage(image);
Systemerrprintln(Image loaded );
setSize(imagegetWidth(this) imagegetHeight(this));
setVisible(true);
TwainManagerclose();
}
catch (TwainException e)
{ eprintStackTrace();
}
}
public static void main(String[] args)
{ new ExampleShow();
}
}