How to Generate Barcode in ASP.NET using C#
- Easy to install BarcodeLib.Barcode.ASP.NET.dll to your Visual Studio ASP.NET Web application
- Easy to encode and generate linear & 2d barcodes using C# demo code
- Use C# code to create and print barcode images on web pages or your IIS projects
- Use C# code to customize your created barcode image properties
- Use C# code to save barcode images in the memory or stream to a web page
- Able to generate more than 20 common barcodes, like Codabar, Code 39, Code 128, EAN/UPC,
Postal Barcode, QR-Code, Data Matrix, PDF-417 and so on
ASP.NET C# Barcode Generation Prerequisites
- BarcodeLib.Barcode.ASP.NET.dll
- Microsoft .NET Framework 2.0 (or later)
- Visual Studio .NET 2005 or above
Create Barcode Image in ASP.NET Web Application in C#
Install
- Add Reference BarcodeLib.Barcode.ASP.NET.dll component to your asp.net website project reference.
Implement
Here is the Visual C#.NET sample code for you to generate QR Code barcode images in C# Class Library. Please to your Visual Studio ASP.NET web applications for a barcoding test.
BarcodeLib.Barcode.Linear barcode = new BarcodeLib.Barcode.Linear();
barcode.Type = BarcodeType.CODE128;
barcode.Data = "CODE128";
barcode.LeftMargin = 0;
barcode.RightMargin = 0;
barcode.TopMargin = 0;
barcode.BottomMargin = 0;
barcode.Resolution = 72;
barcode.Rotate =RotateOrientation.BottomFacingDown;
barcode.UOM = UnitOfMeasure.PIXEL;
// other barcode settings.
// save barcode image into your system
barcode.drawBarcode("c:/csharp-barcode.png");
// generate barcode & output to byte array
byte[] barcodeInBytes = barcode.drawBarcodeAsBytes();
// generate barcode to <strong>Graphics object<strong>
Graphics graphics = ...
barcode.drawBarcode(graphics);
// generate barcode and output to Bitmap object
Bitmap barcodeInBitmap = barcode.drawBarcode();
// generate barcode and output to HttpResponse object
HttpResponse response = ...;
barcode.drawBarcode(response);
// generate barcode and output to Stream object
Stream stream = ...;
barcode.drawBarcode(stream);
Other Methods to Create Barcodes in C# ASP.NET
Stream Barcodes with Buildin ASP.NET Barcode Application
Developers can stream barcode images with Buildin ASP.NET Barcode Application. Using this method you can create barcodes with a single URL through Microsoft Internet Information Service (IIS). Generated barcode images can be saved for future use, and you just need to pass the url to img tag.
<
div class="bl_paragraph">
This method is the easiest way as you can create dynamic barcode images, and adjust barcode settings through the url.
View How to Stream Barcodes with Building ASP.NET Barcode Application