Barcode generation usingBarcode Rendering Framework in web application

允我心安 提交于 2019-12-07 16:24:57

问题


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?


回答1:


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();


来源:https://stackoverflow.com/questions/18399377/barcode-generation-usingbarcode-rendering-framework-in-web-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!