Atalasoft Knowledge Base

FIX: EZTwain Pro 4 - Native Barcode Reading in some HP Scanners does not work


Some HP scanners have added support for TWEI_BARCODETEXT2

This is ONLY valid for Twain 2.5 implementations.

We've found that HP default drivers for scanners that support it had an issue and required an update from HP

Once you have a valid TWAIN 2.5, you need to make some mods to then enable the updated barcode features:

You have an HP scanner which supports internal native BarCode recognition.

This is different from using EZTwain Barcode features in that the BarCode info is set in extendedImageInfo options

For this to even be an option, you should see TWEI_BARCODETEXT2 (or if not defined,  0x1253) as a supported ExtendedImageInfo option when querying (or in a TWISTER report on your scanner)

First though to even have a chance for this to work you must add the TWEI_BARCODETEXT2 to your EZTwain.cs (for C#, eztwain.vb for VB and so on) - you'll have to adapt per your language

find the definition section for TWEI_  items (extended info)

You should find one for

public const int TWEI_BARCODETEXT = 0x1202;

You can add

public const int TWEI_BARCODETEXT2 = 0x1253;

Once you have that and have a valid TWAIN 2.5 driver for the scanner you can try and implement the feature... it is doe via TextendedImageInfo.

Please  verify  the feature is supported by running TWISTER and performing a test scan. Look at the results for ExtendedImageInfo (search for TWEI_ prefix)

You're looking to see if TWEI_BARCODETEXT2 or 0x1253 is showing

If so, then you can attempt to enable

In code, after opening the scanner but before acquire add a call to


Then, below that add

EZtwainEnableExtendedInfo(TWEI_PAGENUMBER, 1);
EZtwainEnableExtendedInfo(TWEI_FRAMENUMBER, 1) ;
EZtwainEnableExtendedInfo(TWEI_BARCODECOUNT, 1) ;
EZtwainEnableExtendedInfo(TWEI_BARCODETYPE, 1) ;
EZtwainEnableExtendedInfo(TWEI_BARCODETEXT, 1);
EZtwainEnableExtendedInfo(TWEI_BARCODETEXT2, 1);

Now, in your code for handling the acquire, in your loop, once you have the HDIB you can add a check on the values

int pageNum = EZtwain.ExtendedInfoInt(TWEI_PAGENUMBER, 0);

int frameNum = EZtwain.ExtendedInfoInt(TWEI_FRAMENUMBER, 0);

int barCount = EZtwain.ExtendedInfoInt(TWEI_BARCODECOUNT, 0);

string barcodeType = EZtwain.ExtendedInfoString(TWEI_BARCODETYPE, 0);

string barcodeText = EZtwain.ExtendedInfoString(TWEI_BARCODETEXT, 0);

string barcodeText2 = EZtwain.ExtendedInfoString(TWEI_BARCODETEXT2, 0);

NOTE: this was written without access to a supporting device so it may take a bit of testing to verify values/settings - there may be typos here

Use Dosadi Log tool to troubleshoot and see values coming/going

Last Modified: 9 Months Ago
Last Modified By: Tananda
Type: FIX
Article not rated yet.
Article has been viewed 351 times.
Also In This Category