-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
receive events about printer status #19
Comments
@NqCompiler hi! Sure. Please take a look at startMonitorPrinter. I suppose it returns all data you’ve mentioned. moreover after every print - promise with corresponding data will be returned as well. Here the code snippet how to use it ( from example folder) React.useEffect(() => {
EscPosPrinter.addPrinterStatusListener((status) => {
console.log('current printer status:', status);
});
}, []);
…..
Button
title="Start monitor printer status"
disabled={!printer}
color={!printer ? 'gray' : 'blue'}
onPress={async () => {
if (printer) {
if (!init) {
await EscPosPrinter.init({
target: printer.target,
seriesName: getPrinterSeriesByName(printer.name),
});
setInit(true);
}
const status = await EscPosPrinter.startMonitorPrinter();
console.log('Printer status:', status);
}
}}
/>
``` |
I had so many tabs open and was looking at the examples from your fork from react-native-thermal-receipt-printer and somehow ended up creating the issue at the right place. Thanks for the fast response and help :) |
@tr3v3r @NqCompiler when device is connected using instantiate method, printing is working fine but this startsMonitorPrinter() is showing EscPosPrinter.addPrinterStatusListener((status) => {
console.log(status.connection, status.online, status.paper); // will be executed every 5 sec
}); What is the issue? |
Hey,
Is it possible to get printer status from connected devices?
For example if paper is empty or the connection is lost
Keep up the great work!
The text was updated successfully, but these errors were encountered: