Fork of Klemenn1337/node-thermal-printer with more features for Star thermal printers.
npm install star-thermal-printerFork of Klemenn1337/node-thermal-printer with more features for Star thermal printers.
For added features see Added Features Section
``bash`
npm install star-thermal-printer
Linux requires build-essentials
`bash`
sudo apt-get install build-essential
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:
`bash`
new webpack.IgnorePlugin({
resourceRegExp: /^fs$|^net$/,
}),
Refer to Original Readme
#### Set text size for star printers
`js`
printer.setTextSize(5,5); // Set text height (0-5) and width (0-5)
#### Read errors from printer
`js
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)
});
``