To create a GS1-128 barcode using ZXing.Net, follow these steps:
Install ZXing.Net package using NuGet Package Manager.
Import the necessary namespaces:
using ZXing;
using ZXing.Common;
using ZXing.OneD;
var writer = new BarcodeWriter
{
Format = BarcodeFormat.CODE_128,
Options = new EncodingOptions
{
Width = 400,
Height = 100,
Margin = 10,
PureBarcode = true,
},
};
var barcode = writer.Write("(10)123456(17)200101(30)200101(21)A12345");
barcode.Save("gs1-128.png", ImageFormat.Png);
pictureBox1.Image = barcode;
The example above generates a GS1-128 barcode with the data "(10)123456(17)200101(30)200101(21)A12345". This data contains four elements: the Global Trade Item Number (GTIN), the expiration date, the production date, and a serial number. GS1-128 barcodes can include many other data elements depending on the needs of the barcode user.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2023-01-21 11:00:00 +0000
Seen: 22 times
Last updated: Feb 07 '23
What type of barcode scanner is suitable for the GS1-128 format?
What does setting DecodeHintType.ASSUME_GS1 in ZXing Barcode Scanner Intent mean?
Is it possible to create GS1 Databar barcodes on Android?
How can you create an OpenGL plot without relying on external libraries, starting from scratch?
How can I use iText7 to create a PDF that includes a pie chart?
How can I create a monitor in Datadog that includes multiple resources' metrics in one monitor?
Create a regular expression for the following format.
Is it advisable to create event handlers in a separate method rather than inline all the time?