如何设置蓝牙打印的字体大小?

5
I am writing an application which print ticket receipts.
I have some how written the code to print the receipt but the printer either      

打印出来的字体大小要么非常大,要么非常小(无法阅读)。 有人可以提供设置格式的代码吗?

     try {
            //////////this code runs in thread
                    OutputStream os = mBluetoothSocket
                            .getOutputStream();
                    String BILL = "";
                    BILL = BILL
                            + "     *********      ";
                    BILL = BILL+"\n***Invoice No*** \n" +
                            "Muslim Movers\n"
                            +Todays_date+"\n";

                    BILL = BILL + "\n\n";
                    BILL = BILL + "Tickets:" + "      " + String.valueOf(tickets_wanted)+"\n";
                    BILL = BILL + "Price:        "+String.valueOf(Total_Tickets)+"\n"+
                            Selectedroute+"\n";
                    BILL = BILL
                            + "     *********     \n";
                    ////textsize and allignment
                    byte[] format = { 27, 33, 0 };
                    byte[] arrayOfByte1 = { 27, 3, 0 };
                    format[2] = ((byte)(0x10 | arrayOfByte1[2]));
                    format[2] = ((byte) (0x8 | arrayOfByte1[2]));
} catch (Exception e) {
                    Log.e("Main", "Exe ", e);
}
t.start();

发布你的代码以了解你所做的。 - Akshay Shah
1个回答

5
在编写文档之前,请先更改打印机配置:
  byte[] cc = new byte[]{0x1B,0x21,0x00};  // 0- normal size text
  byte[] bb = new byte[]{0x1B,0x21,0x08};  // 1- only bold text
  byte[] bb2 = new byte[]{0x1B,0x21,0x20}; // 2- bold with medium text
  byte[] bb3 = new byte[]{0x1B,0x21,0x10}; // 3- bold with large text

  outputStream.write(cc);
  outputStream.write("Your String");

2
如果我想要大号但不加粗怎么办? - zihadrizkyef
如果将其居中对齐并使用中等文本,是否可能? - Leon Zaii
我们只有这些有限的选项吗?如果我想让文本变大一点怎么办? - Usman Rana
以下链接包含了所有改变字体属性的命令。 https://escpos.readthedocs.io/en/latest/font_cmds.html - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接