BizCode Barcode Generator for ASP.NET
The most professional barcode solutions for Microsoft ASP.NET
Quick Overviews
  • Barcode creating class library
  • Support ASP.NET IDEs & IIS
  • Easy to use & integrate
  • Dynamic barcodes support
  • High-usability controls provided
How to Generate Code 128 images in ASP.NET
BusinessRefinery.com ASP.NET Code 128 Barcode Generator is an ASP.NET barcode generation DLL that enables .NET developers to create, manage and manipulate Code 128 barcodes in ASP.NET Web Forms as well as in Internet Information Service (IIS).
ASP.NET Code 128 Barcode Generator is an easy method of barcode creation to generate, stream your own Code 128 barcodes in ASP.NET projects, including ASP.NET Web forms, ASP.NET web applications, Crystal Reports for ASP.NET, SSRS for ASP.NET and Internet Information Service.
This passage tells you how to customize Code 128 barcode image with color, rotation angle, image resolution, image format, etc; Other Code 128 barcode related property settings, please go to:
Code 128 Image Related Properties

Barcode Margin

Barcode Generator for ASP.NET provides Margin class for users, if they want to adjust quiet margin of top, bottom, right and left surrounding Code 128 barcode symbols.

Barcode Resolution

Barcode Generator for ASP.NET provides Resolution class for users, if they want to set the Code 128 barcode images resolution in DPI according to their custom settings.

Barcode Rotation

Barcode Generator for ASP.NET provides Rotate class for users, if they want to rotate their Code 128 barcode images into any angle of 0, 90, 180 and 270 degrees.

Image Formats

Barcode Generator for ASP.NET provides ImageFormat class for users to save the barcode images to most of the popular image formats, such as Png, Jpeg/Jpg, Gif, Tiff, Bmp, etc.

ASP.NET Graphic Objects

Barcode Generator for ASP.NET provides DrawBarcode method for users, if they want to save Code 128 barcode images into ASP.NET Graphics, Stream and Bitmap objects.
Customize Code 128 Barcode Images in ASP.NET & IIS
Be sure that you have installed those following programs onto your computers:
  • Microsoft .NET Framework 2.0/3.0/4.0
  • Microsoft Visual Studio 2005/2008/2010 (Express, Professional & Standard Edition)
  • Microsoft Internet Information Service (IIS)
  • Barcode Generator for ASP.NET installed
Customize Code 128 Barcode Images in ASP.NET Web Forms Using BarcodeControl
  1. Add ASP.NE Barcode Control onto your .NET Visual Studio Toolbox;
  2. Drag and drop the WebLinearBarcode control into the Forms;
  3. Run the website and you will see a barcode image generated;
  4. Go to Address bar and change your URL with following one: http://localhost/br_barcode/linear.aspx?code=0123456789&symbology=7&top-margin=5&bottom-margin=5&right-margin=7&left-margin=7&resolution=104&rotate=2
  5. Then a Code 128 with customized image occurs.
Customize Code 128 Barcode Images in ASP.NET Using C#, VB.NET Class
using BusinessRefinery.Barcode;

Linear barcode = new Linear();
barcode.Symbology = Symbology.CODE128;
barcode.Code = "0123456789";

// Adjust Code 128 barcode margin of top, bottom, left and right
barcode.BottomMargin = 7;
barcode.TopMargin = 7;
barcode.LeftMargin = 5;
barcode.RightMargin = 5;

// Change Code 128 resolution in DPI
barcode.Resolution = 104;

// Rotate Code 128 barcode image
barcode.Rotate = Rotate.Rotate180;

// Save Code 128 in multiple image formats
barcode.Format = ImageFormat.Gif;
barcode.drawBarcode2ImageFile("c:/code-128-csharp.gif");

// Save Code 128 barcode in ASP.NET 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.Linear = 
New BusinessRefinery.Barcode.Linear()
barcode.Symbology = BusinessRefinery.Barcode.Symbology.CODE128
barcode.Code = "0123456789"

' Adjust Code 128 barcode margin of top, bottom, left and right
barcode.BottomMargin = 7
barcode.TopMargin = 7
barcode.LeftMargin = 5
barcode.RightMargin = 5

' Change Code 128 resolution in DPI
barcode.Resolution = 104

' Rotate Code 128 barcode image
barcode.Rotate = Rotate.Rotate180

' Save Code 128 in multiple image formats
barcode.Format = ImageFormat.Gif
barcode.drawBarcode2ImageFile("c:/code-128-vb-net.gif")

' Save Code 128 barcode in ASP.NET 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
Customize Code 128 Barcode Images in Internet Information Service (IIS)
  1. Download Barcode Generator for ASP.NET and unzip;
  2. Copy the whole barcode fold and contents into IIS and create a new virtual directory called "br_barcode";
  3. Restart IIS, navigate to http://localhost/br_barcode/linear.aspx?code=0123456789&symbology=7&top-margin=5&bottom-margin=5&right-margin=7&left-margin=7&resolution=104&rotate=2;
  4. Add an image tag <img> into the web page to create Code 128 barcode image in html or aspx pages, e.g.
    <img src=" http://localhost/br_barcode/linear.aspx?code=0123456789&symbology=7&top-margin=5&bottom-margin=5&right-margin=7&left-margin=7&resolution=104&rotate=2"/>.