[PAID] ESC/POS Thermal Printing extension (Bluetooth/Network)

READ FAQS BEFORE CONTINUING:

Summary

Q: What’s the purpose of this extension?
A: Create different ESC/POS commands that thermal printers can interpret as text, images, bar codes, qr codes. In order to print RECEIPTS

Q: How does this extension manage the connection to the printer?
A: My “Thermal printing extension” itself doesn’t manage any connection to the printer. You can use the in-built Bluetooth component for that (That method is used in the demo .apk and .aia i provide). But i also created another separate extension called Simple Socket that allows you to connect to the thermal printer via IP Address in a local network. That extension is included for free in your purchase.
Basically you could print via Bluetooth and Network.

Q: How do i know my printer would be compatible with this extension?
A: If your printer is for receipts and is ESC/POS compatible and has either LAN, WIFI or Bluetooth connection it will work. Just in case i included a demo apk.

Q: I purchased your extension i can print images but couldn’t print text
A: This can be a common issue depending on the language of your desire and your printer capabilities. The extension itself can manage different Foreign languages and was tested on: Arabic, Russian, Chinese, Japanese, Katakana, Kanji, and others. Some cheap printers can’t handle more than one alphabet. So i found a workaround and it is to create a Layout and put all the content of your desire in it. Convert that Layout using a third party extension into an Image and use my extension to print that image. I could provide you with an .aia file to demonstrate that solution. ONLY IF YOU ALREADY PURCHASED THE EXTENSION.

Q: I cant Print via Bluetooth due to permissions.
A: As i already stated this extension doesn’t manage bluetooth connections. That’s a job for the internal Bluetooth component. Make sure your app requests the BLUETOOTH_CONNECT and BLUETOOH_SCAN permissions and you allow them.

EXTENSION DESCRIPTION

This extension allows you to print text, images, bar and qr codes, etc in a Thermal Printer.

Explanation of blocks

Text

image
This block returns a command for printing a text

Parameters

charset – a string for the character encoding for example “UTF-8”
text – a string which value will be the printed text
changeFont – a Boolean value (true or false) for changing the printer font
size – a number (0-3) to define the text size
bold – a Boolean value (true or false) to define bold font
underline – a Boolean value (true or false). If true is used, a line under the text will be printed
feedline – a Boolean value (true or false) if a true value is used, the printer will feed a line after the text is printed. This will be for most cases. Use false only if you are going to use the Tab Function.

Align

image
Returns the command for setting the alignment of the printer.

Parameters:

alignment – expects a number to set the alignment
0 for Left , 1 for Center, 2 for Right

Or you can just simply use these blocks:
image

TextOptions

image
This block will set extra options to text.

Parameters

invert – a Boolean value. True, will print the text in a black background so the text can be white. False is normal
rotate – a Boolean value. True will rotate the text 90 degrees. False is normal
upsideDown – a Boolean value. True will set the text Upside Down. False is normal

SetCodePage

image

This block returns the command for setting the code page for your printer.

Parameters:

codePage – excepts a number for the Code Page to be set depending on your printer:

You can know this number in your printer manual, or printing the test page. See this example from my printer:

CutPaper

image

This block returns the command to cut the printer’s paper

Parameters:

fullCut – a Boolean value. If true the printer will fully cut the paper, if false it will be only a partial cut.

Note: Not every printer has this function.

Image

image

This block will return the command for printing an image.

Parameters.

image – a string including the path of the image to be printed. The image can be from assets, storage and from an URL.

If the image is from assets you should only use the filename. Example: myimage.jpg

If it is from the storage you should use file:////storage/emulated/0/..../myimage.jpg

And if it is from URL you should only use that. (Note: the images won’t be cached so you should better take the image from local storage, otherwise the image will be downloaded each time and then printed).

width – a number for setting the width of the image, some printers have a maximum value so if it this value is exceeded the printer may not print the image but a lot of characters. So please test this number first after using it your final app. Note: 150-200 may work in most printers

dithering – a Boolean value to define if the image will be printed using dithering or not.

CashDrawer

image

This block will return the command for opening the cash drawer connected to your printer via a RJ connector. (Note: I have not tested this command because I don’t have a Cash Drawer)

Parameters:

pulse – a number for sending the pulse to the cash drawer

0 will send a pulse to pin 2
1 will send a pulse to pin 5

QR Code

image

This block will return the command for printing a QR Code.

Parameters:

text – a String to indicate the text that will be printed as a QR.

correction – a number (0-3) to indicate the correction level for the QR.

size – a number (1-16) to manipulate the size of the QR Code.

BarCode

image

This block will return the command for printing a BarCode

Parameters:

text – a string which value is the text to be converted as barcode.
System – a number for setting the barcode system. (you can check your printer’s manual to see the supported systems)

0: UPC-A
1: UPC-E
2: EAN12
3: EAN8
4: CODE39
5: ITF
6: CODABAR

visibleText – a Boolean value. If true the text will be printer above the barcode. If false the text won’t be printed, only the barcode
height – a number (1-255)
width – a number (2-6)

Pdf417

image
This block will return the command to print a Pdf417 barcode

Parameters
text - a string containing the text to be converted and printed as a PDF417 barcode.

SetTabPositions

image

This block will set the positions when a tabulation is made

Parameters:

A List with the positions of the tabs. Example

image

Tab

image
This block will return the command for doing a tabulation for the defined positions. You will normally use this after printing a Text with the feedLine parameter set to False.

Feed

image
This block will return the command to feed the printer’s paper.

Parameters
lines – a number of the amount of lines to be feed.

NEW BLOCKS

Simple Text

image
A block to simply convert a text String using UTF-8 encoding and feeding a line. (to save some blocks from the other text block)
Parameters:
text - a string containing the text to be printed.

TextWithEncoding

image
Another alternative to print text

Kanji Commands

image
Some printers need a flag to know when it needs to be printed with Kanji characters or not.

Alternative commands

I also included new alternative blocks to print QR, Image and cut paper as the commands needed may vary from different printers.

Printing via network (Ethernet cable or Wifi)

The main extension only creates the commands for printing but it doesn’t make any connection to the printer. So, how do you communicate with it?

Well for bluetooth printing you can just simply use the Bluetooth Client component. Like this example:

And for Network printing I created another extension, Called SimpleSocket, specifically for this purpose.

It only includes two Blocks.

1. SendData

Creates the connection to the printer via its IP Address.
Parameters:
ipAddress - a string containing the ip address of your printer
connectionPort - a number for setting the port for the connection if needed (otherwise 9100 should work)
secret - a string containing the password for the connection if needed (otherwise any random string should work)
timeOut - a number to define the timeout for the connection (in ms).
list - the list with the commands for printing using the Thermal Printing extension.
Example:

2. ErrorOcurred

An event raised when an error is found. It will return the error message as an String.

NOTE: This extension was tested on the following printers:
• Epson TM-m10 (Bluetooth)
• LOSRECAL Mini Bluetooth Printer
• 3nstar RPT0010 (Bluetooth)
• 3nstar RPT006B (connected to the network via LAN cable and via Wifi)
• Sunmi D2 Mini (Bluetooth)

What’s included with the extension?

• ThermalPrinter .aix
• SimpleSocket .aix
• An .aia for simple understanding of the extension
• A Receipt Maker .aia

Extension simple example video

Receipt Maker Video

Demo Apk

Please test this apk to make sure your printer works with this extension before purchasing.
ThermalPrinting_Demo.apk (3.7 MB)

This demo was made with App Inventor, when you do your testing make sure you grant the requeried bluetooth permissions. If it stills shows permission denied after granting them, close the app and reopen it.

Purchase

New price:
$10 USD
Purchase link: https://payhip.com/b/HxfVj

You could pay now via PayPal or Credit/Debit Card and download the extension and aia right before paying.

25 Likes

Nice work now new print by Bluetooth is possible :grin::grin:

3 Likes

Wow Amazing :star_struck:
And usefull extension

4 Likes

Nice extension

Good Job
:star_struck:

3 Likes

Yeah, and to network printers also

2 Likes

Thank you both :grin:

2 Likes

Hi, do you know if it works with a QL-820NWB printer?
And, is the extension available for the MIT inventor?
Thank you

1 Like

I sent you a PM

1 Like

Hm… I have not received anything… Can you find me on Chord?

1 Like

Sorry, check now please

1 Like

Price downgraded :slightly_smiling_face:

1 Like

i need this extension can pm me

2 Likes

Done, check your messages

1 Like

i need this extension can pm me

3 Likes

i need this extension can pm me.

3 Likes

i need this extension can pm me.

2 Likes

ThermalPrinter aix, how I buy it.

1 Like

I sent you a PM

1 Like

I’m interested in this extension.
My name is André Luiz
My thermal printer is Bluetooth model POS 9210L

2 Likes

I want to buy a bluetooth print extension

2 Likes