C# barcode decoding library
-
Actually, there is, for UCC/EAN128 barcodes - I no longer have a copy, but there is an official spec which describes the barcode, which is broken into a large range of possible fields, including specific ones for price, weight, batch, production dates, serial numbers, and pretty much anything else you might want in a item identifier. The spec weighs around three Kg IIRC ... I've probably still got the Z80 assembler code to generate them from the constituent parts somewhere, but it could take months to find it! :laugh:
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
I know GS1-128 and also EPC and I worked with barcodes (as part of a project for warehouse management) - those are standards made for the paper mostly. The problem with GS1 is that it holds a lot of copyrights that makes it almost impossible to use their ideas because of the fear of infringement... So - one may write a method to interpret GS1 or EPC, but in most cases it will not work. As today, almost every manufacturer has his own system to create codes (and barcodes from them) and it may change even for the same manufacturer from product to product...
Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.
-
I don't want to decode image. My application send me as you wrote string readed from barcode image. I want to decode this string into separate information connected with barcodes AI's. I get string like 019123456789012331030605781516120510161128001 and I want to get it into PLU 01 - 1234567890123 then weight 3103 06000 (60,578kg), best before 15 161205 (05.12.2016) and LOT 10 161128001.
You're not going to find a library for this. It comes down to simple string manipulation. You get a code from the scanner and you have to break it down into the parts you need. There's nothing magical about this.
A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave Kreskowiak -
I'm writing application in C# (WPF, .net 4.5). I need library for decoding barcodes (EAN128, GS1, code 128, EAN13). Can anyone suggest me ready to use library (free or paid). My scanner connected by USB reads a barcode and sends string od chars (mostly numbers) and I need to decode it to separated PLU, LOT, BBD etc.
-
EAN13 holds only a 13-digit article number: you are thinking about EAN13+2 and EAN13+5 which are extensions to the basic EAN13 spec - and there isn't anything which says what those additional digits must be: they do not have to be weight or price.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
I don't want to decode image. My application send me as you wrote string readed from barcode image. I want to decode this string into separate information connected with barcodes AI's. I get string like 019123456789012331030605781516120510161128001 and I want to get it into PLU 01 - 1234567890123 then weight 3103 06000 (60,578kg), best before 15 161205 (05.12.2016) and LOT 10 161128001.
-
We are using EAN13 that contains only 13 digits and in this 13 digits is price or weight with article number without any extra 2 or 5 digits - it's always 13 digits EAN13 code.
If that's true - and I don't believe it for a moment - then what you are doing is probably very dangerous in commercial terms. The only values allowed in an EAN-13 standard bar code is a single Article Number, which is assigned to a comp-any for a specific product by the appropriate national body (for a charge) in order that it is unique world-wide. All POS systems read the barcode, extract the AN, and use it for a DB lookup to identify the exact product scanned, and from that same DB get the weight, price, dimensions, manufacturer and such like. None of that is directly stored in the BC - it's all DB stored and linked to the AN received from the BC. If you are storing weights and prices in the AN, then unless you have purchased a pretty huge block of ANs from your issuing authority, then you are probably issuing items with EAN13 BCs which identify them to the real world as toothpaste, or rubber gloves, or fresh chicken portions ...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
You are saying you get a string of digits (nothing to do with barcodes) and you know the structure of the information in the string. So what exactly is your problem in separating and decoding these fields?
I don't know exactly what is the structure of the information because it can be different. For example 1 EAN128 code can contains only article number and batch, another one can contains article number with weight and batch, another can contains article with number of pieces and production date etc. There are many possibilities. AI tells what information this string contains and what I need is good algorithm that search for all possible AI and decode string into separate information. I don't want to miss any possibility.
-
If that's true - and I don't believe it for a moment - then what you are doing is probably very dangerous in commercial terms. The only values allowed in an EAN-13 standard bar code is a single Article Number, which is assigned to a comp-any for a specific product by the appropriate national body (for a charge) in order that it is unique world-wide. All POS systems read the barcode, extract the AN, and use it for a DB lookup to identify the exact product scanned, and from that same DB get the weight, price, dimensions, manufacturer and such like. None of that is directly stored in the BC - it's all DB stored and linked to the AN received from the BC. If you are storing weights and prices in the AN, then unless you have purchased a pretty huge block of ANs from your issuing authority, then you are probably issuing items with EAN13 BCs which identify them to the real world as toothpaste, or rubber gloves, or fresh chicken portions ...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
This's not our standard code - we have to print it because some of our clients need such EAN13 code - this code is printed on label only if our customer wants. Clients send us specification of codes which they want from us. Clients' POS systems reads it correctly. This is just a market need.
-
This's not our standard code - we have to print it because some of our clients need such EAN13 code - this code is printed on label only if our customer wants. Clients send us specification of codes which they want from us. Clients' POS systems reads it correctly. This is just a market need.
Then you will have to read your clients specification, because what you are doing is non-standard so we cannot tell you what parts of the code you need to extract, or how they are encoded...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
I don't know exactly what is the structure of the information because it can be different. For example 1 EAN128 code can contains only article number and batch, another one can contains article number with weight and batch, another can contains article with number of pieces and production date etc. There are many possibilities. AI tells what information this string contains and what I need is good algorithm that search for all possible AI and decode string into separate information. I don't want to miss any possibility.
-
Then you will have to read your clients specification, because what you are doing is non-standard so we cannot tell you what parts of the code you need to extract, or how they are encoded...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
I only wanted to show you that EAN13 can also contain weight or price because you wrote that EAN13 contains only article number. My question was about decoding string not only from EAN13 which are the easiest to do - most of all I need help with EAN128, Code128 where are many possibilities and AI.
-
Well a simple Google search finds GS1-128 - Wikipedia[^].
-
I know all that you send me but like I said - i don't want to miss something and I asked if anyone is using some ready solutions (also paid) that can do this decoding for me.
-
I only wanted to show you that EAN13 can also contain weight or price because you wrote that EAN13 contains only article number. My question was about decoding string not only from EAN13 which are the easiest to do - most of all I need help with EAN128, Code128 where are many possibilities and AI.
-
I don't know exactly what is the structure of the information because it can be different. For example 1 EAN128 code can contains only article number and batch, another one can contains article number with weight and batch, another can contains article with number of pieces and production date etc. There are many possibilities. AI tells what information this string contains and what I need is good algorithm that search for all possible AI and decode string into separate information. I don't want to miss any possibility.
What you're talking about is using a standardized format to non-standard uses. There isn't going to be a library for this! If you're going to use an EAN128 code that can have differing fields from one scan to another, you MUST have another field that tells your code which field format is being used for that code. For example:
Layout ProductCode Weight 1 394857394587 12.46 Layout ProductCode Count 2 294579834759 12 Layout ProductCode DateCode Count 3 324875938457 1623 12
You're going to have to write your own library for this, both to generate the barcodes and to read them.
A guide to posting questions on CodeProject
Click this: Asking questions is a skill. Seriously, do it.
Dave Kreskowiak -
I'm writing application in C# (WPF, .net 4.5). I need library for decoding barcodes (EAN128, GS1, code 128, EAN13). Can anyone suggest me ready to use library (free or paid). My scanner connected by USB reads a barcode and sends string od chars (mostly numbers) and I need to decode it to separated PLU, LOT, BBD etc.
Hello, about ten years ago, I developed my first and only one client app for a barcode scanner, it was a psion workabout scanner, i can't remember how, but I remember that PSION provided an API that allowed me to register my app into the scanner hardware and get the scanning codes as EVENTS instead of use keyboard emulation, the event arguments were a structure containing lot of metadata about the barcode, such as "barcode kind" geometries and so on, the event arguments also provided a raw byte array of scanning data, which I used to parse a bunch of GS-1 logistic labels. All the above just to say that maybe the hardware manufacturer could provide you the API you need to communicate with their hardware device / driver. Good luck
-
I think what you need to do is to start looking at what is in a barcode: GS1 isn't a barcode (it's an allocation system for barcode numbers), EAN-13 only provides an Article Number, and Code128 is a transport mechanism that allows EAN128 to contain more than just numeric values. Only EAN128 contains specific fields you can decode into PLU, Serial Number, batch codes, etc. And most of them don't bother: they just contain the Article Number. Normally what happens is that the AN is read from the barcode, and used as a lookup to your stock database to determine what type of goods it is, what price you are selling it as, and so forth.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
VintaSoft Barcode .NET SDK is the professional SDK that allows to read and write 1D and 2D barcodes in .NET. SDK is very simple, has good documentation, has many examples and allows to add the barcode reading and writing functionality in WinForms, WPF, console, ASP.NET MVC or ASP.NET WebForms application in 1 day. Please try to use the SDK.