从Bluetooth Thermal POS打印机打印收据

时间:2019-04-04 11:29:26

标签: android printing bluetooth receipt

我需要打印一张收据,中间有一些大的文本,然后在左边有小文本。但是破损的管道异常即将到来。

    public static final byte[] INIT = {27, 64};
    public static final byte[] FEED_LINE = {10};

    public static final byte[] SELECT_FONT_A = {27, 33, 0};

    public static final byte[] FONT_B = {0x1B, 0x4D, 0x01};
    public static final byte[] ALLINEA_SX = {0x1B, 0x61, 0x00};
    public static final byte[] ALLINEA_CT = {0x1B, 0x61, 0x01};

    os.write(PrinterCommands.INIT);
    os.write(PrinterCommands.ALLINEA_CT); //text to center
    os.write(PrinterCommands.SELECT_FONT_A);
    os.write(PrinterCommands.FONT_3X);
    BILL = "XXX RESTAURANT" + "\n";
    os.write(BILL.getBytes());
    os.write("Hello stackoverflow!!\n".getBytes());
    os.write(PrinterCommands.FONT_1X);
    os.write(PrinterCommands.ALLINEA_SX); //text to left
    String BILL ="Order number: "+ orderId+"\n";
    BILL = BILL+"Order Time: "+order_time;
    BILL = "Delivery Time: "+order_delivery_time;
    os.write(BILL.getBytes());

0 个答案:

没有答案