soukoku/ntwain

Read barcodes problem

myextend opened this issue · 4 comments

Hi
Scanner: Fujitsu fi-7160 with enabled barcode reader. I need detect barcode type: EAN128.
When I use:

var barcodes = e.GetExtImageInfo(ExtendedImageInfo.BarcodeText).Where(it => it.ReturnCode == ReturnCode.Success);
var barcodesTextLength = e.GetExtImageInfo(ExtendedImageInfo.BarcodeTextLength).Where(it => it.ReturnCode == ReturnCode.Success);

And I read scanner data using code:

foreach (var it in barcodes)
{
var values = it.ReadValues();
PlatformInfo.Current.Log.Info(string.Format("{0} = {1}", it.InfoID, values.FirstOrDefault()));
}

foreach (var it in barcodesTextLength )
{
var values = it.ReadValues();
PlatformInfo.Current.Log.Info(string.Format("{0} = {1}", it.InfoID, values.FirstOrDefault()));
}

I don't see my barcode text. Value should be: "INF0000003002" but allways i have:

BarcodeText = 0x3030303030464e49 as string: 3472328296229129801
BarcodeTextLength = 13

When i change barcode value, library allways return barcode value: 3472328296229129801 but BarcodeTextLength is correct equals to 13.
Barcode detection work well but barcode value is strange.

I check this code using scanner Cannon DR-G1130 and barcode value when using Canon is correct, problem occurs only in Fujitsu

I have the same issues with Kodak Scanners. I solved it by using the new TwainDirectMetaData which was added in Twain 2.4.
See: https://www.twain.org/wp-content/uploads/2017/03/TWAIN-2.4-Specification.pdf
Page 368, 417

I have the same issues with Kodak Scanners. I solved it by using the new TwainDirectMetaData which was added in Twain 2.4. See: https://www.twain.org/wp-content/uploads/2017/03/TWAIN-2.4-Specification.pdf Page 368, 417

How have you done this? As far as I know NTwain doesn't support it yet does it?

I can post the code this weekend.

But you can test the latest Twain version 2.5. There is a new extended Image info called TWEI_BARCODETEXT2.
See https://twain.org/wp-content/uploads/2021/11/TWAIN-2.5-Features.pdf

Maybe that will fix the problem too. Unfortunately, I don't know because I don't have a scanner to test it.

A little bit late but this is how I managed to read QRCode values with their coordinates detected by a fujitsu scanner. Hope this helps.
https://gist.github.com/lkierepka/0b72d2eefea76c0712e500b02320542b