Connecting to scanner/camera from java application can be easy
For those who need to take an image from a camera or scanner and are willing to do it directly from a java apllication:
There is the Java Twain Package at http://www.gnome.sk which is very intuitive to use. To find out, how this package works with your scanner or camera, it's enough to have Java (1.2 and higher) and a scanner or camera installed on your computer.
To test, how the package works with your scanner/camera, download the Java Twain trial version from
Unzipp it and go to the examples directory off the unzipped package.
There, doubleclick the runExample.bat file ( or runExampleShow.sh if you are in MacOS) .
This will pop up the Twain Source Selection user interface. There, all your
scanners which do have a MacOS twain drivers should be listed.
Select one of them.
The user interface of the selected scanner will appear.
Confirm the scanning (you can set the scanning parameters first).
The scanned image will be displayed in a separate window.
To end the application, close that window.
You can try other examples to see how to hide a user interface, how to save the scanned image, how to use ADF, ....
The online tutorial can be of great help too.
The download link of the Java Twain package has changed to:
The Java Twain Package has been renamed to Morena. Many usefull new features were added:
- AutomatedTest: a program for testing all get, set and getDefault methods. It creates a file containing all information about the capabilities of you scanner's (camera's) twain driver
- the resultCode and conditionCode in the debug log are descriptive instead of the original numerical ones
- ExampleShowAdvanced: demonstrates how to scan an image using defaults from the Twain source with better image source cancel/error handling.
- ExampleConsumer: demonstrates how to use a bespoke ImageConsumer to become independent on Morena
- setBuffer methods: enable you to alocate a buffer greater than one line, you can alocate a buffer for the whole image
Visit http://www.gnome.sk for more information
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL