Generating a barcode with ZXing.Net

1. Installing ZXing.Net library.

Using nuget package installer install ZXing.Net libarary. Once installed you should be able to see zxing and zxing.presentation references.

2. Using ZXing library in a c# class. 

string content = barcodeNumber;

IBarcodeWriter writer = new BarcodeWriter
{
Format = BarcodeFormat.EAN_13,
Options= new ZXing.Common.EncodingOptions
{
Height=100,
Width =200,
Margin=2
}
};

Bitmap barcodeBitmap;
var barcode= writer.Write(content);
MemoryStream stream = new MemoryStream();
barcode.Save(stream, ImageFormat.Bmp);

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s