1 | initial version |
To generate a GS1-128 barcode in C# using Barcodelib, follow these steps:
Install-Package Barcodelib
using BarcodeLib;
Barcode barcode = new Barcode();
barcode.BarcodeType = BarcodeType.GS1_128;
string data = "(01)01234567891234(17)180801(21)190123(10)ABC123";
Image barcodeImage = barcode.Encode(BarcodeLib.TYPE.CODE128, data);
In this example, the data is a GS1-128 formatted string. The "(01)" indicates the Global Trade Item Number (GTIN), the "(17)" indicates the expiration date, the "(21)" indicates the serial number, and the "(10)" indicates the batch/lot number.
barcodeImage.Save("barcode.png", ImageFormat.Png);