Codabar
- 2 minutes to read
The Codabar is a discrete, self-checking symbology that may encode 16 different characters, plus an additional 4 start/stop characters. This symbology is used by U.S. blood banks, photo labs, and on FedEx air bills. Refer to the following article for more details: Codabar.
Examples
Configure Barcode Settings (CodabarOptions)
Use the CodabarOptions class to configure Codabar barcode settings.
The following code snippet creates an Codabar barcode and customizes its options:

using DevExpress.Docs.Barcode;
using DevExpress.Drawing;
var codabarOptions = new CodabarOptions();
codabarOptions.StartSymbol = CodabarStartStopSymbol.A;
codabarOptions.StopSymbol = CodabarStartStopSymbol.D;
codabarOptions.WideNarrowRatio = 1.5f;
codabarOptions.ShowText = true;
codabarOptions.Padding = new Padding(5);
codabarOptions.BorderWidth = 1;
using var codabarOptionsStream = new FileStream(Path.Combine(outDir,
"barcode_symbology_codabar.png"), FileMode.Create, FileAccess.Write);
using var codabarOptionsGenerator = new BarcodeGenerator(codabarOptions);
codabarOptionsGenerator.Export("0123456789", codabarOptionsStream, DXImageFormat.Png);
Configure Barcode Settings (Fluent API)
Use the CodabarOptionsBuilder class to configure Codabar barcode settings with Fluent API.
The following code snippet creates an Codabar barcode and customizes its options:

using DevExpress.Docs.Barcode;
using DevExpress.Drawing;
using System.Drawing;
var codabarOptions = CodabarOptionsBuilder.Create()
.WithStartSymbol(CodabarStartStopSymbol.A)
.WithStopSymbol(CodabarStartStopSymbol.D)
.WithWideNarrowRatio(1.5f)
.WithShowText(true)
.WithPadding(5)
.WithBorderWidth(1)
.Build();
using var codabarOptionsStream = new FileStream(Path.Combine(outDir,
"barcode_symbology_codabar.png"), FileMode.Create, FileAccess.Write);
using var codabarOptionsGenerator = new BarcodeGenerator(codabarOptions);
codabarOptionsGenerator.Export("0123456789", codabarOptionsStream, DXImageFormat.Png);
Symbology-Specific Options
| Property | Description |
|---|---|
| StartSymbol | Gets or sets the first symbol used to code barcode structure. |
| StopSymbol | Gets or sets the last symbol used to code barcode structure. |
| WideNarrowRatio | Gets or sets bar density. |
See Also