Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all articles
Browse latest Browse all 7205

How to create and display a BarCode in a web application

$
0
0

This example illustrates how you can use our new Bar Code Library in ASP.NET to generate and display a barcode image on the webpage. The best approach implies creating a custom HTTP Handler that will generate and output an image. Here is a code of this handler:

[C#]
publicclassBarCodeHandler:IHttpHandler{publicvoidProcessRequest(HttpContextcontext){BarCodebarCode=newBarCode();barCode.Symbology=Symbology.QRCode;barCode.CodeText="123";context.Response.ContentType="image/png";barCode.Save(context.Response.OutputStream,ImageFormat.Png);context.Response.End();}publicboolIsReusable{get{returnfalse;}}}

The img tag in the main aspx page is defined as follows:

[ASPx]
<imgsrc="BarCodeHandler.ashx"alt="QRCode"width="200px"height="200px"/>

See Also:

HTTP-handler for image

Example Comments

Added By: ABRAMO ABRAMO at: 6/14/2013 5:12:48 AM    

I get Server Error in '/E4716' Application when I click "Run Online"

Added By: mariah sharp at: 7/31/2013 11:25:17 PM    

have a look at this <a href="http://www.keepautomation.com/products/net_barcode_winforms/">barcode generator for winforms application</a>

Added By: mariah sharp at: 8/8/2013 5:33:13 AM    

does this <a href="http://www.keepautomation.com/products/net_barcode_winforms/">barcode generator in .net winforms </a>have the quality above


Viewing all articles
Browse latest Browse all 7205

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>