Reading GS1 Info1D

Questions, comments and suggestions concerning VintaSoft Barcode .NET SDK.

Moderator: Alex

Post Reply
tiagolpt
Posts: 1
Joined: Mon Nov 13, 2017 11:32 am

Reading GS1 Info1D

Post by tiagolpt » Mon Nov 13, 2017 11:39 am

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.

Alex
Site Admin
Posts: 1461
Joined: Thu Jul 10, 2008 2:21 pm

Re: Reading GS1 Info1D

Post by Alex » Mon Nov 13, 2017 2:36 pm

Hello,

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

Best regards, Alexander

DarkStar
Posts: 2
Joined: Sat Jun 13, 2009 4:26 pm

Re: Reading GS1 Info1D

Post by DarkStar » Tue Nov 14, 2017 9:30 pm

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;
    ...
}

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest