Lightweight Barcode Encoding Library for .NET Framework, .NET Standard and .NET Core. Additional packages are available for rendering the generated barcode to SVG or an image.
Code ported from the GO project https://github.com/boombuler/barcode by Florian Sundermann.
Supported Barcode Types:
- 2 of 5
- Aztec Code
- Codabar
- Code 39
- Code 93
- Code 128
- Data Matrix (ECC 200)
- Data Matrix GS1
- EAN 8
- EAN 13
- KIX (used by PostNL)
- PDF 417
- QR Code
- RM4SC (Royal Mail 4 State Code)
- UPC A
- UPC E
To install the main package:
PM> Install-Package Barcoder
To install the SVG renderer:
PM> Install-Package Barcoder.Renderer.Svg
To install the image renderer:
PM> Install-Package Barcoder.Renderer.Image
var barcode = Code128Encoder.Encode("FOO/BAR/12345");
var renderer = new SvgRenderer();
using (var stream = new MemoryStream())
using (var reader = new StreamReader(stream))
{
renderer.Render(barcode, stream);
stream.Position = 0;
string svg = reader.ReadToEnd();
Console.WriteLine(svg);
}
Example for rendering to PNG:
var barcode = QrEncoder.Encode("Hello World!");
var renderer = new ImageRenderer(imageFormat: ImageFormat.Png);
using (var stream = new FileStream("output.png", FileMode.Create))
{
renderer.Render(barcode, stream);
}
Supported image formats can be found here