Using C# Barcode Generator
How to generate barcode labels in c# asp.net web page without font

Free demo source code to generate, display, print linear, 2d barcode labels in pdf, image files using c# in asp.net mvc project.
Barcode for .NET Suite > Generate Barcode in C#


  • Quick to generate QR Code, 2d, 1d barcodes on the ASP.NET (framework) Web Forms, print to server side image file system or database
  • Easy to create barcodes through URL, customize barcodes with http url parameters without any programming in ASP.NET web server
  • Fully support .NET Framework 4.x, 3,x, 2.x ASP.NET Web Forms, MVC, web service and web applications
  • Support barcode generating not only on ASP.NET Framework web appliations, but also on ASP.NET Core web apps

How to Generate Barcodes using ASP.NET Web Forms Barcode Generator control using C#?









In Visual Studio Solution Explorer Window, right click menu References. Select menu Add Reference....



In the Reference Manager windows, click button Browse... to add KeepAutomation ASP.NET Barcode Generator dll.

Navigate to the downloaded package /DLL/Net40/, choose file KeepAutomation.Barcode.Web.dll

Click button OK

Now you can find the ASP.NET Barcode Generator dll added successfully in your ASP.NET application project references.



Open Toolbox in Visual Studio, right click Tab Standard. Choose menu "Choose Items..."



In the opened Choose Toolbox Items window, click button Browse...

Navigate to the downloaded package /DLL/Net40/, choose file KeepAutomation.Barcode.Web.dll again.

You can find the selected barcode generator dll is ready to be loaded. Click button OK.



Now you can find the Barcode Generator web control item under the tab "Standard" in the "Toolbox. And the KeepAutomation ASP.NET Barcode Generator web control has been installed to Visual Studio successfully.

In the ASP.NET web forms project, add a new item "Web Form" to the project, named barcode.aspx

Replace the barcode.aspx content with the following C# source code.

<%@ Page Language="C#" %>
<%@ Import Namespace="KeepAutomation.Barcode.Web" %>
<%
	BarCodeStream.generateBarcode(Request, Response);
%>


Replace the barcode.aspx.cs content with the following C# source code.

using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class barcode : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
}


In Visual Studio project, click the web file Default.aspx. Open the web file in Design view mode

Drag and drop the installed BarCodeControl from "Toolbox" to the place where to genarate the barcode in the web page "Default.aspx"



Run the ASP.NET web forms application in Visual Studio. In the opened web browser, a sample Code 128 barcode is displayed in the web page "Default.aspx". You can customize the barcode properties in the control Properties or in the Default.aspx.cs C# source codes.



Select the barcode control on the Default.aspx web page, on the right Properties window, change property X to 2.

Run the web application, you can find the generated Code 128 barcode has been updated.



You can also customize and update barcode from the C# source code.

In Default.aspx.cx, add the following C# source code to update the encoding barcode data.

            BarCodeControl1.CodeToEncode = "ABC-123";




How to Generate Barcodes in ASP.NET web server side using C#?

  1. Download KA.Barcode for .NET Suite trial package.
  2. Create a new ASP.NET Web Forms application using the installed project templates in C# projects.
  3. Add barcode generator dll to the ASP.NET project reference
  4. Copy "barcode.aspx" and "barcode.aspx.cs" to the folder where you generate barcode.
  5. Open the web forms page C# source code file "file name.aspx.cs"
  6. Try the following C# demo source code to generate barcodes in your ASP.NET server side file system
C# Sample code
     BarCode barcode = new BarCode();
barcode.Symbology = KeepAutomation.Barcode.Symbology.Code39ex;
barcode.CodeToEncode = "Code 39";
barcode.X = 1;
barcode.WideNarrowRatio = 3;
barcode.Y = 40;
barcode.I = 10;
barcode.TopMargin = 10;
barcode.BottomMargin = 10;
barcode.LeftMargin = 10;
barcode.RightMargin = 10;
barcode.DisplayText = true;
barcode.DisplayStartStop = true;
barcode.BarcodeUnit = KeepAutomation.Barcode.BarcodeUnit.Pixel;
barcode.Orientation = KeepAutomation.Barcode.Orientation.Degree90;
barcode.DPI = 72;
barcode.ImageFormat = ImageFormat.Png;
barcode.generateBarcodeToImageFile("C://barcode-code39ex-csharp.png");