Skip to content

Printing of Bar code and Raw Data

Bhaskaran Srinivasan

Asked Jan 4, 2017, 7:34 PM EST2 answers
Share
LinkedInX
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 

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Suthish Nair
    +1
    Lots of Free Barcode API for .Net available, just do google..
    +1
  • +1

    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:

    Java
    //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);
    You can then return the resulting image as part of your response page (receipt) and invoke printing of the page using JavaScript. There's a free evaluation edition on www.leadtools.com with free technical support.
    +1