This project has moved and is read-only. For the latest updates, please go here.

How To Append Text in Barcode Image

Topics: Code 128
Jan 16, 2015 at 10:08 AM
Edited Jan 16, 2015 at 10:13 AM
I have created barcode image in mvc
but i want to show code 128 with barcode image and barcodelabel

how to show barcode label ?

Please Help me

Aug 3, 2015 at 5:59 PM
Image sampleImage = barcode39.Draw("Sample", 40);

Creates a barcode image of a specific type.
Just wrap that barcode39.Draw in another function that takes in the "Sample" param and prints it underneath the original image.
Dec 1, 2015 at 11:08 PM
Thanks @NJG. Can you provide the sample code that shows how the sample param is printed underneath the original?
Dec 1, 2015 at 11:25 PM
This is what I did to get it to work. Please let me know if there is a different and/or better way. The code is in
      'initialize the bar code renderer object
       Dim barcode39 As Code39BarcodeDraw = BarcodeDrawFactory.Code39WithoutChecksum
        'get the original barcode as image using the zen barcode product
        Dim OriginalBarcodeImage As Image = barcode39.Draw("Sample", 40)
        'create a new image with extra height
        Dim ImagewithText As Image = New Bitmap(OriginalBarcodeImage.Width, OriginalBarcodeImage.Height + 50)
        'obtain the graphics object for the image
        Dim gr As Graphics = Graphics.FromImage(ImagewithText)
        gr.DrawImageUnscaled(OriginalBarcodeImage, 0, 0)
        'draw the additional text
        gr.DrawString("Sample", SystemFonts.DefaultFont, Brushes.Black, _
        New RectangleF(0, OriginalBarcodeImage.Height, OriginalBarcodeImage.Width, 50))
        'set the image with text on the picture box
        PictureBox1.Image = ImagewithText