如何在barcode4j中设置防护栏

时间:2015-09-16 04:50:46

标签: java barcode4j

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

请提供您的建议

0 个答案:

没有答案