1

我能够创建 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();    

请提供您的建议

4

0 回答 0