Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. C# barcode decoding library

C# barcode decoding library

Scheduled Pinned Locked Moved C#
csharpwpf
27 Posts 8 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Dzilupl

    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.

    D Offline
    D Offline
    Dave Kreskowiak
    wrote on last edited by
    #12

    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

    1 Reply Last reply
    0
    • D Dzilupl

      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.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #13

      If you don't know what the layout is supposed to be or how to parse this (using .Substring, for example), how can you confirm that any "library" will do what you want?

      1 Reply Last reply
      0
      • OriginalGriffO OriginalGriff

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

        D Offline
        D Offline
        Dzilupl
        wrote on last edited by
        #14

        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.

        OriginalGriffO 1 Reply Last reply
        0
        • D Dzilupl

          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.

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #15

          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?

          D 1 Reply Last reply
          0
          • D Dzilupl

            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.

            OriginalGriffO Offline
            OriginalGriffO Offline
            OriginalGriff
            wrote on last edited by
            #16

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

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

            D 1 Reply Last reply
            0
            • L Lost User

              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?

              D Offline
              D Offline
              Dzilupl
              wrote on last edited by
              #17

              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.

              L D 2 Replies Last reply
              0
              • OriginalGriffO OriginalGriff

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

                D Offline
                D Offline
                Dzilupl
                wrote on last edited by
                #18

                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.

                OriginalGriffO 1 Reply Last reply
                0
                • D Dzilupl

                  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.

                  OriginalGriffO Offline
                  OriginalGriffO Offline
                  OriginalGriff
                  wrote on last edited by
                  #19

                  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 have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                  "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                  D 1 Reply Last reply
                  0
                  • D Dzilupl

                    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.

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #20

                    Well a simple Google search finds GS1-128 - Wikipedia[^].

                    D 1 Reply Last reply
                    0
                    • OriginalGriffO OriginalGriff

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

                      D Offline
                      D Offline
                      Dzilupl
                      wrote on last edited by
                      #21

                      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.

                      L 1 Reply Last reply
                      0
                      • L Lost User

                        Well a simple Google search finds GS1-128 - Wikipedia[^].

                        D Offline
                        D Offline
                        Dzilupl
                        wrote on last edited by
                        #22

                        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.

                        L 1 Reply Last reply
                        0
                        • D Dzilupl

                          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.

                          L Offline
                          L Offline
                          Lost User
                          wrote on last edited by
                          #23

                          If there is already a library in existence for this then Google is the place to look. If Google does not find one then you need to write your own. It's not exactly a difficult problem.

                          1 Reply Last reply
                          0
                          • D Dzilupl

                            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.

                            L Offline
                            L Offline
                            Lost User
                            wrote on last edited by
                            #24

                            If it's a "custom code", then it's not EAN13 or anything else "published"; so stop referring to it in that way. Call it what it is: a custom (barcode) encoding.

                            1 Reply Last reply
                            0
                            • D Dzilupl

                              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.

                              D Offline
                              D Offline
                              Dave Kreskowiak
                              wrote on last edited by
                              #25

                              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

                              1 Reply Last reply
                              0
                              • D Dzilupl

                                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.

                                A Offline
                                A Offline
                                Andrea Simonassi
                                wrote on last edited by
                                #26

                                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

                                1 Reply Last reply
                                0
                                • OriginalGriffO OriginalGriff

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

                                  L Offline
                                  L Offline
                                  Lost User
                                  wrote on last edited by
                                  #27

                                  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.

                                  1 Reply Last reply
                                  0
                                  Reply
                                  • Reply as topic
                                  Log in to reply
                                  • Oldest to Newest
                                  • Newest to Oldest
                                  • Most Votes


                                  • Login

                                  • Don't have an account? Register

                                  • Login or register to search.
                                  • First post
                                    Last post
                                  0
                                  • Categories
                                  • Recent
                                  • Tags
                                  • Popular
                                  • World
                                  • Users
                                  • Groups