有時(shí)候我們需要在HTML頁(yè)面上顯示條碼。今天給大家分享在Barcode Professional中,如何將在HTML上顯示條碼。
【Barcode Professional for ASP.NET下載】
步驟:
VB
Imports Neodynamic.WebControls.BarcodeProfessional
C#
using Neodynamic.WebControls.BarcodeProfessional;
VB
Dim bcp As New BarcodeProfessionalbcp.Code = Request.QueryString("code")bcp.Symbology = Symbology.Code128Dim barcodeImage As Byte() = bcp.GetBarcodeImage(System.Drawing.Imaging.ImageFormat.Gif)If (barcodeImage Is Nothing) ThenResponse.End()ElseResponse.Clear()Response.ContentType = "image/gif"Response.BinaryWrite(barcodeImage)Response.End()End If
C#
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>
聯(lián)系客服