How to Generate Codabar and Code 11 Barcodes for Healthcare and Library Applications in .NET
What Are Codabar and Code 11 Barcodes?
Codabar is a numeric barcode widely used in blood banks, libraries, and parcel services, supporting digits 0-9 plus A-D for start/stop symbols. Code 11 is used for telecom inventory and identification, supporting digits 0-9 and dash (-). Both are simple, scanner-friendly, and ideal for institutional workflows.
Quick Start (Minimal Example)
using Aspose.BarCode.Generation;
var generator = new BarcodeGenerator(EncodeTypes.Codabar, "A123456B");
generator.Save("codabar-bloodbank.png", BarCodeImageFormat.Png);
Table of Contents
- Introduction
- What Are Codabar and Code 11 Barcodes?
- Quick Start (Minimal Example)
- Prerequisites
- Step-by-Step Implementation
- Check Digit and Customization Options
- Customizing Barcode Appearance
- Supported Output Formats
- Troubleshooting & Common Issues
- FAQs
- Use Cases and Applications
- Best Practices
- Related Articles
- Conclusion
Introduction
This article covers how to generate Codabar and Code 11 barcodes for healthcare, library, telecom, and parcel tracking using Aspose.BarCode for .NET. C# code and workflow tips are included.
Prerequisites
- Visual Studio 2019 or later
- .NET 6.0+ or .NET Framework 4.6.2+
- Aspose.BarCode for .NET (NuGet)
- Basic C# knowledge
PM> Install-Package Aspose.BarCode
Step-by-Step Implementation
Codabar Example:
using Aspose.BarCode.Generation;
BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Codabar, "A123456B");
gen.Save("codabar-bloodbank.png", BarCodeImageFormat.Png);
Code 11 Example:
BarcodeGenerator gen = new BarcodeGenerator(EncodeTypes.Code11, "12345-6789");
gen.Save("code11-telecom.png", BarCodeImageFormat.Png);
Check Digit and Customization Options
- Code 11 Check Digit:
csgen.Parameters.Barcode.Code11.EnableChecksum = true;
- Bar Height/Width:
csgen.Parameters.Barcode.BarHeight.Pixels = 80; gen.Parameters.Barcode.XDimension.Pixels = 2;
- Color/Background:
csgen.Parameters.Barcode.BarColor = Color.MidnightBlue; gen.Parameters.Barcode.BackColor = Color.White;
- Caption:
csgen.Parameters.CaptionBelow\.Visible = true;
Customizing Barcode Appearance
- See above for bar height, width, and color
- Adjust XDimension and BarHeight for label size
- Use SVG or PNG for crisp printing
Supported Output Formats
- PNG, JPEG, BMP – Print and digital
- TIFF – Archival or medical/lab printers
- SVG, EMF – Large-scale or digital labels
Troubleshooting & Common Issues
Barcode not scanning?
- Use only valid characters; ensure proper start/stop symbols for Codabar.
Checksum errors?
- Enable/disable checksum to match scanner or app expectations.
Small label not fitting?
- Lower BarHeight and XDimension.
FAQs
Q: Are these barcodes accepted in modern healthcare and libraries? A: Yes—both are used worldwide for legacy and new workflows.
Q: Can I encode text with Codabar? A: No—Codabar is numeric with A-D for start/stop only.
Use Cases and Applications
- Blood bank labeling (Codabar)
- Library and lending management
- Parcel and mail tracking
- Telecom asset/inventory (Code 11)
Best Practices: Quick Reference Table
Tip | Do | Don’t |
---|---|---|
Charset | Codabar: 0-9,A-D; Code 11: 0-9,- | Use letters or symbols |
Start/Stop | Use A-D for Codabar | Omit start/stop characters |
Output Format | SVG/PNG for crisp output | Low-res JPG for printing |
Check Digit | Enable if workflow requires | Enable randomly |
Conclusion
Codabar and Code 11 remain essential for healthcare, library, and legacy tracking workflows. Aspose.BarCode for .NET makes their generation and integration simple. See the Aspose.BarCode API Reference for more examples and options.