下面列出了怎么用com.google.zxing.oned.UPCAWriter的API类实例代码及写法,或者点击链接到github查看源代码。
public static BufferedImage generateUPCABarcodeImage(String barcodeText) throws Exception {
UPCAWriter barcodeWriter = new UPCAWriter();
BitMatrix bitMatrix = barcodeWriter.encode(barcodeText, BarcodeFormat.UPC_A, 300, 150);
return MatrixToImageWriter.toBufferedImage(bitMatrix);
}