Plugin for thermal portable printer, In this moment I only tested in model:
- RPP200 48mm
- RPP300 72mm
I think the driver can work for ore models but I can't confirm.
Important at this moment only works for ANDROID
cordova plugin add https://github.com/CXRom/cordova-plugin-rpp.git
Rpp.Connect("00:0E:0E:0B:7B:93", // <-- MAC Address of the printer
function(print) {
//At this point we send the action but we need to wait until the connection
console.log(`connect ok ${JSON.stringify(print)}`);
},
function (err){
console.log(`connect err ${JSON.stringify(err)}`);
});
//Ask is device is connected
Rpp.IsConnected(function(conn) {
//Send to print
Rpp.Print({
marginTop: 10, //Margin before print
marginBottom: 10, //Margin after print
lineSpacing: 50, //Size of line
lines: [ //Lines to print
{ text: "Title", align: 1, bold: true, underline: true, size: 17 }, //long name properties
{ text: "Subtitle", a: 1, b: true, u: true, s: 17 }, //short name properties
{ text: "normal line" },
{ text: ":)", h: true }
]
}, function(res) {
console.log(`print ok ${JSON.stringify(res)}`);
}, function(err){
console.log(`print err ${JSON.stringify(err)}`);
});
}, function(err) {
});Initialize the connection with the printer. Its important that the printer has been paired before.
Ask is the printer is already connected, its important to confirm the connection before we try to print.
Force the close of connection.
Send lines to print in JSON
Rpp.Print({
marginTop: 10, //Margin before print
marginBottom: 10, //Margin after print
lineSpacing: 50, //Size of line
lines: [ //Lines to print, each item represent one line
{ text: "Title", align: 1, bold: true, underline: true, size: 17 }, //long name properties
{ text: "Subtitle", a: 1, b: true, u: true, s: 17 }, //short name properties
{ text: "normal line" },
{ text: ":)", h: true }
]
}, function(res) {
console.log(`print ok ${JSON.stringify(res)}`);
}, function(err){
console.log(`print err ${JSON.stringify(err)}`);
});Each line can be configured with this properties:
| short | long | type | description |
|---|---|---|---|
| a | align | int | 0=Left (default), 1=Center, 2=Right |
| b | bold | bool | false (default), true |
| u | underline | bool | false (default), true |
| u | highlight | bool | false (default), true |
| s | font size | int | 0-17 |
The same as print but after print close the connection.