-
Notifications
You must be signed in to change notification settings - Fork 74
OutputStreams
Marco Antonio edited this page Dec 4, 2021
·
3 revisions
Escpos-coffee have some builtin OutputStreams to send data to the printer:
Problably it is the most common used outputstream on escpos-coffee, its because its simplicity of usage and it uses standard java resources. Supply outputStream to any installed printer.
Platform | Compatibility |
---|---|
Linux | yes |
Windows | yes |
Mac | yes |
Android | no |
String[] printServicesNames = PrinterOutputStream.getListPrintServicesNames();
for (String printServiceName : printServicesNames) {
System.out.println(printServiceName);
}
escpos = new EscPos(new PrinterOutputStream("your printer name obtained above"));
escpos.writeLF("Hello PrinterOutputStream");;
// do not forget to close...
escpos.close();
If you have one Ethernet printer, you can use TcpIpOutputStream
Platform | Compatibility |
---|---|
Linux | yes |
Windows | yes |
Mac | yes |
Android | yes |
TcpIpOutputStream outputStream = new TcpIpOutputStream(host,port)
EscPos escpos = new EscPos(outputStream);
escpos.writeLF("Hello TcpIpOutputStream");
escpos.close();
For now can be used, but are still considered beta version:
Offers usb OutputStream.
Platform | Compatibility |
---|---|
Linux | yes |
Windows | yes |
Mac | unknown |
Android | no |
Offers usb Serial port OutputStream.
Platform | Compatibility |
---|---|
Linux | yes |
Windows | yes |
Mac | unknown |
Android | no |