Spire.Barcode 4.9.2现已发布。该版本支持设置条码顶部文本的排列方式,同时也支持在条形码底部添加自定义文本。除此之外,一些在扫描条形码和QR码时出现的问题也得以成功解决。详情请查阅以下内容。
新功能:
- 支持设置条码顶部文本的排列方式。
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);
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);
问题修复:
- 修复了扫描条形码得到的数据不正确的问题。
- 修复了扫描条形码失败的问题。
- 修复了扫描条形码程序抛“NullPointerException”的问题。
- 修复了添加自定义文本不生效的问题。
- 修复了扫描含特殊字符的QR码,得到的数据错误的问题。
获取Spire.Barcode 4.9.2请点击: