c# - How to download barcode labels in MVC4? -
i have bar codes stored in database , want allow user download label of bar code products. how can convert number e.g 5036040142375 image of barcode , user print out of labels.
i have used barcode generation library - http://www.barcodelib.com/
and following code generate barcode, posting barcode generation code again, because in code can see barcode generation process generating png image can save , use ever like, display or provide download users etc -
/// <summary> /// method used generate bar code item /// </summary> private static string generatebarcode(string path, string code) { barcodelib.barcode b = new barcodelib.barcode(code, barcodelib.type.code39); image img = b.encode(barcodelib.type.code39, code, 300, 50); string filename = guid.newguid().tostring() + code + ".png"; b.saveimage(httpcontext.current.server.mappath(path + "/" + filename), barcodelib.savetypes.png); return filename; }
Comments
Post a Comment