Page 1 of 1

Reading GS1 Info1D

Posted: Mon Nov 13, 2017 11:39 am
by tiagolpt
Hello guys,

i've been using the software to read barcode from given images,

when using reader demo program i've been able to see information about the narrow bar count and narrow bar size..

to acess this info in code im doing the follow:

Code: Select all

IBarcodeInfo[] infos = reader.ReadBarcodes(barcodeImage);
for (int i = 0; i < infos.Length; i++)
{
    IBarcodeInfo info = infos[i];
    var info1d = info as BarcodeInfo1D;
}
if i use a GS1-128 the cast returns null, however I can see on the private properties of that object that in fact it contains those two properties (narrow bar count and narrow bar size), the strange thing is, if i remove the subset of GS1-128 from the settings the cast works..

How can i access those two properties without the cast?

In the reader demo those properties are always available.

Re: Reading GS1 Info1D

Posted: Mon Nov 13, 2017 2:36 pm
by Alex
Hello,

Please use the "info.GetType()" method for getting information about instance type and cast the instance to the correct type.

Best regards, Alexander

Re: Reading GS1 Info1D

Posted: Tue Nov 14, 2017 9:30 pm
by DarkStar
Hello!

Use this code:

Code: Select all

IBarcodeInfo[] infos = reader.ReadBarcodes(barcodeImage);
for (int i = 0; i < infos.Length; i++)
{
    IBarcodeInfo info = infos[i];
    if (info is BarcodeSubsetInfo)
       info = ((BarcodeSubsetInfo)info).BaseBarcodeInfo;
    var info1d = info as BarcodeInfo1D;
    ...
}