Hi i am developing a web based billing solution where in i need to print a bar code or receipt on a local printer. i am using ASP.NET and MVC5
Please suggest
Rgds
Bhaskaran
Know the answer? Post it. Somebody with the same question will find it here.
Suthish NairRank #92 · 22.8K pointsPosted Jan 4, 2017, 11:26 PM EST
Amin Dodin177 pointsPosted Jan 5, 2017, 2:25 PM EST
You can use a barcode library such as LEADTOOLS to write (draw) the barcodes on an image at the server side using .NET code. (Disclaimer: I’m an employee of this library's vendor).
The following code writes a barcode on an image and saves it into a MemoryStream:
//Create white image RasterImage bitmapImage = RasterImage.Create(400, 150, 24, 300, RasterColor.White); //Write the barcode on the image Leadtools.Barcode.BarcodeEngine engine = new BarcodeEngine(); BarcodeWriteOptions writeOptions = engine.Writer.GetDefaultOptions(BarcodeSymbology.Code3Of9); string sampleData = "123-45678"; //There are many supported types, not just Code 3 of 9 engine.Writer.WriteBarcode(bitmapImage, new BarcodeData(BarcodeSymbology.Code3Of9, sampleData), writeOptions); //Save the image to a stream RasterCodecs codecs = new RasterCodecs(); codecs.Save(bitmapImage, memoryStream, RasterImageFormat.Png, 24);