2016-11-26 6 views
0
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(); 
+0

あなたは私が大きいが、大胆ではないしたい場合はどのような –

答えて

0

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"); 
+0

を行っているかを知るためにあなたのコードを投稿しますか? – zihadrizkyef

関連する問題