提问人:Akhilesh Dhiman 提问时间:11/8/2023 更新时间:11/8/2023 访问量:36
如何在 java 中使用 google zxing 库生成条形码?
How to generate bar code using google zxing library in java?
问:
我想生成文本大小为 16 个字符的条形码。现在我正在使用 google zxing 库来生成条形码。
它正在生成字符大小为 16 的条形码,但不会在条形码下方打印输入的数据。
String text = "SKCN_031123_0003";
MultiFormatWriter writer = new MultiFormatWriter();
int width = 100;
int height = 100;
BitMatrix bitMatrix = writer.encode(text, BarcodeFormat.CODE_128, height, width);
MatrixToImageWriter.writeToStream(bitMatrix, "png", new FileOutputStream(new File("E:/Projects/visa-admin/userdocs/barcode.png")));
此代码生成如下条形码:
我试图找到解决方案,但它们都与 CODE_13 和 UPCAWriter() 有关。
我试图解决它这么久,但我找不到任何有用的东西。
另外,有没有其他方法可以生成超过 16 个字符的条形码。
提前致谢。
答: 暂无答案
上一个:控制PDA中的物理扫描按钮
评论