|
|
|||||||
Generating Barcodes in .NET ClassDeveloper Guide
Quick Navigate 1. Run Demo Windows Application
2. Install .NET Barcode Dll Component(s)
Add Reference BarcodeLib.Barcode.ASP.NET.dll or BarcodeLib.Barcode.WinFroms.dll to your .NET project.
3. Generate Barcodes in .NET ClassThe 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
|
||||||||