我能够创建EAN8条形码,但我想设置barcode4j的护栏。我试过了以下
EAN8Bean bean = new EAN8Bean();
if(ta) {
bean.setMsgPosition(HumanReadablePlacement.HRP_TOP);
} else {
bean.setMsgPosition(HumanReadablePlacement.HRP_BOTTOM);
}
String fileName = "EAN8";
final int dpi = 160;
String barCodePath = "C:/temp/";
String codePath = barCodePath + fileName + ".JPG";
// Open output file
File outputFile = new File(codePath);
FileOutputStream out;
try {
out = new FileOutputStream(outputFile);
BitmapCanvasProvider canvas = new BitmapCanvasProvider(out, "image/jpeg", dpi,
BufferedImage.TYPE_BYTE_BINARY, false, 0);
// Generate the barcode
bean.generateBarcode(canvas, pin);
canvas.finish();
请提供您的建议