Skip to content
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

[QUESTION] Multiple printers #12

Closed
nguyen-vo opened this issue Jun 9, 2021 · 2 comments
Closed

[QUESTION] Multiple printers #12

nguyen-vo opened this issue Jun 9, 2021 · 2 comments

Comments

@nguyen-vo
Copy link

nguyen-vo commented Jun 9, 2021

Hi, does the package support multiple printers? I see in the document that we have to use the init function before we print. So if I have multiple printers is it safe to use that function multiple times? In my application, I have a list of printers with IP addresses and mac addresses. Every time we execute our print function, then it loops through the printer list, connects with a printer, and then prints.

@tr3v3r
Copy link
Owner

tr3v3r commented Jun 9, 2021

Hi!

Init function is just set the current printer to work with. So you can safely re-init printers and print in a sequence. The only thing you need to do is just wait until the current printer finishes its work and then run the next one

await EscPosPrinter.init({
  target: 'first printer target', 
})

await printing
  .initialize()
  .line('DUDE!')
  .send()
  
await EscPosPrinter.init({
  target: 'another printer target', 
})

The solution is not ideal but should work.

Hope it helps

@nguyen-vo
Copy link
Author

@tr3v3r Oh okay thank you :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants