[PAID] Thermal Printing extension (Bluetooth/Network)

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.

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.

Now the most important.

This 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 (A printer connected via Wi-Fi or LAN cable to your local network)

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

It only includes two Blocks.

1. SendData
image
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:
image
2. ErrorOcurred
image
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)

What’s included with the extension?

• ThermalPrinter aix
• SimpleSocket aix
• An aia for simple understanding of the extension

Demonstration Video:


Price

$7 USD / PayPal
Send me a PM if you are interested in buying the extension.

Thanks
To App Inventor for this amazing platform
To Shreyash for creating Rush

11 Likes

Good extension :slightly_smiling_face:.

1 Like

(added to FAQ)

como faço para adquirir a extensao

tenho interesse como faço para adquirir

see here

Taifun

Do this is capable of printing arabic?

Yes it is capable.

Just sent it could you please send the extension

Can you please send me the Extension?

Done :grin:. Thank your for your purchase. And sorry for the late response, I'm kinda busy on weekends.

1 Like

No worries

Thank you for the extension.

I am excited to use it.

Hello sir,
I want to buy this extension
[mod edit - personal information removed, please use the community private messaging service]

Does it support Russian Text. I mean if I type Russian Text for example 'Привет!' and print do I get result? Coud you please send apk. Thanks in advance!

This is a paid extension created by a third party developer.

Please discuss this with the developer. Perhaps send him a PM.

I would like to buy this extension, could you send me to pay you via Webmoney WMZ?

1 Like

Sorry for the late response. Unfortunately i only accept PayPal by now

donde la puedo adquirir, gracias.

1 Like

as always you find this information in the first post of an extension thread, in this case it has been said

Send me a PM if you are interested in buying the extension.

Taifun

please i need to buy de extension.

1 Like