To create a GS1 DataMatrix using ZXing.Net, you need to follow these steps:
Here is a sample code that creates a GS1 DataMatrix using ZXing.Net:
using ZXing;
using ZXing.Datamatrix;
using ZXing.Common;
// Create a DataMatrix writer with GS1 encoding
var barcodeWriter = new BarcodeWriter
{
Format = BarcodeFormat.DATAMATRIX,
Options = new DatamatrixEncodingOptions
{
GS1Format = true,
ModuleSize = 5,
SymbolShape = SymbolShapeHint.FORCE_SQUARE
}
};
// Generate a GS1 encoded data string for your data
var gs1Data = "(01)00012345678901234(17)141231";
// Create a BitMatrix with the encoded data and size options
var bitMatrix = barcodeWriter.Encode(gs1Data, BarcodeFormat.DATAMATRIX, 0, 0);
// Convert the BitMatrix to a Bitmap image
var bitmap = barcodeWriter.Write(bitMatrix);
Note: Make sure to adjust the GS1 data string and the size options according to your requirements.
Asked: 2023-06-27 21:23:13 +0000
Seen: 15 times
Last updated: Jun 27 '23