[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.

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.

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

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)

What’s included with the extension?

• ThermalPrinter aix
• SimpleSocket aix
• An aia for simple understanding of the extension
• A more complex aia which is a Receipt Maker

Extension simple example video

Receipt Maker Video

Price

$7 USD / PayPal
Send me a PM if you are interested in buying the extension.
Please do not post contact information on the comments.

Thanks

To Kodular for this amazing platform
To Shreyash for creating Rush

13 Likes

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

1 Like

Wow Amazing :star_struck:
And usefull extension

1 Like

Nice extension

Good Job
:star_struck:

1 Like

Yeah, and to network printers also

1 Like

Thank you both :grin:

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

I sent you a PM

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

Sorry, check now please

Price downgraded :slightly_smiling_face:

i need this extension can pm me

1 Like

Done, check your messages

i need this extension can pm me

1 Like

i need this extension can pm me.

2 Likes

i need this extension can pm me.

1 Like

ThermalPrinter aix, how I buy it.

I sent you a PM

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