-
Notifications
You must be signed in to change notification settings - Fork 73
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
WIP: update printing architecture #139
Conversation
* Added New Method 'clearCommandBuffer' To forcefully clear buffer
Still working on implementing this to local project. Looks like it works well for now. Will keep you updated when I'm done with the refactor that is needed. |
Thanks. If any question appears don't hesitate to reach me. BTW. @Waleed065 have already tested a lot of scenarios with single and multiple printing - so far so good. |
Have integrated this version in our PROD app and all use cases work for us. Use cases tested
|
@tr3v3r Would like to clarify something. Is the intended use that I connect to all discovered printers in the beginning and stay connected, or connect to each printer to print and then disconnect each time? |
@tolypash Both scenarios are valid. you can connect and disconnect - it's cheap action. Or if you need to do copies you can repeat commands after connection: async function print() { // your print receipt commands
await printer.addText('Hello world!);
await printer.addFeedLine();
await printer.addCut();
await printer.sendData();
} await printer.connect(); // connect
await print()
awaith printer.clearCommandBuffer();
await print() // copy 1
awaith printer.clearCommandBuffer();
await printer.disconnect(); // disconnect after all copies are printed I hope this makes sense/ |
Yes of course, thank you. It's just that we have many devices connecting to many printers. I will implement it by connecting and disconnecting then. Thank you! |
Correct. The previous implementation did the connection and disconnection under the hood by the lib, but it also added constraints because of that. So in this implementation, you can control yourself when connect and disconnect |
@Waleed065 I've released beta.2 with some small breaking changes and refactoring. Could you please try it out when you have time? |
Sure, I'll test it and let you know |
@tr3v3r There are few issues with this update ( beta.2 ). Specifically releated to imports |
I see. Can I ask you why you need this enums, can't you use PrinterConstants instead? Or it's for error handling? |
Yes I need them for error handling. Some PrinterConstants errorCodes have same error code that is why. But these should be available to import anyway |
Is there a need to bundle the queue into this library? We have our own queue around print jobs and |
Just released beta.5.
Details: https://github.com/tr3v3r/react-native-esc-pos-printer/releases/tag/v4.0.0-beta.5 |
This version Works Great, lets release it as a stable version. Great work @tr3v3r |
…o disconnect in case connection has lost
Hello everyone. I finally started to work on documentation. And added docs on Printer class constructor and connect method. In general, what is needed:Take any undocumented method and cover it. As a reference connect docs can be used. Rules:Each method must be documented by using original docs for Android and iOS |
I noticed that when using an older USB printer (TM-T88IV) the print times out, while it prints normally on my newer USB printer TM-T88V. Even printing “Hello World” takes around 5 seconds on the older model. Has anyone experienced that? |
Please create separate issues for that case, probably you'll get an answer from contributors. Also, what I can suggest is that you can try to test printing using Epson official applications. If there is still an issue with a specific model - that means it's not lib issues thanks. |
Hi, |
Hello, @softwaredev927 Yes, you can. |
Thank you. for your help. BUNDLE ./index.js
error: Error: Unable to resolve module ./constants from D:\ReactNative\olouris\node_modules\react-native-esc-pos-printer\src\index.tsx:
None of these files exist:
* node_modules\react-native-esc-pos-printer\src\constants(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
* node_modules\react-native-esc-pos-printer\src\constants\index(.native|.android.js|.native.js|.js|.android.json|.native.json|.json|.android.ts|.native.ts|.ts|.android.tsx|.native.tsx|.tsx)
> 1 | export * from './discovery';
2 | export * from './printer';
3 | How can solve it? |
I am happy to announce that version 4.0.0 has finally been released! |
How to test:
General instructions are here.
To install npm package:
npm i [email protected]
or
yarn add [email protected]
Summary (To be updated)
Reworked the way of printing. Fixes almost all known issues.
init
andinstantiate
methods and introduce a new class PrinterExample:
Detailed example.
Changelog
In progress...
Migration guide
In progress...
To do