java epson指令集_小票打印机指令集封装(支持EPSON指令)

import java.io.IOException; import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.Socket; import java.net.UnknownHostException; public class TestMain { private static void print(String ip,String printContent) { Socket socket = null; try { socket = new Socket(); socket.connect(new InetSocketAddress(ip, 9100), 4000); System.out.println("CashierDesk=====小票机连接成功,IP:" + ip); OutputStream os = socket.getOutputStream(); // 切纸命令 String text = printContent + "\n\n\n\n\n\n"; byte[] CMD_INIT = { 27, 64 }; os.write(CMD_INIT); os.write(text.getBytes("GB2312")); final byte[] CMD_CUT = { 0x1D, 0x56, 0x01 }; os.write(CMD_CUT); System.out.println("CashierDesk=====小票机打印完成,IP:" + ip); } catch (UnknownHostException e) { System.out.println("CashierDesk=====小票机连接失败,IP:" + ip); e.printStackTrace(); } catch (IOException e) { System.out.println("CashierDesk=====小票机连接失败,IP:" + ip); e.printStackTrace(); } finally { if (socket != null) { try { socket.close(); } catch (IOException e) { e.printStackTrace(); } } } } public static void main(String[] args) { String ip = "192.168.80.209"; String printContent = "";                  printContent += "********************倍数放大********************\n"; printContent += "纵向放大两倍(汉字,英文,数字都支持)\n"; printContent += PrinterCmdUtils.longitudinalDouble(); printContent += "我是中文\nI'm english\n54123456\n"; printContent += PrinterCmdUtils.ZoomCancel(); printContent += "\n";printConten

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Introduction.........................................................................................................................1 About This Manual..................................................................................................................................2 Conventions Used in This Manual........................................................................................................2 Icons....................................................................................................................................................... 2 Command names and parameters.................................................................................................... 3 Information organization.................................................................................................................... 3 Nonrecommended and deleted commands.....................................................................................3 INT and MOD...................................................................................................................................... 4 Command Summary.......................................................................................................C-1 Command List by Function................................................................................................................C-2 Command List by ASCII Order..........................................................................................................C-6 Individual Command Explanations..................................................................................................C-9 Binary Mode Commands................................................................................................................C-216 Recommended Operations..............................................................................................R-1 Recommended Command Order...................................................................................................... R-4 Set the Printing Area............................................................................................................................ R-5 The printable area............................................................................................................................ R-6 Setting left and right margins......................................................................................................... R-9 Setting page length......................................................................................................................... R-10 Setting top and bottom margins................................................................................................... R-13 Setting bottom margin...................................................................................................................R-13 Select Characters................................................................................................................................R-15 Assign character tables.................................................................................................................. R-15 Defining user-defined characters................................................................................................R-17 Selecting an international character set......................................................................................R-41 Select a Font........................................................................................................................................R-42 Print quality (draft, LQ, or NLQ)................................................................................................R-43 Standard and scalable fonts (multipoint mode)........................................................................R-43 Enhancements................................................................................................................................R-51 Super/subscript............................................................................................................................. R-54 Select Supporting Features............................................................................................................... R-55 Selecting unidirectional print head movement......................................................................... R-55 Selecting print color....................................................................................................................... R-55 Select the Print Position.................................................................................................................... R-56 Moving the horizontal position................................................................................................... R-57 Moving the vertical position........................................................................................................R-60 Send Print Data................................................................................................................................... R-64 Sending Graphics Data......................................................................................................................R-65 Extended raster graphics (ESC . 2)..............................................................................................R-83 Printing Bar Codes............................................................................................................................. R-84 Extended ESC/P 2 Programming Guide........................................................................................R-99 Programming examples.............................................................................................................. R-104 ii Contents Command Table..............................................................................................................T-1 24/48-Pin Printers.................................................................................................................................T-2 9-Pin Printers.......................................................................................................................................T-22 Feature Summary............................................................................................................F-1 24/48-Pin Printers.................................................................................................................................F-3 9-Pin Printers.......................................................................................................................................F-78 Appendix..........................................................................................................................A-1 Character Tables...................................................................................................................................A-2 Proportional Width Information......................................................................................................A-21 Proportional width during multipoint mode (ESC/P 2 only)................................................A-21 24/48-pin proportional width tables...........................................................................................A-21 9-pin proportional width tables...................................................................................................A-26 ASCII Code Table...............................................................................................................................A-30 Parallel Interface.................................................................................................................................A-31 Internal Serial Interface.....................................................................................................................A-35 Six-pin DIN connector type..........................................................................................................A-35 25-pin subminiature D-shell connector (female) type..............................................................A-36 Optional Serial Interfaces..................................................................................................................A-37 Selecting PreESC/P 2 Fonts in ESC/P 2 Multipoint Mode..........................................................A-38 Glossary..........................................................................................................................G-1 Index..................................................................................................................................I-
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值