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 Offline
    D Offline
    Dzilupl
    wrote on last edited by
    #1

    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.

    S OriginalGriffO Z Kornfeld Eliyahu PeterK L 6 Replies 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.

      S Offline
      S Offline
      Simon_Whale
      wrote on last edited by
      #2

      does your bar code scanner manufacturer not have any examples to start from?

      Every day, thousands of innocent plants are killed by vegetarians. Help end the violence EAT BACON

      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.

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

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

        "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 L 2 Replies 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.

          Z Offline
          Z Offline
          ZurdoDev
          wrote on last edited by
          #4

          Dzilupl wrote:

          USB reads a barcode and sends string od chars (mostly numbers)

          That's how they work. They decode the barcode and send you the string of characters. From there, you just do whatever you need to do, for example, lookup the value in a database.

          There are only 10 types of people in the world, those who understand binary and those who don't.

          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.

            Kornfeld Eliyahu PeterK Offline
            Kornfeld Eliyahu PeterK Offline
            Kornfeld Eliyahu Peter
            wrote on last edited by
            #5

            A barcode reader is just like a keyboard. After is scans the code it decodes it and sends you like it was an input string... To try and interpret the scanned image by yourself will be a total waste of time, and a sure way to errors... If you have to handle specific barcode formats, buy a scanner can handle it...

            Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

            "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

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

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

              I know how barcodes work. I'm working about 12 years with ERP systems that use barcodes. You're right - GS1 it's not a code - it's non-profit organization. I thought about GS1-databar. EAN13 not only provides Article Number - it also can contain weight or price of article. My application send string from barcode scanner and only one think I need is to get this string separated into detailed data for example batch after 10, BBD after 15/17, weight after 310x etc. I know many of AI but I need solution which knows all of possible AI and will search string from barcode and seperate data after AI. I don't want to write it from the beggining because I don't want to miss any AI etc.

              OriginalGriffO 1 Reply Last reply
              0
              • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

                A barcode reader is just like a keyboard. After is scans the code it decodes it and sends you like it was an input string... To try and interpret the scanned image by yourself will be a total waste of time, and a sure way to errors... If you have to handle specific barcode formats, buy a scanner can handle it...

                Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

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

                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.

                Kornfeld Eliyahu PeterK D L 3 Replies Last reply
                0
                • D Dzilupl

                  I know how barcodes work. I'm working about 12 years with ERP systems that use barcodes. You're right - GS1 it's not a code - it's non-profit organization. I thought about GS1-databar. EAN13 not only provides Article Number - it also can contain weight or price of article. My application send string from barcode scanner and only one think I need is to get this string separated into detailed data for example batch after 10, BBD after 15/17, weight after 310x etc. I know many of AI but I need solution which knows all of possible AI and will search string from barcode and seperate data after AI. I don't want to write it from the beggining because I don't want to miss any AI etc.

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

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

                    Kornfeld Eliyahu PeterK Offline
                    Kornfeld Eliyahu PeterK Offline
                    Kornfeld Eliyahu Peter
                    wrote on last edited by
                    #9

                    A barcode holds continuous information and the meaning of that is decided by those who wrote it. There is no global/common decoding of such string, but only in connection to the product printed on... I worked with barcodes where there was a separator (like comma) and also with codes without any separation... Simply there is no on-size-for-all solution when decoding the meaning of a barcode...

                    Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

                    "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                    OriginalGriffO 1 Reply Last reply
                    0
                    • Kornfeld Eliyahu PeterK Kornfeld Eliyahu Peter

                      A barcode holds continuous information and the meaning of that is decided by those who wrote it. There is no global/common decoding of such string, but only in connection to the product printed on... I worked with barcodes where there was a separator (like comma) and also with codes without any separation... Simply there is no on-size-for-all solution when decoding the meaning of a barcode...

                      Skipper: We'll fix it. Alex: Fix it? How you gonna fix this? Skipper: Grit, spit and a whole lotta duct tape.

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

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

                      Kornfeld Eliyahu PeterK 1 Reply Last reply
                      0
                      • OriginalGriffO OriginalGriff

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

                        Kornfeld Eliyahu PeterK Offline
                        Kornfeld Eliyahu PeterK Offline
                        Kornfeld Eliyahu Peter
                        wrote on last edited by
                        #11

                        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.

                        "It never ceases to amaze me that a spacecraft launched in 1977 can be fixed remotely from Earth." ― Brian Cox

                        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.

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