star-thermal-printer
v1.0.4
Published
Fork of Klemenn1337/node-thermal-printer with more features for Star thermal printers.
Downloads
17
Maintainers
Readme
Star Thermal Printer
Fork of Klemenn1337/node-thermal-printer with more features for Star thermal printers. For added features see Added Features Section
Installation
npm install star-thermal-printer
Linux specific
Linux requires build-essentials
sudo apt-get install build-essential
Browser specifics
When using inside a browser, the network interface will not work as browsers do not allow opening TCP sockets.
You still need to instruct the compiler to ignore node dependencies. For webpack, it can be done like this:
new webpack.IgnorePlugin({
resourceRegExp: /^fs$|^net$/,
}),
Features
Refer to Original Readme
Added Features
Set text size for star printers
printer.setTextSize(5,5); // Set text height (0-5) and width (0-5)
Read errors from printer
import { Errors } from "star-thermal-printer"
printer.execute({waitForResponse: true})
.then((data) => {
let errorReadFromPrinter = printer.parseStatusRT(data);
console.log(errorReadFromPrinter); // Error.PAPER_END, Error.PAPER_NEAR_END, Error.NONE
})
.catch((error) => {
console.log('Printing error: ' + error)
});