GS1-128
Does IronBarcode support GS1 UCC/EAN-128 Symbology?
The barcode values are correct and recognized accurately. However, the issue lies in the current lack of brackets in the displayed barcode value.
When using GS1-128, IronBarcode currently outputs: 01950123456789033103000123 (which is recognized as a Code 128 barcode with GS1 signature). The desired value to be displayed on the image output would be: 01950123456789033103000123. However, the barcode scanner will output (01)95012345678903(3103)000123 with a detection of the barcode type as GS1Code128.
Use the following code:
using IronBarCode;
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode("01950123456789033103000123", BarcodeWriterEncoding.Code128GS1);
barcode.AddBarcodeValueTextBelowBarcode();
barcode.SaveAsPng("gs1code128.png");
using IronBarCode;
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode("01950123456789033103000123", BarcodeWriterEncoding.Code128GS1);
barcode.AddBarcodeValueTextBelowBarcode();
barcode.SaveAsPng("gs1code128.png");
Imports IronBarCode
Private barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode("01950123456789033103000123", BarcodeWriterEncoding.Code128GS1)
barcode.AddBarcodeValueTextBelowBarcode()
barcode.SaveAsPng("gs1code128.png")
Output barcode
The above code generates a GS1-128 barcode with a default divider. If you want to add additional dividers, you can insert \u00f. However, please note that when using the AddBarcodeValueTextBelowBarcode
method, the Unicode character ñ (code 0x00F1) will be displayed. To overcome this limitation, an alternative approach is to manipulate the string and pass the modified value to the AddAnnotationTextBelowBarcode
method. This way, you can achieve the desired display of the barcode value without the ñ character.
using IronBarCode;
string barcodeValue = "0195012345678903310300012300\u00f10000000123300000\u00f10000012312300000";
string TrimString = barcodeValue.Replace("\u00f1","");
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(barcodeValue, BarcodeWriterEncoding.Code128GS1);
barcode.AddAnnotationTextBelowBarcode(TrimString);
barcode.SaveAsPng("gs1code128.png");
using IronBarCode;
string barcodeValue = "0195012345678903310300012300\u00f10000000123300000\u00f10000012312300000";
string TrimString = barcodeValue.Replace("\u00f1","");
GeneratedBarcode barcode = BarcodeWriter.CreateBarcode(barcodeValue, BarcodeWriterEncoding.Code128GS1);
barcode.AddAnnotationTextBelowBarcode(TrimString);
barcode.SaveAsPng("gs1code128.png");
Imports IronBarCode
Private barcodeValue As String = "0195012345678903310300012300" & ChrW(&H00f1).ToString() & "0000000123300000" & ChrW(&H00f1).ToString() & "0000012312300000"
Private TrimString As String = barcodeValue.Replace(ChrW(&H00f1).ToString(),"")
Private barcode As GeneratedBarcode = BarcodeWriter.CreateBarcode(barcodeValue, BarcodeWriterEncoding.Code128GS1)
barcode.AddAnnotationTextBelowBarcode(TrimString)
barcode.SaveAsPng("gs1code128.png")
Output barcode
When scanning the barcode, the output will be (01)95012345678903(3103)000123(00)0000000123300000(00)00012312300000, and the barcode type will be detected as GS1Code128.