anastaciocintra / escpos-coffee

Java library for ESC/POS printer
https://anastaciocintra.github.io/escpos-coffee
MIT License
282 stars 74 forks source link

Is there any documentation with printing by network? #60

Closed orzyyyy closed 3 years ago

orzyyyy commented 3 years ago

I just want to control the printer by network, is there any APIs I don't know, like PrintService printService = PrinterOutputStream.getNetWorkPrinter("192.168.x.x", 9100);? And I can't find one in escpos-coffee-samples, any advise?

Thanks.

anastaciocintra commented 3 years ago

Hi, @orzyyyy you can print on a tcp printer by using the class TcpIpOutputStream. It is not exactly a service like a printService. It is only a stream. take a look at https://github.com/anastaciocintra/escpos-coffee-samples/tree/master/usual/tcpip-stream.

for debug purpose, you can simulate a network printer: https://github.com/anastaciocintra/escpos-coffee-samples/tree/master/miscellaneous/server-print

more use of TcpIpOutputStream on https://github.com/anastaciocintra/escpos-coffee-samples/tree/master/miscellaneous/AndroidImage.

orzyyyy commented 3 years ago

Thanks a lot.