TWAIN Working Group

Newsletter Signup
Donate
Help keep TWAIN free
  • About TWAIN
    • What’s New?
    • News
    • Events
    • Membership
    • Consider a Donation
    • Contact Us
  • Why TWAIN?
  • Developers
    • Driver Developer
    • Application Developer
    • TWAIN Features
    • Specification & Tools
    • Self Certification Process
  • Support Forums
  • Scanner End-User
  • Find Certified Drivers
    • Facebook
    • LinkedIn
    • Vimeo

Reply To: From Java with user interface Twain

Forums › TWAIN Classic › From Java with user interface Twain › Reply To: From Java with user interface Twain

February 12, 2010 at 6:16 pm #24761
mmotovsk
Participant
  • Topics - 3
  • Replies - 13
  • Total Posts - 16

Hi!, I’m actually working with Java and I want to use Twain but I only want to scan from a scanner with a sets of parameters (Color, 300dpi). How can I do this without the user interfaze of Twain, only into a call to any function???

If you decide to use Morena Image Acquisition Framework for Java (http://www.gnome.sk), you can hide Twain User Interface window by calling setVisible(false) method of the TwainSource class. And then set all capabiities directly from your application. (It could happend, that setVisible method will be not implemented by the Twain driver.)
Here is a snapshot demonstrating how to do it:


TwainSource source = TwainManager.selectSource(null);
source.setVisible(false);
source.setColorMode();
source.setResolution(300);
MorenaImage morenaImage = new MorenaImage(source);
Image image=Toolkit.getDefaultToolkit().createImage(morenaImage);
TwainManager.close();

Now I have another problem. I want to scan in duplex mode and I don’t know how to capture the two images. Can you help me???.

Using Morena you can use the following code design:


TwainSource source=TwainManager.selectSource(null);
if (source!=null)
{
source.setDuplexEnabled(true);
source.setFeederEnabled(true);
source.setAutoFeed(true);
source.setTransferCount(-1);
int count=1;
do
{ MorenaImage image=new MorenaImage(source);
System.err.println("Size of acquired image "+(count++)+" is "
+image.getWidth()+" x "
+image.getHeight()+" x "
+image.getPixelSize());
}
while (source.hasMoreImages());
}
TwainManager.close();

Martin Motovsky
Member of Gnome’s technical support

Quick Links

Service Providers
TWAIN Support Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

TWAIN Working Group
TWAIN Direct®
TWAIN Resources
TWAIN Certified Drivers
PDF/raster

  • Facebook
  • GitHub
  • LinkedIn
  • Vimeo

Recent Topics

  • EPSON V600 TWAIN and WIA on Windows 10
  • When and how to use WaitForEvents command ?
  • Problem enumerating list of installed scanners in windows server 2012
  • Failed to create TWAIN progress! Error code is 1260.
  • To get the list of scanners from javascript client side (browser)
  • Quarterly Newsletter
  • TWAIN Working Group Membership
  • Logo Usage
  • TWAIN License
  • Contact Us
Privacy Policy • Privacy Tools • Copyright © 2021 TWAIN Working Group • by iHwy, LLC • Log in