Node.js thermal printer library for Raspberry Pi
git clone https://github.com/stuffshit/thermal.git
After cloning you should install the dependencies via npm
cd thermal
npm install
var Termal = require('thermal');
var printer = new Termal('/dev/ttyAMA0', {
baudrate: 19200
});
printer.on("ready",function(){
printer.print("Hello World").feed(1)
});
Printing inputed text
Feeds by the specified number of lines
Turn white/black reverse printing mode on
Turn white/black reverse printing mode off
Select align mode: L - left, C - center, R - right
Set bold font
Cancel bold font
Set underline mode: 0 - no underline, 1 - normal underline, 2 - thick underline
Cancel underline mode
Set font size: L - Large: double width and height, M - Medium: double height, S - Small: standard width and height
Set line spacing: integer value in range (24,255)
Set font double height mode
Cancel font double height mode
Set font double width mode
Cancel font double width mode
Set character updown mode
Cancel character updown mode
Take the printer online
Take the printer offline
Print barcode with selected text and type. Availiable types:
UPC_A - digits only. length: 11-12
UPC_E - digits only. length: 11-12
EAN13 - digits only. length: 12-13
EAN8 - digits only. length: 7-8
CODE39 - [0-9 A-Z $ % + - . /]. length: 1-12
I25 - digits only. length: 1-25
CODEBAR - [0-9 A-D $]. length: 1-15
CODE93 - all ascii table (0-127). length: 1-19
CODE128 - all ascii table (0-127). length: 2-18
CODE11 - digits and dash (-). length: 21
MSI - digits only. length: 16
Set “max heating dots”,”heating time”, “heating interval”
n1 = 0-255 Max printing dots,Unit(8dots),Default:7(64 dots)
n2 = 3-255 Heating time,Unit(10us),Default:80(800us)
n3 = 0-255 Heating interval,Unit(10us),Default:2(20us)
The more max heting dots, the more peak current will cost whenprinting, the faster printing speed. The max heating dots is 8*(n1+1)
The more heating time, the more density , but the slower printing speed. If heating time is too short, blank page may occur.
The more heating interval, the more clear, but the slower printingspeed.
Select character code table
n: 0-47
0 - CP437 [USA, european standard]
1 - KataKana [Katakana]
2 - CP850 [Multi-lang]
3 - CP860 [Portuguese]
4 - CP863 [Canada - french]
5 - CP865 [Nordic]
6 - WCP1251 [Cyrillic]
7 - CP866 Slavic 2
8 - МИК [Slavic / Bolgarian]
9 - CP755 [Eastern Europe, Latvia 2]
10 - [Iran, Persian]
11 - reserved
12 - reserved
13 - reserved
14 - reserved
15 - CP862 [Hebrew]
16 - WCP1252 [Latin 1]
17 - WCP1253 [Greeсу]
18 - CP852 [Latin 2]
19 - CP858 [1 + european languages, latin symbols]
20 - Иран Ⅱ [Persian]
21 - Latvia
22 - CP864 [Arabic]
23 - ISO-8859- 1 [Western Europe]
24 - CP737 [Greece]
25 - WCP1257 [Baltic]
26 - Thai
27 - CP720 [Arabic]
28 - CP855
29 - CP857 [Turkish]
30 - WCP1250 [Central Europe]
31 - CP775
32 - WCP1254 [Turkish]
33 - WCP1255 [Arabic]
34 - WCP1256 [Arabic]
35 - WCP1258 [Vietnamese]
36 - ISO-8859- 2 [Latin 2]
37 - ISO-8859- 3 [Latin 3]
38 - ISO-8859- 4 [Baltic]
39 - ISO-8859- 5 [Cyrillic]
40 - ISO-8859- 6 [Arabic]
41 - ISO-8859- 7 [Greece]
42 - ISO-8859- 8 [Arabic]
43 - ISO-8859- 9 [Turkish]
44 - ISO-8859- 15 [Latin 9]
45 - [Thai 2]
46 - CP856
47 - CP874
Prints all buffered data to the print region collectively, then recovers to the standard mode.
-All buffer data is deleted after printing.
-The print area set by ESC W (Set print region in page mode) is reset to the default setting. ï No paper cut is executed.
-Sets the print position to the beginning of the next line after execution.
-This command is enabled only in page mode.