You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And for your printer, (in theory) is possible to print utf8 characters.
I can't test in mine, but you can test on tm-m30ii, if it is possible, send us feedback about test. see you.
importcom.github.anastaciocintra.escpos.EscPos;
importcom.github.anastaciocintra.output.PrinterOutputStream;
importjavax.print.PrintService;
importjava.io.IOException;
publicclassFs {
publicvoidsendData(EscPosescpos) throwsIOException {
setUtf8((escpos));
escpos.writeLF("文档");
escpos.writeLF("文档");
escpos.writeLF("文档");
escpos.writeLF("文档");
escpos.writeLF("文档");
escpos.writeLF("文档");
escpos.writeLF("文档");
escpos.writeLF("文档");
escpos.writeLF("文档");
escpos.writeLF("文档");
escpos.feed(5).cut(EscPos.CutMode.FULL);
escpos.close();
}
privatevoidsetUtf8(EscPosescpos) throwsIOException{
finalintm = 2;
////FS ( C pL pH fn mescpos.write(28) //FS
.write('(') // (
.write('C') // C
.write(2) // pl
.write(0) // ph
.write(48) // fn
.write(m); // mescpos.setCharsetName("UTF8");
}
publicstaticvoidmain(String[] args) throwsIOException {
if(args.length!=1){
System.out.println("Usage: java -jar escpos-simple.jar (\"printer name\")");
System.out.println("Printer list to use:");
String[] printServicesNames = PrinterOutputStream.getListPrintServicesNames();
for(StringprintServiceName: printServicesNames){
System.out.println(printServiceName);
}
System.exit(0);
}
//this call is slow, try to use it only once and reuse the PrintService variable.PrintServiceprintService = PrinterOutputStream.getPrintServiceByName(args[0]);
PrinterOutputStreamprinterOutputStream = newPrinterOutputStream(printService);
EscPosescpos = newEscPos(printerOutputStream);
Fsobj = newFs();
obj.sendData(escpos);
}
}
Desktop (Info):
OS: Windows 10
Lib Version 4.1.0
Java Version 1.8.0_181
Pinter: EPSON TM-m30II
code:
escpos.setCharsetName("GB2312");
escpos.writeLF("文档");
it's not working, i try all the encoding with simplified chinese already.
https://docs.oracle.com/javase/8/docs/technotes/guides/intl/encoding.doc.html
Thank you.
Regards.
The text was updated successfully, but these errors were encountered: