Spire.Barcode 4.9.2

Spire.Barcode 4.9.2 supports setting the alignment of the barcode top text

We're pleased to announce the release of Spire.Barcode 4.9.2. This version supports setting the alignment of the barcode top text, and it also supports adding custom text at the bottom of the barcode. Besides, some issues that occurred when scanning the barcode and QR code are successfully fixed. More details are listed below.

Here is a list of changes made in this release

Category ID Description
New Feature SPIREBARCODE-126 Supports setting the alignment of the barcode top text.
int width = 399;
int height = 159;
BarcodeSettings bs = new BarcodeSettings();
bs.Type = BarCodeType.UPCA;
bs.Unit = GraphicsUnit.Pixel;
bs.WideNarrowRatio = 0.5f;            
bs.TextFont = new Font("Arial", 20, FontStyle.Regular);            
string data = "602318275035";
bs.Data2D = data;
bs.Data = data;
bs.ShowTextOnBottom = true;            
bs.TopText = data;
bs.ShowTopText = true;
bs.TextAlignment = StringAlignment.Center;
bs.TopTextAligment = StringAlignment.Center;
bs.TopTextFont = new Font("Arial", 20, FontStyle.Regular);            
bs.AutoResize = false;            
bs.X = 3.0f;            
bs.BarHeight = height * 0.6f;            
bs.ImageWidth = width;
bs.ImageHeight = height;            
BarCodeGenerator generator = new BarCodeGenerator(bs);
Image barImage = generator.GenerateImage();            
barImage.Save(outputFile_img, ImageFormat.Png);
New Feature SPIREBARCODE-155 Supports adding custom text at the bottom of the barcode.
BarcodeSettings barsetting = new BarcodeSettings();
barsetting.Type=BarCodeType.EAN13;
barsetting.BackColor = Color.WhiteSmoke;
String data = "6901234567892";
barsetting.Data=data;
barsetting.Data2D=data;barsetting.TopText="EAN13";
barsetting.TopTextFont=new Font("Arial", 20, FontStyle.Regular);
barsetting.TopTextColor=Color.Red;
barsetting.ShowTopText=true;
barsetting.ShowTextOnBottom=true;
barsetting.TopTextAligment=StringAlignment.Center;
barsetting.BottomText="EAN";
barsetting.BottomTextFont=new Font("fangsong", 25, FontStyle.Bold);
barsetting.BottomTextColor=Color.Black;
barsetting.ShowBottomText=true;
barsetting.BottomTextAligment=StringAlignment.Far;
BarCodeGenerator generator = new BarCodeGenerator(barsetting);
Image barcode = generator.GenerateImage(); 
barcode.Save(outputFile_img);
Bug SPIREBARCODE-85
SPIREBARCODE-113
SPIREBARCODE-156
Fixes the issue that the scan result was incorrect.
Bug SPIREBARCODE-101
SPIREBARCODE-106
SPIREBARCODE-157
Fixes the issue that scanning the barcode failed.
Bug SPIREBARCODE-146 Fixes the issue that the application threw "NullPointerException" when scanning barcode.
Bug SPIREBARCODE-154 Fixes the issue that adding custom text did not take effect.
Bug SPIREBARCODE-156 Fixes the issue that the scan result was incorrect when scanning QR code with special characters.
Click the link below to download Spire.Barcode 4.9.2:
More information of Spire.Barcode new release or hotfix: