Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How print invoice receipt using bluetooth thermal printer

I have to print invoice receipt using thermal printer. I have used Zjiang Thermal printer to print receipt. They also provide there manual & demo project. In demo project they use a libray "btsdk.jar" to implement connection & print.

I have successfully establish connection between printer & android device. But there is no guideline for text alignment (center, left, right) & cell width, height.

I have try it. It only change text height by changing format2 variable.

How I print invoice by bluetooth printer.

please also explain this section-

 byte[] cmd = new byte[3];
 cmd[0] = 0x1b;
 cmd[1] = 0x21;
 cmd[2] |= 0x10;

cmd2 - used for change font height what is use of cmd[0] & cmd1

code to send Printing message to bluetooth Printer In Demo Project

 String msg = "";
 byte[] cmd = new byte[3];
 cmd[0] = 0x1b;
 cmd[1] = 0x21;
 cmd[2] |= 0x10;
 mService.write(cmd);           
 mService.sendMessage("Congratulations!\n", "GBK"); 
 cmd[2] &= 0xEF;
 mService.write(cmd);          
 msg = "  You have sucessfully created communications between your device and our bluetooth printer.\n\n"
      +"  the company is a high-tech enterprise which specializes" +
        " in R&D,manufacturing,marketing of thermal printers and barcode scanners.\n\n";
 mService.sendMessage(msg,"GBK");

Print Info-

       parameters:support to download the Logo trademark
       FontA:12*24 dots,1.5(W)*3.0(H) mm
       FontB:9*17 dots, 1.1(W)*2.1(H) mm
       Simplified/Traditional: 24*24 dots, 3.0(W)*3.0(H)
       Line spacing: 3.75mm (Default)
       Barcode Types:-
       1D Barcode- UPC-A/UPC-E, JAN13(EAN13), JAN8(EAN8), CODE39/ITF, CODABAR,CODE93
       2d Barcode- QR CODE

Invoice Receipt

enter image description here

like image 630
mukesh Avatar asked May 18 '15 05:05

mukesh


People also ask

Can a thermal label printer print receipts?

By changing from a label roll to a continuous paper roll, you can print receipts from your thermal printer. Thermal label printers have an added advantage for receipt printing because you have more size options.

How do I print using Bluetooth thermal printer?

In your mobile device, go to Settings > Bluetooth, and turn the 'Bluetooth' on. A Bluetooth device search will begin, and you will see your printer on the list. Push the 'Pair' button on your printer. On your mobile device, choose your printer's model from the list of 'Devices'.

How do I print from my phone with a thermal receipt?

Plug one end of the USB cable into the USB port of the printer, and the other end into the female USB connector of an OTG adapter or cable. Then, plug the micro-USB end of the OTG adapter or cable into the micro-USB port of your mobile device, and wait for the system to recognize the printer.


1 Answers

I have found the following image over the internet for Text Alignment. Hope it helps

enter image description here

like image 110
Murtaza Khursheed Hussain Avatar answered Oct 25 '22 01:10

Murtaza Khursheed Hussain