Getting Started in ASP.NET (non-visual class)
Free Trial Web API version Licensing Request A Quote
HAVE QUESTIONS OR NEED HELP?SUBMIT THE SUPPORT REQUEST FORM or write email toSUPPORT@BYTESCOUT.COM
The following example demonstrates how to generate barcode image using non-visual Barcode class in ASP.NET
using System; using System.Data; using System.Drawing.Imaging; 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; using Bytescout.BarCode; public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { // Create new barcode Barcode barcode = new Barcode(); // Set symbology barcode.Symbology = SymbologyType.Code39; // Set value barcode.Value = "Sample"; // Clear http output Response.Clear(); // Set the content type to PNG Response.ContentType = "image/png"; // Add content type header Response.AddHeader("Content-Type", "image/png"); // Set the content disposition Response.AddHeader("Content-Disposition", "inline;filename=result.png"); // Save image to output stream barcode.SaveImage(Response.OutputStream, ImageFormat.Png); // End response Response.End(); } }