Barcode .NET >
Barcode in ASP.NET
How to Generate Barcodes in ASP.NET
BizCode Generator for ASP.NET is a powerful and mature .NET barcode generating component, which allows developers easily to generate linear & 2D barcodes and add advanced linear & 2D barcode features to the ASP .NET Web applications.
BizCode Generator for ASP.NET is able to integrate dynamic barcodes, like QR Code, Data Matrix, PDF-417, Code 39, Code 128, EAN 8, EAN 13, GS1 128, Intelligent Mail, ITF-14, and UPC-A, in accordance with the established barcode specifications.
This
Barcode Generate ASP.NET DLL provides advanced barcode customization controls for draw and stream linear & 2D barcodes in ASP.NET Web applications to suit users' needs. This integration guide suggests how to use BizCode Barcode controls in Microsoft ASP.NET. BusinessRefinery also provides
samples to create barcodes with a given size in ASP.NET.
ASP.NET Barcode Generator Requirements
Windows OS
Compatible with Microsoft Windows 7, Windows Server 2008, Windows Vista, Windows Server 2003, Windows XP, etc. |
.NET Support
written in managed C#, full integration into .NET development environment, like ASP.NET web sites, Windows Forms, Crystal Reports, Reporting Service, etc. |
Install - Add ASP.NET Barcode Generating Reference to You Project
- Unzip BizCode Generator for ASP.NET trial;
- Copy BusinessRefinery.Barcode.Web.dll to your ASP.NET project folder;
(Do not copy dll to .NET bin directory; Visual Studio build tools will do it for you.) - Open your Microsoft Visual Studio and create a ASP.NET project named "BR-Barcode";
- Click "Project" and choose "Add Reference";
- Go to "Browse" and select BusinessRefinery.Barcode.Web.dll;
- Then "BusinessRefinery.Barcode.Web.dll" is added on your ASP.NET project.
Install - Add ASP.NET Web Form Control to ASP.NET Visual Studio Toolbox
- Unzip BizCode Generator for ASP.NET trial;
- Open your Microsoft Visual Studio and create a ASP.NET project named "BR-Barcode";
- Right click Visual Studio Toolbox, select "Choose Items... ";
- In "Choose Toolbox Items" form, click button "Browse...", and select "BusinessRefinery.Barcode.Web.dll";
- After selection, you will find four items under "Components" section: WebLinear, WebDataMatrix, WebPDF417, and WebQRCode;
- Select all of 4 components. Then these 4 components in your Visual Studio Toolbox.
How to Drag & Drop Barcode Control into ASP.NET projects?
- Install ASP.NET Barcode Generator Control;
- Add ASP.NET Barcode Generator Control to your Visual Studio ToolBox;
- Copy "linear_generator.aspx" and "linear_generator.aspx.cs" to the folder where your aspx pages are generating barcodes;
- Drag and drop "WebLinearBarcode" to your ASPX web forms;
- Run the website to view the barcodes generated. Default is a Code 128 encoding "1234";
- To change barcode default value through codings in aspx pages, follow the sample code below:
using BusinessRefinery.Barcode;
using System.Drawing.Imaging;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.WebLinearBarcode1.Code = "123456";
this.WebLinearBarcode1.Symbology = Symbology.CODE128;
this.WebLinearBarcode1.Resolution = 104;
this.WebLinearBarcode1.Rotate = Rotate.Rotate180;
this.WebLinearBarcode1.Format = ImageFormat.Gif;
this.WebLinearBarcode1.BarWidth = 3;
this.WebLinearBarcode1.BarHeight = 60;
this.WebLinearBarcode1.BarcodeUnit = BarcodeUnit.PIXEL;
this.WebLinearBarcode1.Resolution = 72;
}
}
Imports BusinessRefinery.Barcode
Imports System.Drawing.Imaging
Public Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(sender As Object, e As EventArgs)
Me.WebLinearBarcode1.Code = "123456"
Me.WebLinearBarcode1.Symbology = Symbology.CODE128
Me.WebLinearBarcode1.Resolution = 104
Me.WebLinearBarcode1.Rotate = Rotate.Rotate180
Me.WebLinearBarcode1.Format = ImageFormat.Gif
Me.WebLinearBarcode1.BarWidth = 3
Me.WebLinearBarcode1.BarHeight = 60
Me.WebLinearBarcode1.BarcodeUnit = BarcodeUnit.PIXEL
Me.WebLinearBarcode1.Resolution = 72
End Sub
End Class
How to Create Barcodes in Microsoft IIS through URL?
- Unzip BizCode Generator for ASP.NET trial;
- Copy barcode fold and contents to IIS and create a new file directory called "barcode";
- Restart IIS, navigate to http://localhost/barcode/qrcode_generator.aspx?code=qrcode;
- To change barcode default values, add more parameters with "&" in the URL, like this:
http://localhost/barcode/qrcode_generator.aspx?code=qrcodedata&module-size=3&top-margin=12 - Add an image tag into the web page to create QR Code barcode image in html or aspx pages, e.g.
<img src="http://localhost/barcode/qrcode_generator.aspx?code=qrcodedata&module-size=3" />.
How to Create Barcodes in C#, VB.NET Class Library with ASP.NET Barcode DLL?
Copy those following code to your Visual C# / VB.NET project:
using BusinessRefinery.Barcode;
QRCode barcode = new QRCode();
barcode.Code = "QR Code";
barcode.Resolution = 104;
barcode.Rotate = Rotate.Rotate180;
barcode.Format = ImageFormat.Gif;
barcode.drawBarcode2ImageFile("c:/qr-code-csharp.gif")
Imports BusinessRefinery.Barcode
Dim barcode As BusinessRefinery.Barcode.QRCode =
New BusinessRefinery.Barcode.QRCode()
barcode.Code = "QR Code"
barcode.Resolution = 104
barcode.Rotate = BusinessRefinery.Barcode.Rotate.Rotate270
barcode.Format = System.Drawing.Imaging.ImageFormat.Gif
barcode.drawBarcode2ImageFile("c:/qr-code-vb-net.gif")
How to Draw Barcodes to Image Files and ASP.NET Objects in Class?
Copy those following code to your C# / VB.NET class project:
using BusinessRefinery.Barcode;
using System.Drawing.Imaging;
QRCode barcode = new QRCode();
barcode.Code = "QR Code";barcode.Format = ImageFormat.Gif;
barcode.drawBarcode2ImageFile("c:/qr-code-csharp.gif")
//Draw barcode image into ASP.NET Graphics, Stream & Bitmap objects.
public void drawBarcode2ImageFile(string filename);
public void drawBarcode2Stream(Stream fileStream);
public byte[] drawBarcodeAsBytes();
public Bitmap drawBarcodeOnBitmap();
public void drawBarcodeOnGraphics(Graphics graphics);
Dim barcode As BusinessRefinery.Barcode.QRCode =
New BusinessRefinery.Barcode.QRCode()
barcode.Code = "QR Code"
barcode.Resolution = 104
barcode.Rotate = BusinessRefinery.Barcode.Rotate.Rotate270
barcode.Format = System.Drawing.Imaging.ImageFormat.Gif
barcode.drawBarcode2ImageFile("c:/qr-code-vb-net.gif")
'Draw barcode image into ASP.NET Graphics, Stream & Bitmap objects.
Public Sub drawBarcode2Stream(ByVal fileStream As System.IO.Stream)
Public Sub drawBarcodeOnGraphics(ByVal graphics As
System.Drawing.Graphics)
Public Function drawBarcodeAsBytes() As Byte()
Public Function drawBarcodeOnBitmap() As System.Drawing.Bitmap