C# .NET - Barcode Generator

Asked By Sanjai Raj on 05-Feb-11 04:51 AM

Hi,

I want to create a Barcode for the equilant input in the textbox and also set printing int the window,

How to achieve this Give me a Solutions. . .

Thanx in Advance. . .

Anoop S replied to Sanjai Raj on 05-Feb-11 05:04 AM
refer this code for how to create barcode using Code39
Linear barcode = new Linear();     // Create linear barcode object 
barcode.Type = BarcodeType.CODE39;   // Set barcode symbology type to Code-39
barcode.Data = "0123456789";       // Set barcode data to encode
barcode.X = 1;         // Set barcode bar width (X dimension) in pixel
barcode.Y = 60;          // Set barcode bar height (Y dimension) in pixel
barcode.drawBarcode("csharp-code39.png");    // Draw & print generated barcode to png image file

Barcode Code-39

refer this for more details
http://community.bartdesmet.net/blogs/bart/archive/2006/09/18/4432.aspx
http://www.keepdynamic.com/barcoding/csharp-barcode-generator.shtml
http://www.onbarcode.com/tutorial/csharp-barcode-generation.html
Sanjai Raj replied to Anoop S on 05-Feb-11 05:09 AM

Hi,

It Produced error like

Error   43   The type or namespace name 'Linear' could not be found (are you missing a using directive or an assembly reference?)   D:\Verify\Verify\Verify\code.cs   51   13   Verify

which reference i should be add. . .
Anoop S replied to Sanjai Raj on 05-Feb-11 06:00 AM
1st You need to install barcode generator, you can download it from here
http://www.onbarcode.com/products/net_barcode/file_download.php%20

all things explained in the 3rd link

1. How to install .NET Barcode Generator Control to your Visual C# project?

Add OnBarcode.Barcode.WinForms.dll or OnBarcode.Barcode.ASPNET.dll to C# project reference

2. How to create linear barcodes in C# class?

Linear barcode = new Linear();                 // Create linear barcode object  
barcode.Type = BarcodeType.CODE39;	       // Set barcode symbology type to Code-39
barcode.Data = "0123456789";                   // Set barcode data to encode
barcode.X = 1;                                 // Set barcode bar width (X dimension) in pixel
barcode.Y = 60;                                // Set barcode bar height (Y dimension) in pixel
barcode.drawBarcode("csharp-code39.png");      // Draw & print generated barcode to png image file

Barcode Code-39

3. How to draw & print QR-Code in C# class?

QRCode qrCode = new QRCode();                  // Create QRCode object                  
qrCode.Data = "VB.NET QRCode";                 // Set QR Code data to encode
qrCode.DataMode = QRCodeDataMode.Auto;         // Set QRCode data mode (http://www.onbarcode.com/products/net_barcode/barcodes/qrcode.html)
qrCode.drawBarcode("csharp-qrcode.jpg");       // Draw & print generated QR Code to jpeg image file

4. How to create & print Data Matrix in C# class?

DataMatrix datamatrix = new DataMatrix();             // Create Data Matrix object
datamatrix.Data = "VB.NET DataMatrix";                // Set Data Matrix data to encode
datamatrix.DataMode = DataMatrixDataMode.ASCII;       // Set Data Matrix data mode (http://www.onbarcode.com/products/net_barcode/barcodes/data_matrix.html)
datamatrix.drawBarcode("csharp-data-matrix.gif");     // Draw & print generated Data Matrix to gif image file

5. How to create & print PDF-417 in C# class?

PDF417 pdf417 = new PDF417();                // Create PDF417 object  
pdf417.Data = "VB.NET PDF-417";              // Set Data Matrix data to encode
pdf417.DataMode = PDF417DataMode.Auto;       // Set PDF-417 data mode (http://www.onbarcode.com/products/net_barcode/barcodes/pdf417.html)
pdf417.RowCount = 3;                         // Set PDF-417 number of rows
pdf417.ColumnCount = 5;                      // Set PDF-417 number of columns
pdf417.drawBarcode("csharp-pdf417.gif");     // Draw & print generated Data Matrix to gif image file

6. In C# Barcode Generator, how to print & encode barcodes to GIF, JPEG, PNG & BMP?

Linear barcode = new Linear();                 // Create linear barcode object  
barcode.Type = OnBarcode.Barcode.BarcodeType.CODE39;
barcode.Data = "0123456789";
// Encode barcodes to other image format, by change file extension
barcode.drawBarcode("C://csharp-barcode-code39.gif");
DL M replied to Sanjai Raj on 05-Feb-11 06:05 AM
try this below code

1:
BarcodeLib.Barcode.Linear.Linear barcode = new BarcodeLib.Barcode.Linear.Linear();
   2:  barcode.Type = BarcodeLib.Barcode.Linear.BarcodeType.CODE39;
   3:  barcode.Data = "123456789";
   4:  // other barcode settings.
   5:   
   6:  // save barcode image into your system
   7:  barcode.drawBarcode("c:/barcode.png");
http://www.barcodelib.com/csharp/
mariah sharp replied to Sanjai Raj on 09-Jul-13 12:19 AM
You may take a look at this ,barcode for window. Hope it helpful !
http://www.keepautomation.com/font_tools/excel_word_barcode_addin_font_encoder.html