Java Barcode Generator, .NET Barcode Generator for C#, ASP.NET, VB.NET
HOME BARCODE FOR ASP.NET PURCHASE

Generating Barcodes in ASP.NET Websites




Quick Navigate


 

1. Run Demo Web Application

  1. Under downloaded trial package, copy barcode folder to your IIS folder, e.g. C:\Inetpub.
  2. Create a new virtual directory in IIS, named barcode, and link to the above "barcode" folder.
  3. Restart IIS.
  4. Open your web browser, and navigate to http://YourDomain:Port/barcode/linear.aspx?Type=CODE39&Data=12345678
  5. To view demo application source code (in C#), go to folder barcode in the trial package.
 

2. Install & Integrate Barcode for ASP.NET DLL Component

There are two methods to create barcode images in your ASP.NET web applications.  

  1. The Simplest way is to stream barcode image using our Buildin ASP.NET Barcode Application.

    • Under downloaded trial package, copy barcode folder to your IIS folder, e.g. C:\Inetpub.
    • Create a new virtual directory in IIS, named barcode, and link to the above "barcode" folder.
    • Restart IIS.
    • To test your installation, open your web browser and navigate to
      http://YourDomain:Port/barcode/linear.aspx?Type=CODE39&Data=12345678
    • To create barcode image in your aspx or html page, you need pass the url to IMG tag src value.

      For linear barcode
      <img src="http://YourDomain:port/barcode/linear.aspx?Type=CODE39&Data=12345678" />

      or for Data Matrix
      <img src="http://YourDomain:port/barcode/datamatrix.aspx?Data=12345678" />

      or for PDF417
      <img src="http://YourDomain:port/barcode/pdf417.aspx?Data=12345678" />

      or for QR Code
      <img src="http://YourDomain:port/barcode/qrcode.aspx?Data=12345678" />


      Using this method, it will not generate any barcode images in your IIS server side.


  2. The second method is to generate barcode images through ASP.NET Web Form controller

    1. Install ASP.NET Barcode Controller to your ASP.NET project.
      1. Add Reference BarcodeLib.Barcode.ASP.NET.dll to your project.
        Do not copy the dll to the bin directory, Visual Studio will do so, during project compilation time.
    2. Add barcode library to your Visual Studio Toolbox.
      1. Open Toolbox in Visual Studio. Click menu View, and check submenu Toolbox.
      2. Right click Toolbox, click menu Choose Items...
      3. Goto .NET Framework Components tab.
      4. If no BarcodeLib component found, click Browse... button and select BarcodeLib.Barcode.ASP.NET.dll file.
      5. Then sort "Namespace" column, you will find 4 components from BarcodeLib.Barcode.
      6. Check component DataMatrixASPNET, and its namespace is BarcodeLib.Barcode.
      7. Check component LinearASPNET, and its namespace is BarcodeLib.Barcode.
      8. Check component PDF417ASPNET, and its namespace is BarcodeLib.Barcode.
      9. Check component QRCodeASPNET, and its namespace is BarcodeLib.Barcode.
      10. Click "OK" button, you will find four components under "General": LinearASPNET, DataMatrixASPNET, PDF417ASPNET, QRCodeASPNET.
    3. Go to "barcode" folder in the trial package, copy files "linear.aspx", "linear.aspx.cs", "datamatrix.aspx", "datamatrix.aspx.cs", "pdf417.aspx", "pdf417.aspx.cs", "qrcode.aspx", "qrcode.aspx.cs" to the same folder as your aspx page, which will generate barcodes.
    4. You can drag LinearASPNET on your aspx page, change barcode setting through properties window.
    5. Run the project, you will find barcode images generated in your aspx pages.

 

3. Generate Barcodes in .NET Class

The following C#.net code illustrates how to generate a 1d (linear) barcode in a C# class

	BarcodeLib.Barcode.Linear barcode = new BarcodeLib.Barcode.Linear();

	barcode.Type = BarcodeType.CODE39;

	barcode.Data = "CODE39";

	barcode.UOM = UnitOfMeasure.PIXEL;
	barcode.BarWidth = 1;
	barcode.BarHeight = 80;
	barcode.LeftMargin = 5;
	barcode.RightMargin = 5;
	barcode.TopMargin = 5;
	barcode.BottomMargin = 5;
	
	barcode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
	
	// save barcode image into your file system
	barcode.drawBarcode("C://barcode.png");
	
	// generate barcode & output to byte array
	byte[] barcodeInBytes = barcode.drawBarcodeAsBytes();
	
	// generate barcode to Graphics object
	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);
 

4. Property Settings for Each Barcode Types











   Copyright BarcodeLib.com. All rights reserved.