Checks current bluetooth active status. Return values:
Retrieves the list of paired BT devices and populates the Select Printer dropdown box.
Send ESC @ (hex 1B40) to initialize the bluetooth printer. This command has the same effect as restarting the printer, so your encoding set with setEncoding will be cleared as well.
Send LF command (hex A0) to insert a line feed and advance the paper in the printer.
Prints a sample of different font types: underline 1-dot, underline 2-dot, bold, font type A, font type B.
Prints a sample of different font sizes: 00 normal, 01 reduced, 10 double-height, 20 double-width, 30 double width and height.
Sends a 1B420109 or 1B420309 POS command to beep the printer’s buzzer 1 or 3 times respectively. These codes do not match the EPSON buzzer codes, but they worked on the generic printer I’ve tested. This method is useful to beep the device after the printing process is complete.
Sets the encoding method used by the printer plugin, applied with mmOutputStream.write(msg.getBytes(encoding)); whenever a string is sent to the printer.
Sends POS command 1D4201 to enable inverted mode text and 1D4200 to disable it.
Sends an arbitrary ESC/POS command to the bluetooth printer. Refer to your particular printer model for supported commands, most printers should support the official EPSON commands by default.
Remember to send decimal values in hexadecimal, for example, to set the Denmark II character set (10) send it as 0A. The full POS command to set this charset would be 1B520A. You may also send a test print command to check the printer’s supported characters.
Tests the printBase64 method to print the provided base-64 encoded image. There is another method to print images by path, but it’s not implemented in this demo app to avoid dealing with the endless caveats of file system plugin.
Prints a Quick Response code with these options: model, size, error correction level. With my generic printer, all models show the same QR code, but size and alignment can be properly set.
BTPrinter plugin QR code sample
Prints a barcode with these options: system (format), characters position, font, height. With my cheap portable bluetooth printer, all fonts are the same, and only 2 height settings are applicable. Formats supported:
BTPrinter plugin barcode sample
Greek language test, works as follows:
This function is quite tricky, and it failed to print properly in my generic printer, even after setting the encoding correctly. However, the printer’s demo ticket does not show non-latin-1 characters properly either, my guess is that the printer has left out these languages to save a few KB of memory (or neither me nor the manufacturer knows the table numbers for other languages). This should work just fine with decent printers, or those aimed for specific non-western-european markets.
Greek language test with printer plugin using generic cheap printer for latin american market
Please send your comments and feedback in this page regarding printing in other languages and charsets with your specific printer model.
Bluetooth thermal printer cordova btplugin sample ticket
The previous ticket shows the thermal printer’s output for different text formats and sizes, a base 64 encoded image sample, and a reversed color text sample.