我正在开发android应用程序,需要在打印后发送ESC命令来切纸。
1) 请指导我如何从 android 发送 ESC 命令。
2) 以及打印后切纸用什么命令。
最佳答案
我想出的解决方案:
Socket sock;
PrintWriter oStream;
DataInputStream is;
sock = new Socket(ip, port);
is = new DataInputStream(sock.getInputStream());
oStream = new PrintWriter(sock.getOutputStream());
oStream.println(new char[]{0x1D, 0x56, 0x41, 0x10}); // 0x1D, 0x56, 0x41 is for paper cut and 0x10 is for line feed.
oStream.flush();
oStream.close();
sock.close();
关于java - 如何从 Android 应用程序发送 ESC 命令?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23589992/