dementeddevil / BarcodeRenderingFramework

A simple framework for rendering barcodes with SSRS integration
Apache License 2.0
63 stars 43 forks source link

Show Barcode number under the barcode image #4

Open empitekrishan opened 6 years ago

empitekrishan commented 6 years ago

my problem is after barcode was generated it didn't show barcode number under the barcode image. I need to add that barcode number under it.

i think this is a feature request

Here is my code:

[HttpPost]
public ActionResult Index(string barcode)
{   
    BarcodeSymbology symbology = BarcodeSymbology.Code39C;
    BarcodeDraw drawObject = BarcodeDrawFactory.GetSymbology(symbology);

    var metrics = drawObject.GetDefaultMetrics(60);
    metrics.Scale = 1;

    var barcodeImage = drawObject.Draw(barcode, metrics);

    using (MemoryStream ms = new MemoryStream())
    {
        barcodeImage.Save(ms, System.Drawing.Imaging.ImageFormat.Png);
        byte[] imageBytes = ms.ToArray();

        ViewBag.BarcodeImage = "data:image/png;base64," + Convert.ToBase64String(imageBytes);
    }
    return View();
}