Skip to content

Generating GS1 DataMatrix and GS1 Code128 barcodes

Michael Jahn edited this page Aug 10, 2017 · 2 revisions

The generation of GS1 barcodes is a little bit tricky. You have to add special characters to the content which are interpreted as group separators (FNC1).

  • GS1-DataMatrix uses the character 0x29 as GS
  • GS1-Code128 uses the character 0x00F1 as GS

A small code snippet shows the use of the different GS characters:

GS1-DataMatrix

var writer = new BarcodeWriter { Format = BarcodeFormat.DATA_MATRIX };

var barcode = writer.Write($"{(char)29}01234567890{(char)29}45678");

GS1-Code128

var writer = new BarcodeWriter { Format = BarcodeFormat.CODE_128};

var barcode = writer.Write($"{(char)0x00F1}01234567890{(char)0x00F1}45678");