Spire.Barcode is a professional barcode library specially designed for .NET developers (C#, VB.NET, ASP.NET, .NET Core) and Java developers (J2SE and J2EE) to generate, read and scan 1D & 2D barcodes.

Sun Apr 01, 2018 5:53 pm

The GS1 standard for GS1-128 barcodes dictates that the machine readable part barcode should NOT have parentheses encoded around the AIs but that the human readable portion MUST have the AI wrapped in parentheses.

In other words, the human readable part should look something like this:
(01)12135465984563(10)00021

while a scan of the barcode should return this:
01121354659845631000021

If we omit the parentheses from the data string as in the following code, the component erroneously returns the human readable code without the parentheses:
Code: Select all
BarcodeSettings barsetting = new BarcodeSettings();
barsetting.Type = BarCodeType.Code128;
barsetting.Data = "01121354659845631000021";
BarCodeGenerator bargenerator = new BarCodeGenerator(barsetting);
Image barcodeimage = bargenerator.GenerateImage();


If we go the other way and place the parentheses in the data string, the parentheses are erroneously encoded in the barcode:
Barcodes generated using the following code erroneously returns the human readable code without the parentheses:
Code: Select all
BarcodeSettings barsetting = new BarcodeSettings();
barsetting.Type = BarCodeType.Code128;
barsetting.Data = "(01)12135465984563(10)00021";
BarCodeGenerator bargenerator = new BarCodeGenerator(barsetting);
Image barcodeimage = bargenerator.GenerateImage();


Is there any way to get the barcode to encode the numbers without the parentheses while showing the parentheses in the human readable code?

stevenaburton
 
Posts: 6
Joined: Sun Apr 01, 2018 5:34 pm

Mon Apr 02, 2018 3:28 am

Hello,

Thanks for your inquiry.
The GS1-128 is also formerly known as UCC/EAN-128. And in our product, it is represented as EAN128 rather than Code128, please use the BarCodeType.EAN128; to specify its type (see below code example). After that, I used a machine to scan the generated barcode, and the returned data is correct (01121354659845631000021) without parentheses, however, when I used our commercial Spire.Barcode to scan it, the parentheses are erroneously encoded in the barcode. I have posted the issue to our Dev team, if it is fixed or there are some updates for you, we will let you know. Sorry for the inconvenience caused.
Code: Select all
BarcodeSettings barsetting = new BarcodeSettings();
barsetting.Type = BarCodeType.EAN128;
barsetting.Data = "(01)12135465984563(10)00021"; ;
BarCodeGenerator bargenerator = new BarCodeGenerator(barsetting);
Image barcodeimage = bargenerator.GenerateImage();
barcodeimage.Save("EAN128Code.png");
//scan the barcode
string[] data1 = BarcodeScanner.Scan("EAN128Code.png");


Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Mon Apr 02, 2018 5:33 pm

Thanks, that works for generating the barcode!

However, the problem also exists for the GTIN14 code format. Is there any way to get this to generate without parentheses around the (01)?

stevenaburton
 
Posts: 6
Joined: Sun Apr 01, 2018 5:34 pm

Tue Apr 03, 2018 2:24 am

Hello,

Thanks for your feedback.
Please specify the barcode type as ITF14 which will return the data without parentheses. If I misunderstand your meaning, welcome to write back and give us more information about your problem.
Code: Select all
barsetting.Type = BarCodeType.ITF14;

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Thu Apr 05, 2018 3:59 pm

Fortunately, BarcodeType.SCC14 does work for GTIN14 barcodes.

stevenaburton
 
Posts: 6
Joined: Sun Apr 01, 2018 5:34 pm

Fri Apr 06, 2018 2:24 am

Hello

I'm glad to hear that you have found a solution.
If you need other assistance, please feel free to contact us.
Have a nice day!

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1182
Joined: Tue Sep 27, 2016 1:06 am

Return to Spire.BarCode

cron