Spire.Barcode for Java 3.9.3现已发布。该版本支持设置条码顶部文本的排列方式,同时也支持在条形码底部添加自定义文本。除此之外,一些在扫描条形码和QR码时出现的问题也得以成功解决。详情请查阅以下内容。
新功能:
- 支持设置条码顶部文本的排列方式。
int width = 399;
int height = 159;
BarcodeSettings bs = new BarcodeSettings();
bs.setType(BarCodeType.UPCA);
bs.setUnit(GraphicsUnit.Pixel);
bs.setWideNarrowRatio(0.5f);
bs.setTextFont(new Font("Arial", Font.PLAIN,20 ));
String data = "602318275035";
bs.setData(data);
bs.setData2D(data);
bs.setShowTextOnBottom(true);
bs.setTopText(data);
bs.setShowTopText(true);
bs.setTextAlignment(StringAlignment.Center);
bs.setTopTextAligment(StringAlignment.Center);
bs.setTopTextFont(new Font("Arial", Font.PLAIN, 20));
bs.setAutoResize(false);
bs.setX(3.0f);
bs.setBarHeight(height * 0.6f);
bs.setImageHeight(height);
bs.setImageWidth(width);
BarCodeGenerator barCodeGenerator = new BarCodeGenerator(bs);
BufferedImage bufferedImage = barCodeGenerator.generateImage();
ImageIO.write(bufferedImage, "png", new File("result.png"));
barsetting.setBottomText("EAN");
barsetting.setBottomTextFont(new Font("fangsong", Font.BOLD, 25));
barsetting.setBottomTextColor(Color.BLACK);
barsetting.setShowBottomText(true);
barsetting.setBottomTextAlignment(StringAlignment.Center);
问题修复:
- 修复了扫描条形码得到的数据不正确的问题。
- 修复了扫描条形码失败的问题。
- 修复了扫描条形码程序抛“NullPointerException”的问题。
- 修复了添加自定义文本不生效的问题。
- 修复了扫描含特殊字符的QR码,得到的数据错误的问题。
获取Spire.Barcode for Java 3.9.3请点击: