I want to introduce a new extension that simplifies the communication with Bluetooth thermal printers and makes possible to create pretty cool apps. The ESC/POS Simple Converter enables to print formatted text, images, bar codes and QR codes without needing to have knowledge in ESC/POS programming. For example, you can print images from the assets, the SD card or the web. Just provide the name or the URL of the image. You can also take a photo with your camera and directly send it to your printer. A dithering algorithm is applied to create the illusion of a grayscale instead of monochrome black.
How to use this extension? The extension provides blocks for basic ESC/POS commands which will help inventors with their apps. After you have enabled Bluetooth and paired the devices, you can set up a connection. To send your data to the printer, just combine one block from the extension with a SendBytes block from the Bluetooth component. The ESC/POS Simple Converter returns the byte sequence your ESC/POS printer expects.
At the moment I have implemented the following blocks. You can find some examples how to use them in the attachment. The blocks for printing images, text and QR codes can be utilized with various options but also with reasonable default values. Take into account that some manufacturers might use different commands. If you have a manual, we can find a solution.
- BlackWhiteReverseTextMode(boolean reverseMode)
- ConvertImage(String image)
- ConvertImageWithOptions(String image, int dotsPerLine, int threshold, boolean useDithering)
- ConvertText(String text)
- ConvertTextWithEncoding(String text, String encoding)
- ConvertToBarCode(String text, int system)
- ConvertToQRCode(String text)
- ConvertToQRCodeWithOptions(String text, String errorCorrection, int sizeFactor)
- CutPaper(boolean partialCut)
- FormatTextMode(boolean otherFont, boolean bold, boolean doubleHeight, boolean doubleWidth, boolean unterline)
- SelectCharacterCodePage(int Codepage)
After there had been several questions concerning bluetooth printers in this forum, I decided to develop this extension in order to simplify things for you.
You might want to establish your own web page for commercial activities. Your promotion text was removed.