barnhill / barcodelib

C# Barcode Image Generation Library
Apache License 2.0
736 stars 239 forks source link

How to display Barcode below the image? #115

Closed SreeKrishnatsr closed 3 years ago

SreeKrishnatsr commented 3 years ago

I would like to display barcode bottom of the image, So when user unable to scan they can read the value

binki commented 3 years ago

Hi @SreeKrishnatsr

The text inside the barcode image is called a “label”. You can enable the label by setting the IncludeLabel property to true. For example, if you have code like this:

var b = new BarcodeLib.Barcode();
using (var img = b.Encode(BarcodeLib.TYPE.UPCA, "038000356216", Color.Black, Color.White, 290, 120)) {
}

you can alter that to the following to show the label:

var b = new BarcodeLib.Barcode {
    IncludeLabel = true,
};
using (var img = b.Encode(BarcodeLib.TYPE.UPCA, "038000356216", Color.Black, Color.White, 290, 120)) {
}