0

I use the NuGet package Barcodelib to create the barcode. I wanted to ask if any of you know how to create a GS1 code with this package. Here is an excerpt of the script where the field txtBarcode.Text is converted

            barCode.Alignment = BarcodeLib.AlignmentPositions.CENTER;

        BarcodeLib.TYPE type = BarcodeLib.TYPE.UNSPECIFIED;
        type = BarcodeLib.TYPE.CODE128;
        try
        {
            if (type != BarcodeLib.TYPE.UNSPECIFIED)
            {
                barCode.IncludeLabel = true;
                barCode.RotateFlipType = (RotateFlipType)Enum.Parse(typeof(RotateFlipType),"Rotate270FlipNone", true);
                Barcode.Image = barCode.Encode(type, txtBarcode.Text, Color.Black, Color.White, nW, nH);
            }

can you please give me an example for this? Thanks

Terry Burton
  • 2,801
  • 1
  • 29
  • 41
user3545432
  • 35
  • 1
  • 6
  • what does this have to do with [tag:visual-studio]? from the tag: `DO NOT use this tag on questions regarding code which merely happened to be written in Visual Studio.` – Claies Mar 16 '23 at 14:34
  • also, it already looks like your code does what you are describing it needing to do. What is the **actual error you are seeing**? – Claies Mar 16 '23 at 14:38
  • it's not an error, I just don't understand how to generate a GS1 with the Barcodelib – user3545432 Mar 16 '23 at 14:46
  • a GS1 is CODE128, which is what you are using here. are you not getting the CODE128 barcode as your output?? – Claies Mar 16 '23 at 14:47
  • unfortunately GS1-128 is not the same as Code 128 but Code128 is part of GS1-128 – user3545432 Mar 16 '23 at 14:56
  • It doesn't appear that GS1-128 is on the supported list for that library: https://github.com/barnhill/barcodelib#overview – Claies Mar 16 '23 at 15:02

1 Answers1

1

I figured it out, just insert the "È" character

string BC = "È" + txtBarcode.Text;
Barcode.Image = barCode.Encode(type, BC, Color.Black, Color.White, nW, nH);

thank

user3545432
  • 35
  • 1
  • 6