3

I am using Barcode Rendering Framework for generating a barcode. I have downloaded their dll's. I can see,how it can be done in windows application. I want to do the same i.e, generating the barcode and using it in web application. Following is the link for the question that can be used. Free Barcode API for .NET and following is the code :

Code39BarcodeDraw barcode39 = BarcodeDrawFactory.Code39WithoutChecksum;
System.Drawing.Image img = barcode39.Draw("Hello World", 40);
pictureBox1.Image = barcode39.Draw("Hello World", 40);

How can I use the same functionality in web application?

Akhil
  • 271
  • 1
  • 3
  • 11
Ankur
  • 1,023
  • 7
  • 27
  • 42

1 Answers1

4

You can use the same code in ASP.NET, but you need to output the image via HTTP.

Say you have an ASP.NET web page that contains the following:

<IMG SRC="BarCode.aspx?par1=HelloWorld40OrWhatever" />

Then your BarCode.aspx page must generate and output the image:

Code39BarcodeDraw barcode39 = BarcodeDrawFactory.Code39WithoutChecksum;
System.Drawing.Image img = barcode39.Draw("Hello World", 40);

Response.Clear();
Response.Type = "image/png";
img.Save(Response.OutputStream, Imaging.ImageFormat.Png);
Response.Flush();
Response.End();
Roy Dictus
  • 32,551
  • 8
  • 60
  • 76
  • you need to fetch the bar code string from query string from part1. I found missing in the code. – Sain Pradeep Aug 23 '13 at 09:42
  • @Roy Dictus : It worked. Now I want to print the barcode. Because I am making an inventory software. I need to take the print and stick it to the item. What I need to do to take its print.? – Ankur Aug 23 '13 at 09:44