How to identify the subset (A-B-C) of CODE128 scanned barcode in C#



Ho should I identify if barcode type is CODE128A or CODE128B or CODE128C? I am aware that A and B can encode letters and C is for digits.
But I have a customer that generates CODE128B barcodes with digits only and I have to validate if generated barcode is CODE128B even if encoded data is digits only.

I have searched your online documentation and I saw one example how to generate those.
But I could not find anything related to identification.

BTW I am aware that this could be identified from the start code:
The start code is one of three codes that signal the start of the Code 128 barcode. The Code 128 specification defines three "character sets" or "character modes." The different codes, Start-A, Start-B, and Start-C, signal which character set will be used. The character set may also be changed in the middle of the barcode to encode the data more efficiently .

How could I read that start code using your BarCodeReader in C#?
Maybe there is some sample how to get it from CodeBytes?


Hi Tadas,

Thank you for your inquiry and details.

The feature you are looking for is not available. The feature request has been logged into our system with ID BARCODENET-36540 to identify the type of Code128 coded barcode while recognition. Our product team will look into it and provide feedback. We will update you with the feedback in this forum thread once available.



How fast this feature could be implemented?


Hi Tadas,

We have asked our product team to provide feedback on this feature request. We will share it with you as soon as we have any feedback.


Hi Ikram,

That would be great if product team will jump on it and do this feature.
In the meantime could you please provide me a bit of details what Aspose will give me if I use BarCodeReader.GetCodeBytes() method? I can see that it is code bytes but what do you mean by saying "Code"? Are these bytes for the barcode text only or these bytes contain all the sections of the barcode (Start character,FNC, data, checksum, stop character) in other words entire "zebra" bytes?


Hi Tadas,

This is to update you that the ETA for the feature against ticket ID BARCODENET-36540 will be our monthly release version 17.05 that is due in May, 2017.

Code Bytes is raw data of the barcode. Code text is encoded representation of the code bytes.
Some barcodes allows storing binary data, not the text. In that cases BarCodeReader.GetCodeBytes() method will return binary data which is encoded in the barcode.


Hello Ikram,

This is the only missing feature that have stopped me from buying licence yet.

Where I could possible see the description on this ticket or participate in comments for that particular ticket?

Could we agree that I will be issued with temp licence until this ticket is released?

Once that is released then I will purchase the licence immediately


Hi Tadas,

Forums are the only mean of communication and getting technical assistance. You can share your concerns here in the form. We will share our findings and feedback about the issues. If you want update on an issue or a logged ticket, we will share updates with you after consulting our product team.

You can get 30 days temporary license. Please follow the instructions on the link Get a Temporary License for temporary license. You can post your query related to licensing on the Aspose.Purchase support forum. The Aspose.Purchase support team will assist you accordingly.


Hi Ikram,

I have noticed another potential problem.

I have an image with two barcodes and bunch of other text and graphics around it.
You can imagine a brand new holywood DVD movie jewel case and if you look at the back of it you can see some barcodes and some text and some pictures and some colors and some pink background also. So this image has some graphics and two barcodes. One is UPC at the top and the other is CODE 128 at the bottom. I need to validate that these barcodes are really UPC and CODE 128

So I scan this picture using BarCodeReader and what I want your software to do is to scan those barcodes and tell me what type of barcodes they are and what are their text values. So I specify the barcodes that I expect to see:

And indeed BarCodeReader does the job. It scans these barcodes. But the problem is that it reads three barcodes instead of two. CODE 128 is scanned once. But the UPC barcode is scanned as UPC (12 characters) and also it scans as EAN (13 characters) with "0" added at the front of the actual UPC (12 characters). Why is that? Why UPC is scanned twice? Do I have to specify precisely what kind of barcode I am expecting to be scanned?

Please let me know any advice on this


Hi Tadas,

You can set RecognitionMode as MaxBarCodes to recognize all barcodes in the image. Furthermore if you want to specify a particular type of barcode to be recognized, you can set BarCodeReadType. Sample code snippet is given below for your reference.

For the issue that Aspose.BarCode is reading UPC barcode twice from the image, we need sample input image that you are using at your end. This will help us to reproduce the issue. Please forward us the sample image. We will investigate the issue and update you about our findings in this forum thread.


Aspose.BarCode.BarCodeRecognition.BarCodeReader objBReader =
new Aspose.BarCode.BarCodeRecognition.BarCodeReader(@"sample_barcode_image.png");

int counter = 0;
while (objBReader.Read())
Console.WriteLine(" -- Symbol:" + objBReader.GetCodeType() + " Code :" + objBReader.GetCodeText());

Specify Precise Barcode Recognation:

new Aspose.BarCode.BarCodeRecognition.BarCodeReader(@"sample_barcode_image.png", Aspose.BarCode.BarCodeRecognition.DecodeType.Pdf417);
objBReader.RecognitionMode = Aspose.BarCode.BarCodeRecognition.RecognitionMode.MaxBarCodes;


Hi Ikram,

There is another issue.

Please see the code below:

using (BarCodeReader reader = new BarCodeReader(pFile, DecodeType.UPCA))
reader.StripFNC = true;
reader.RecognitionMode = RecognitionMode.MaxBarCodes;

while (reader.Read())
ListBox1.Items.Add(string.Format("Type: {0} Value: {1}", reader.GetCodeTypeName(), reader.GetCodeText()));

pFile is the file attached in this message.

This file is clearly UPC 12 characters code 889842095388
Your software scans it as 88984209538

Last "8" is missing. Is your software reliable? It must be for 600 dollars!

I am waiting for your comments.


Hi Tadas,

Thank you for information and pointing out the issue.

This is to update you that we are able to reproduce the issue. The issue has been logged into our system with ID BARCODENET-36547. Our product team will further look into it.

The API has been designed and developed to cater for specifications mentioned in the documentation. However, issues can arise in different functional areas of the API that we fix once reported by our valued customers.

For your price related inquiry, please post your query in Aspose.Purchase forum where our purchase team will guide you accordingly.

Hi Tadas,

This is to update you that our product team has looked into this issue. It was found that it is not a bug. The option is there and we have to use it. The last digit is checksum digit and API returns the result without checksum by default. There are two ways to get the checksum digit:

1. Get the checksum separately, use method GetCheckSum().
2. Get full result with checksum, use GetCodeText(true). You need to pass TRUE as parameter to GetCodeText method to get barcode along with checksum digit.

Please modify your code and try it at your end. Feel free to contact us in case of any query or comments.