Home › Forums › TWAIN Classic › Morena vs bundled software
- This topic has 1 reply, 2 voices, and was last updated 13 years, 6 months ago by peterp.
- AuthorPosts
I am facing a little bit of confusion working with TWAIN driver. My Java application is using Morena to perform scanning against Fujitsu scanner fi-6750. This is the sample code :
try {
source = TwainManager.getDefaultSource();
source.setVisible(false);
source.setTransferMech(TwainConstants.TWSX_NATIVE);
source.setFeederEnabled(true);
source.setUnits(TwainConstants.TWUN_INCHES);
source.setPixelType(TwainConstants.TWPT_BW);
source.setResolution(200);
source.setImageFileFormat(TwainConstants.TWFF_TIFF);
source.setUndefinedImageSize(true);
source.setAutomaticBorderDetection(true);
source.setAutomaticDeskew(true);
source.setTransferCount(-1);
source.setAutoScan(true);
} catch (Exception ex) {
...
}
And the Morena debug log gave this :
...
23:48:09,185 DEBUG [root] -> TwainManagerImpl::TwainManagerImpl("Gnome s.r.o.", "Twain", "Morena", 6, 4)
23:48:09,215 DEBUG [root] state: PRESESSION -> DSM_LOADED
23:48:09,265 DEBUG [root] [CONTROL, PARENT, OPENDSM] -> [SUCCESS, SUCCESS]
23:48:09,265 DEBUG [root] state: DSM_LOADED -> DSM_OPEN
23:48:09,595 DEBUG [root] [CONTROL, IDENTITY, GETFIRST] -> [SUCCESS, SUCCESS]
23:48:09,595 DEBUG [root] -> TwainSourceImpl::TwainSourceImpl()
23:48:09,595 DEBUG [root] state: -> DSM_OPEN
23:48:09,595 DEBUG [root] fileAvailable: -> FALSE
23:48:09,595 DEBUG [root] <-
23:48:09,625 DEBUG [root] [CONTROL, IDENTITY, GETNEXT] -> [SUCCESS, SUCCESS]
23:48:09,625 DEBUG [root] -> TwainSourceImpl::TwainSourceImpl()
23:48:09,625 DEBUG [root] state: -> DSM_OPEN
23:48:09,625 DEBUG [root] fileAvailable: -> FALSE
23:48:09,625 DEBUG [root] <-
23:48:09,655 DEBUG [root] [CONTROL, IDENTITY, GETNEXT] -> [SUCCESS, SUCCESS]
23:48:09,655 DEBUG [root] -> TwainSourceImpl::TwainSourceImpl()
23:48:09,655 DEBUG [root] state: -> DSM_OPEN
23:48:09,655 DEBUG [root] fileAvailable: -> FALSE
23:48:09,655 DEBUG [root] <-
23:48:09,685 DEBUG [root] [CONTROL, IDENTITY, GETNEXT] -> [SUCCESS, SUCCESS]
23:48:09,685 DEBUG [root] -> TwainSourceImpl::TwainSourceImpl()
23:48:09,685 DEBUG [root] state: -> DSM_OPEN
23:48:09,685 DEBUG [root] fileAvailable: -> FALSE
23:48:09,685 DEBUG [root] <-
23:48:09,715 DEBUG [root] [CONTROL, IDENTITY, GETNEXT] -> [ENDOFLIST, SUCCESS]
23:48:09,715 DEBUG [root] <-
23:48:09,715 DEBUG [root] -> TwainManagerImpl::listSources()
23:48:09,715 DEBUG [root] <-
23:48:09,715 DEBUG [root] "FUJITSU fi-6750Sj #2 + sipc"[752]
23:48:09,715 DEBUG [root] "FUJITSU fi-6750Sj #2"[753]
23:48:09,715 DEBUG [root] "Kofax Software VRS - TWAIN"[754]
23:48:09,715 DEBUG [root] "WIA-fi-6750Sj"[755]
23:48:09,715 DEBUG [root]
23:48:09,715 DEBUG [root] -> TwainManagerImpl::getDefaultSource()
23:48:09,745 DEBUG [root] [CONTROL, IDENTITY, GETDEFAULT] -> [SUCCESS, SUCCESS]
23:48:09,745 DEBUG [root] <- "FUJITSU fi-6750Sj #2 + sipc"
23:48:09,745 DEBUG [root] -> TwainSourceImpl::setIntCapability("ICAP_XFERMECH", 259, 4, 0)
23:48:09,745 DEBUG [root] -> TwainSourceImpl::open() // "FUJITSU fi-6750Sj #2 + sipc"
23:48:11,395 DEBUG [root] [CONTROL, IDENTITY, OPENDS] -> [SUCCESS, SUCCESS]
23:48:11,395 DEBUG [root] state: DSM_OPEN -> DS_OPEN
23:48:11,405 DEBUG [root] <-
23:48:11,425 DEBUG [root] [CONTROL, CAPABILITY, SET] -> [SUCCESS, SUCCESS]
23:48:11,425 DEBUG [root] <-
23:48:11,425 DEBUG [root] -> TwainSourceImpl::setIntCapability("CAP_FEEDERENABLED", 4098, 6, 1)
23:48:11,445 DEBUG [root] [CONTROL, CAPABILITY, SET] -> [SUCCESS, SUCCESS]
23:48:11,445 DEBUG [root] <-
23:48:11,455 DEBUG [root] -> TwainSourceImpl::setIntCapability("ICAP_UNITS", 258, 4, 0)
23:48:11,475 DEBUG [root] [CONTROL, CAPABILITY, SET] -> [SUCCESS, SUCCESS]
23:48:11,475 DEBUG [root] <-
23:48:11,475 DEBUG [root] -> TwainSourceImpl::setIntCapability("ICAP_PIXELTYPE", 257, 4, 0)
23:48:11,495 DEBUG [root] [CONTROL, CAPABILITY, SET] -> [SUCCESS, SUCCESS]
23:48:11,505 DEBUG [root] <-
23:48:11,505 DEBUG [root] -> TwainSourceImpl::setDoubleCapability("ICAP_XRESOLUTION", 4376, 7, 200.000000)
23:48:11,525 DEBUG [root] [CONTROL, CAPABILITY, SET] -> [SUCCESS, SUCCESS]
23:48:11,525 DEBUG [root] <-
23:48:11,525 DEBUG [root] -> TwainSourceImpl::setDoubleCapability("ICAP_YRESOLUTION", 4377, 7, 200.000000)
23:48:11,555 DEBUG [root] [CONTROL, CAPABILITY, SET] -> [SUCCESS, SUCCESS]
23:48:11,555 DEBUG [root] <-
23:48:11,555 DEBUG [root] -> TwainSourceImpl::setIntCapability("ICAP_IMAGEFILEFORMAT", 4364, 4, 0)
23:48:11,575 DEBUG [root] [CONTROL, CAPABILITY, SET] -> [SUCCESS, SUCCESS]
23:48:11,575 DEBUG [root] <-
23:48:11,655 DEBUG [root] -> TwainSourceImpl::setIntCapability("ICAP_UNDEFINEDIMAGESIZE", 4397, 6, 1)
23:48:11,685 DEBUG [root] [CONTROL, CAPABILITY, SET] -> [SUCCESS, SUCCESS]
23:48:11,685 DEBUG [root] <-
23:48:11,685 DEBUG [root] -> TwainSourceImpl::setIntCapability("ICAP_AUTOMATICBORDERDETECTION", 4432, 6, 1)
23:48:11,705 DEBUG [root] [CONTROL, CAPABILITY, SET] -> [SUCCESS, SUCCESS]
23:48:11,705 DEBUG [root] <-
23:48:11,705 DEBUG [root] -> TwainSourceImpl::setIntCapability("ICAP_AUTOMATICDESKEW", 4433, 6, 1)
23:48:11,735 DEBUG [root] [CONTROL, CAPABILITY, SET] -> [SUCCESS, SUCCESS]
23:48:11,735 DEBUG [root] <-
23:48:11,735 DEBUG [root] -> TwainSourceImpl::setIntCapability("CAP_XFERCOUNT", 1, 1, -1)
23:48:11,755 DEBUG [root] [CONTROL, CAPABILITY, SET] -> [SUCCESS, SUCCESS]
23:48:11,755 DEBUG [root] <-
23:48:11,755 DEBUG [root] -> TwainSourceImpl::setIntCapability("CAP_AUTOSCAN", 4112, 6, 1)
23:48:11,785 DEBUG [root] [CONTROL, CAPABILITY, SET] -> [SUCCESS, SUCCESS]
23:48:11,785 DEBUG [root] <-
23:48:11,835 DEBUG [root] -> TwainSourceImpl::acquireImage(0)
23:48:11,835 DEBUG [root] -> TwainSourceImpl::enable(0)
23:48:16,825 DEBUG [root] [CONTROL, USERINTERFACE, ENABLEDS] -> [SUCCESS, SUCCESS]
23:48:16,825 DEBUG [root] state: DS_OPEN -> DS_ENABLED
23:48:16,825 DEBUG [root] <-
23:48:16,845 DEBUG [root] MSG_XFERREADY -> OK
23:48:16,845 DEBUG [root] state: -> TRANSFER_READY
23:48:16,845 DEBUG [root] -> TwainSourceImpl::transferNativeImage()
23:48:16,865 DEBUG [root] [IMAGE, IMAGEINFO, GET] -> [SUCCESS, SUCCESS]
23:48:16,865 DEBUG [root] size: 1904x2589x1
23:48:24,735 DEBUG [root] [IMAGE, IMAGENATIVEXFER, GET] -> [XFERDONE, SUCCESS]
23:48:24,745 DEBUG [root] state: -> TRANSFERRING
23:48:24,745 DEBUG [root] transfer done 6
23:48:24,745 DEBUG [root] -> TwainSourceImpl::finishTransfer()
23:48:24,765 DEBUG [root] [CONTROL, PENDINGXFERS, ENDXFER] -> [SUCCESS, SUCCESS]
23:48:24,775 DEBUG [root] pending transfers count, eoj: 65535, 0
23:48:24,775 DEBUG [root] state: DS_TRANSFERING -> TRANSFER_READY
23:48:24,775 DEBUG [root] <-
23:48:24,775 DEBUG [root] <- 168166004
23:48:24,775 DEBUG [root] <- 168166004
...
The above code, which I think Twain’s Capability Ordering compliant, would perform a scan in 200 DPI, black & white, with automatic border detection / auto crop and auto deskew.
The problem with the aboce code is that if I skew the paper in the ADF tray, the image is also skewed, i.e. no automatic deskew. And, if I scan a paper smaller than A4, such as US legal paper, I got a black area surrounding the image, i.e. no auto cropping.
I then tried the bundled software that came with the scanner, ScanAllPro. Both automatic operations were perfectly done.
Why would two different applications, the above code and the ScanAllPro, accesing the same TWAIN driver, gave a diffferent results ? Have you faced a similar problem ?
Thanks.
I don’t have a specific answer for you, but if you modify your app to allow the scanner to bring up it’s user interface prior to scanning, you can see in the user interface if fujitsu is happy with the way you’ve set things up or not. If you set the autocrop feature correctly, their user interface will have those features turned on when the UI is displayed to the user.
- AuthorPosts