How to Generate, Print Barcode Label using C# in ASP.NET Web Forms Application
- Install Barcode Library DLL Solution for ASP.NET.
Please add OnBarcode.Barcode.ASPNET.dll to your Visual Studio ASP.NET web project. - Add Barcode Library dll component for ASP.NET to Visual Studio Toolbox.
Right click Toolbox, select Choose Items..., and click Browse... to locate OnBarcode.Barcode.ASPNET.dll. - Copy qrcode.aspx and qrcode.aspx.cs to the web project folder you created.
Here, we take QR Code as an example. If you want to create linear or other 2d barcodes, please copy respective files to the project folder. - Drag and drop QRCodeWebForm to your ASPX web forms and run the project.
Then a QR Code is created on website page. Parameters are user-defined. Please view API details from QR Code property settings.
How to Generate Barcode in IIS Streaming using C#
- Copy barcode folder and its contents from the downloaded package to your IIS.
- Create a new virtual directory and name it barcode.
- Restart IIS and navigate to (QR Code encoding alphanumeric sample text): http://YourDomain:Port/barcode/qrcode.aspx?DATA=9876543210
- To display or preview a square QR Code image in html or aspx pages, you may directly use an image tag like the sample below:
<img src="http://YourDomain:Port/barcode/qrcode.aspx?DATA=0123456789"/>
How to Generate Barcode in ASP.NET C# Class
OnBarcode provides complete C# demo codes for quick barcode label printing. Designers can edit settngs to encode barcode value (ie.string, characters or byte array), control barcode vector image (Gif, Jpeg, Png, Tiff formats) or bitmap, adjust barcode size (width, height) and color, auto check digit calculation. For namespace and method to use, please see the sample below.
- Verify that you have installed VS (Visual Studio) 2005, 2008 or 2010.
- Add Barcode Library DLL for ASP.NET to your ASP.NET C# project reference.
- Copy the C# syntax to your barcode system to create a unique QR Code barcode item on ASP.NET web page.
// Create a ASP.NET QR Code object
QRCode qrCode = new QRCode();
// Customize QR Code barcode data
qrCode.Data = "ASP.NET C# QR Code";
// Customize QR Code data mode
qrCode.DataMode = QRCodeDataMode.Auto;
// Customize QR Code barcode size
qrCode.X = 2;
qrCode.LeftMargin = 8;
qrCode.RightMargin = 8;
qrCode.TopMargin = 8;
qrCode.BottomMargin = 8;
// Encode created QR Code to png image file and save it to C:\
qrCode.ImageFormat = System.Drawing.Imaging.ImageFormat.Png;
qrCode.drawBarcode("C://aspnet-csharp-qrcode.png");
How to generate barcode image with transparent background in asp.net using C#
In ASP.NET web streaming
To create transparent background barcode images in IIS asp.net web streaming, you shall apply the following http url properties.
- FORE-COLOR: Barcode bar module color
- TEXT-COLOR: The text color is usually the same as bar module color
- BACK-COLOR: To set transparent background, the value should be "00000000"
- FORMAT: The value should be "png"
Here is a sample url to create a Code 128 barcode image with transparent background in png image.
http://YourDomain:Port/barcode/linear.aspx?TYPE=7&DATA=Code-128&X=3& FORE-COLOR=ffffff&TEXT-COLOR=ffffff&BACK-COLOR=00000000&TEXT-FONT=Arial|16|Regular&FORMAT=png
In ASP.NET C# class
To generate transparent background barcode image in ASP.NET C# class, please go to the C# barcode image generator how to page
How to encode, create non-printable chars in barcode images using asp.net c#
Some barcodes, such as Code 128, QR Code supports non-printable chars encoding. Here is an example to encode char 'CR' (Carriage Return).
- Set property ProcessTilde to true.
- Convert non-printable char to '~ddd' format. Here ddd is the char ASCII Integer code. 'CR' should be converted to '~013'.
- Set property Data to '~013'
How to encode, print GS1 data in barcodes using asp.net c#
The GS1 system originated in the United States and was established in 1973 by the Uniform Product Code Council, known until recently as the Uniform Code Council, Inc. (UCC) and since 2005 as GS1 US.
The following barcode symbologes support GS1 data encoding:
The following barcode symbologes support GS1 data encoding:
- EAN/UPC: UPC-A, UPC-E, EAN-13, and EAN-8 barcodes, and the two- and five-digit add-on symbols
- ITF-14
- GS1-128 (EAN-128)
- GS1 DataBar
- Composite Component symbols do not exist in isolation. The primary identification number is always encoded in the linear symbol and supplementary GS1 Application Identifier element strings are encoded in the two-dimensional (2D) component where they take up less space
- Data Matrix
- GS1 QR Code
Please read each barcode symbology guide page to encode GS1 data.
How to encode, print non-English chars (Unicode text) in barcode images using c#
Most of the barcode types do not support encoding non-English text (such as Thai, Arabic) directly. To encode those chars, you need convert non-English chars into byte array, and encode
byte array into barcode.
2D barcodes Data Matrix, PDF-417, QR Code support byte array data mode. Check each barcode symbology guide page to encode non-English chars.
2D barcodes Data Matrix, PDF-417, QR Code support byte array data mode. Check each barcode symbology guide page to encode non-English chars.
C#.NET Barcode Generation Guides & Tutorials for Each Barcode
Barcode Control for C#.NET - Bar Code Type Generation
- C#.NET Linear Barcode Images:
- C#.NET 2D Barcode Images: Data Matrix, PDF417, QR Code, Micro PDF417, Micro QR Code
