簡體   English   中英

我不想在條形碼圖像中看到條形碼名稱

[英]I dont want to see the bar code name in my bar code image

我已經使用燒烤創建了條形碼圖像。 創建圖像時,我也可以看到在該圖像中創建條形碼的代碼。 我只想看條形碼。 在此處輸入圖片說明

    import java.io.File;
    import net.sourceforge.barbecue.BarcodeFactory;
    import net.sourceforge.barbecue.BarcodeImageHandler;

    /**
     *
     * @author malinda
     */
    public class NewClass {

    public static void main (String [] args) throws Exception {

    //Get 128B Barcode instance from the Factory
    net.sourceforge.barbecue.Barcode barcode = BarcodeFactory.createCode128B("be the coder");
    barcode.setBarHeight(20);
    barcode.setBarWidth(1);

    File imgFile = new File("testsize2.png");

    //Write the bar code to PNG file
    BarcodeImageHandler.savePNG(barcode, imgFile);
      }
    }

請注意,燒烤似乎已被廢棄,並且它對AWT之類的類有嚴格的依賴性,使其不適合Android開發。 但是,您應該可以使用drawingText屬性執行所需的操作:

指示條形碼數據是否應顯示為條形碼下方的字符串。

請注意,在繪制條形碼后更改此設置將使組件無效並可能強制刷新。

barcode.setDrawingText(false);

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM