Neodynamic Barcode Professional 2.0 for ASP.NET (WebControl)
Microsoft .NET Framework (any version)
Microsoft Visual Studio .NET (any version)
In some cases you could need to show barcode images in simple HTML pages. Barcode Professional is .NET technology and it should be used in ASP.NET Web Applications.
To show barcode images in a HTML page using Barcode Professional we have to use both technologies HTML and ASP.NET.
In the following sample we're going to create a simple HTML page that shows a barcode image generated by Barcode Professional.
Steps to render barcode images in HTML pages
Imports Neodynamic.WebControls.BarcodeProfessional
using Neodynamic.WebControls.BarcodeProfessional;
Dim bcp As New BarcodeProfessional
bcp.Code = Request.QueryString("code")
bcp.Symbology = Symbology.Code128
Dim barcodeImage As Byte() = bcp.GetBarcodeImage(System.Drawing.Imaging.ImageFormat.Gif)
If (barcodeImage Is Nothing) Then
Response.End()
Else
Response.Clear()
Response.ContentType = "image/gif"
Response.BinaryWrite(barcodeImage)
Response.End()
End If
BarcodeProfessional bcp = new BarcodeProfessional();
bcp.Code = Request.QueryString["code"];
bcp.Symbology = Symbology.Code128;
byte[] barcodeImage = bcp.GetBarcodeImage(System.Drawing.Imaging.ImageFormat.Gif);
if(barcodeImage == null)
Response.End();
else
{
Response.Clear();
Response.ContentType = "image/gif";
Response.BinaryWrite(barcodeImage);
Response.End();
}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title>Barcode Professional in a HTML Page</title> <script type="text/javascript"> function ChangeBarcode(code) { var elem = document.getElementById("imgBarcode"); if(elem!=null) elem.src="BarcodeGen.aspx?code="+code; } </script> </head> <body> <P> <FONT face="Arial"><b>Barcode Professional in a HTML page</b></FONT> </P> <P> <IMG id="imgBarcode" alt="" src="BarcodeGen.aspx?code=12300445"> </P> <P> <FONT face="Arial" size="2">Enter a value to encode:</FONT><BR> <INPUT id="Text1" type="text" name="Text1"> <INPUT id="Button1" type="button" value="View Barcode" name="Button1" onclick="ChangeBarcode(Text1.value)"> </P> </body> </html>
That's it. Build the ASP.NET Web Application and open the BarcodeTest.htm page in your favorite browser. Enter some values to encode in the input box, click in the View Barcode button and see the barcode generated. Note that you can extend this sample including more parameters in the query string.
Sample Files Download
Here are a VB.NET and C# versions of this sample. Please, download the appropriate zip file. In it you'll find these files:
Download the source code here:
To reproduce this sample on your own machine, create a new ASP.NET Web Application, add a reference to Neodynamic Barcode Professional assembly and add the downloaded files.
We provide best-in-class customer service and support directly from members of our dev team! If we are available when you contact us, you will get a response in few minutes; otherwise the maximum turnaround is 24hs in most cases.