This project has moved. For the latest updates, please go here.

Unable to detect if page is Patch Code (or Bar Code) on FUJITSU fi-6130

Nov 16, 2015 at 11:49 AM

We want to implement the Page separator in our scanner application. We are trying to put scans in bulk mode with "Patch code" as a page separator within documents. We are having scanner Fujitsu fi-6130 for evaluation.

With reference to the discussion on the link below :
We also tried the sample2 for event EndXfer for extracting extended image information.

We are facing two problems.
  1. We are getting in debug, Extended image info object showing unsupported capabilities for BARCODE as well as PATCH CODE.
  2. Is there any sample for how we can get differentiate the Bar code | Patch code?
Is there anything we are missing any properties that should be set at application before scan?

Any help in this is very much appreciated.

Nov 16, 2015 at 7:14 PM
Hello, deshmukhsandip.

ICAP_EXTIMAGEINFO ( Saraff.Twain.Twain32.Capabilities.ExtImageInfo )


Allows the application to query the data source to see if it supports the operation triplet DG_IMAGE / DAT_EXTIMAGEINFO / MSG_GET. Support is only available if the capability is supported and the value TRUE is allowed. When set to TRUE, the source supports the DG_IMAGE / DAT_EXTIMAGEINFO / MSG_GET message, and data will be returned by this call for any supported TWEI_ items. When set to FALSE, the application is indicating that it will make no calls to DG_IMAGE / DAT_EXTIMAGEINFO/ MSG_GET. FALSE is the default.


The TWAIN API allows for an application to query the results of many advanced device/manufacturer operations. The responsibility of configuring and setting up each advanced operation lies with the device’s data source user interface. Since the configuration of advanced device/manufacturer-specific operations varies from manufacturer to manufacturer, placing the responsibility for setup and configuration of advanced operations allows the application to remain device independent.


Set this capability to FALSE if there is no intent to use DG_IMAGE /DAT_EXTIMAGEINFO / MSG_GET. This may improve performance, since the Source is not required to collect that information from the device. Set this capability to TRUE if using DG_IMAGE / DAT_EXTIMAGEINFO / MSG_GET to ensure all TWEI_ are available.

10-132 TWAIN 2.2 Specification

ICAP_SUPPORTEDEXTIMAGEINFO ( Saraff.Twain.Twain32.Capabilities.SupportedExtImageInfo )


Lists all of the information that the Source is capable of returning from a call to DAT_EXTIMAGEINFO.


This capability mirrors CAP_SUPPORTEDCAPS. The array indicates all of the possible TWEI_ values the Source is capable of returning. It does not guarantee that all of these values will be returned for every call to DAT_EXTIMAGEINFO, because that depends on the negotiated capabilities and on what the device finds.
For instance, if the Source supports ICAP_BARCODEDETECTIONENABLED, then it may report TWEI_BARCODETEXT as part of this capability. However, if the image that was just captured has no barcode data, or if ICAP_BARCODEDETECTIONENABLED was disabled, then the Source can return TWRC_DATANOTAVAILABLE or TWRC_INFONOTSUPPORTED for that TW_INFO field, when the Application calls DAT_EXTIMAGEINFO.

10-188 TWAIN 2.2 Specification

DG_IMAGE / DAT_EXTIMAGEINFO / MSG_GET ( Saraff.Twain.Twain32.XferDoneEventArgs.GetExtImageInfo(Saraff.Twain.TwEI[]) in Saraff.Twain.Twain32.XferDone event )


This operation is used by the application to query the data source for extended image attributes, .e.g. bar codes found on a page. The extended image information will be returned in a TW_EXTIMAGEINFO structure.


To query extended image information, set the pExtImageInfo fields as follows:
The Application will allocate memory for the necessary container structure, the source will fill the values, and then application will free it up.
pExtImageInfo->NumInfos = Desired number of information;
pExtImageInfo->Info[0].InfoID = TWEI_xxxx;
pExtImageInfo->Info[1].InfoID = TWEI_xxxx;
Saraff.Twain.NET / Image Information and Extended Image Information

Return Codes

    TWCC_BADPROTOCOL /* Source does not support extended image information */
    TWCC_SEQERROR /* Not State 7, or in State 7 but TWRC_XFERDONE has not been received yet */
    TWCC_NOMEDIA /* Source has nothing to capture */
7-108 TWAIN 2.2 Specification

private void _twain32_XferDone(object sender,Twain32.XferDoneEventArgs e) {

    // ...

    if(this._isExtImageInfoAllowed) { // if extended image info support
        var _extImageInfo=e.GetExtImageInfo(new TwEI[] { TwEI.BarCodeCount,TwEI.BarCodeType,TwEI.BarCodeTextLength,TwEI.BarCodeText,TwEI.PatchCode });
        var _barCodeCount=_extImageInfo[TwEI.BarCodeCount];
        var _barCodeType=_extImageInfo[TwEI.BarCodeType];
        var _barCodeTextLength=_extImageInfo[TwEI.BarCodeTextLength];
        var _barCodeText=_extImageInfo[TwEI.BarCodeText];

        var _patchCode=_extImageInfo[TwEI.PatchCode];

    // ...

Nov 18, 2015 at 12:59 PM

I would like to add on more information what we are having,
Below are the development environment on win7 x64 machine.


Your reply says it with TWAIN 2.2 Specifications, what we are missing from our side?
Do you think above combination should give us the desired output?

P.S. -As we were not getting the desired output. We checked in sample application and seen that internally it loads the twain_32.dll.

Nov 18, 2015 at 4:58 PM
Hello, deshmukhsandip.
See Documentation of Saraff.Twain.NET,
I assume that you are familiar with the TWAIN Specification and understand what the Extended Image Info. Otherwise, my answers will not help.
I remind you that the Extended Image Info are platform-dependent, that is, not all scanners support them, and if supported, not all the Extended Capabilities.
Marked as answer by SARAFF on 11/25/2015 at 10:44 AM