ESC/POS 打印机指令

package com.project.base;

import java.awt.Color; import java.awt.Font; import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.Enumeration; import java.util.List; import java.util.TooManyListenersException;

import javax.imageio.ImageIO;

import gnu.io.CommPort; import gnu.io.CommPortIdentifier; import gnu.io.NoSuchPortException; import gnu.io.PortInUseException; import gnu.io.SerialPort; import gnu.io.SerialPortEventListener; import gnu.io.UnsupportedCommOperationException;

public class SerialTool {

private static SerialTool serialTool = null;

static {
    //在该类被ClassLoader加载时就初始化一个SerialTool对象
    if (serialTool == null) {
        serialTool = new SerialTool();
    }
}

//私有化SerialTool类的构造方法,不允许其他类生成SerialTool对象
private SerialTool() {}    

/**
 * 获取提供服务的SerialTool对象
 * [@return](https://my.oschina.net/u/556800) serialTool
 */
public static SerialTool getSerialTool() {
    if (serialTool == null) {
        serialTool = new SerialTool();
    }
    return serialTool;
}


/**
 * 查找所有可用端口
 * [@return](https://my.oschina.net/u/556800) 可用端口名称列表
 */
public static ArrayList<String> findPort() {

    //获得当前所有可用串口
    Enumeration<CommPortIdentifier> portList = CommPortIdentifier.getPortIdentifiers();    
    
    ArrayList<String> portNameList = new ArrayList<>();

    //将可用串口名添加到List并返回该List
    while (portList.hasMoreElements()) {
        String portName = portList.nextElement().getName();
        portNameList.add(portName);
    }

    return portNameList;
}

/**
 * 打开串口
 * [@param](https://my.oschina.net/u/2303379) portName 端口名称
 * [@param](https://my.oschina.net/u/2303379) baudrate 波特率
 * [@return](https://my.oschina.net/u/556800) 串口对象
 * @throws SerialPortParameterFailure 设置串口参数失败
 * @throws NotASerialPort 端口指向设备不是串口类型
 * @throws NoSuchPort 没有该端口对应的串口设备
 * @throws PortInUse 端口已被占用
 */
public static SerialPort openPort(String portName, int baudrate) {

    try {

        //通过端口名识别端口
        CommPortIdentifier portIdentifier = CommPortIdentifier.getPortIdentifier(portName);


        //打开端口,并给端口名字和一个timeout(打开操作的超时时间)
        date = new Date();
        System.out.println("before commPort:"+sdf.format(date));	
        CommPort commPort = portIdentifier.open(portName, 2000);
        date = new Date();
        System.out.println("affter commPort:"+sdf.format(date));	

        //判断是不是串口
        if (commPort instanceof SerialPort) {
            
            SerialPort serialPort = (SerialPort) commPort;
            
            try {                        
                //设置一下串口的波特率等参数
                date = new Date();
                System.out.println("before baudrate:"+sdf.format(date));                	
                serialPort.setSerialPortParams(baudrate, SerialPort.DATABITS_8, SerialPort.STOPBITS_2, SerialPort.PARITY_NONE);  
                date = new Date();
                System.out.println("affter baudrate:"+sdf.format(date));                    
            } catch (UnsupportedCommOperationException e) {  
                //throw new UnsupportedCommOperationException();
            }
            
            //System.out.println("Open " + portName + " sucessfully !");
            return serialPort;
        
        }        
        else {
            //不是串口
            //throw new UnsupportedCommOperationException();
        	return null;
        }
    } catch (NoSuchPortException e1) {
      //throw new NoSuchPortException();
    	return null;
    } catch (PortInUseException e2) {
        //throw new PortInUseException();
    	return null;
    }
}

/**
 * 关闭串口
 * @param serialport 待关闭的串口对象
 */
public static void closePort(SerialPort serialPort) {
    if (serialPort != null) {
        serialPort.close();
        serialPort = null;
    }
}

/**
 * 往串口发送数据
 * @param serialPort 串口对象
 * @param order    待发送数据
 * @throws SendDataToSerialPortFailure 向串口发送数据失败
 * @throws SerialPortOutputStreamCloseFailure 关闭串口对象的输出流出错
 */
public static void sendToPort(SerialPort serialPort, byte[] order) {

    OutputStream out = null;
    
    try {
        
        out = serialPort.getOutputStream();
        out.write(order);
        out.flush();
        
    } catch (IOException e) {
        //throw new SendDataToSerialPortFailure();
    } finally {
        try {
            if (out != null) {
                out.close();
                out = null;
            }                
        } catch (IOException e) {
            //throw new SerialPortOutputStreamCloseFailure();
        }
    }
    
}

/**
 * 从串口读取数据
 * @param serialPort 当前已建立连接的SerialPort对象
 * @return 读取到的数据
 * @throws ReadDataFromSerialPortFailure 从串口读取数据时出错
 * @throws SerialPortInputStreamCloseFailure 关闭串口对象输入流出错
 */
public static byte[] readFromPort(SerialPort serialPort)  {

    InputStream in = null;
    byte[] bytes = null;

    try {
        
        in = serialPort.getInputStream();
        int bufflenth = in.available();        //获取buffer里的数据长度
        
        while (bufflenth != 0) {                             
            bytes = new byte[bufflenth];    //初始化byte数组为buffer中数据的长度
            in.read(bytes);
            bufflenth = in.available();
        } 
    } catch (IOException e) {
        //throw new ReadDataFromSerialPortFailure();
    } finally {
        try {
            if (in != null) {
                in.close();
                in = null;
            }
        } catch(IOException e) {
            //throw new SerialPortInputStreamCloseFailure();
        }

    }

    return bytes;

}

/**
 * 添加监听器
 * @param port     串口对象
 * @param listener 串口监听器
 * @throws TooManyListeners 监听类对象过多
 */
public static void addListener(SerialPort port, SerialPortEventListener listener) {

    try {
        
        //给串口添加监听器
        port.addEventListener(listener);
        //设置当有数据到达时唤醒监听接收线程
        port.notifyOnDataAvailable(true);
      //设置当通信中断时唤醒中断线程
        port.notifyOnBreakInterrupt(true);

    } catch (TooManyListenersException e) {
        //throw new TooManyListeners();
    }
}	
public static Date date = new Date();  
public static SimpleDateFormat sdf = new SimpleDateFormat("YYYY/MM/dd HH:mm:ss.SSS");  
public static void main(String[] args) {
	/*
	SerialPort sp = SerialTool.openPort("COM8", 9600);      
	byte[] turnOffAll = new byte[]{ 0x68,0x05,0x1f,0x55,0x00,0x79,0x43};
	byte[] turnOnLED1 = new byte[]{ 0x68,0x05,0x10,0x02,0x00,0x17,0x43};
	byte[] flashLED2 = new byte[]{ 0x68,0x05,0x11,0x01,0x00,0x17,0x43};		
	if (sp != null)
		SerialTool.sendToPort(sp, turnOffAll);		
	if (sp != null)
		SerialTool.sendToPort(sp, turnOnLED1);	
	if (sp != null)
		SerialTool.sendToPort(sp, flashLED2);			
	SerialTool.closePort(sp);

*/ date = new Date(); System.out.println("before openCom:"+sdf.format(date));
SerialPort sp = SerialTool.openPort("COM2", 9600); int[] rgb = new int[3]; List<Byte> cmdList = new ArrayList<Byte>(); byte[] data = new byte[] { 0x00, 0x00, 0x00 }; // ESC * m nL nH
byte[] escBmp = new byte[] { 0x1B, 0x2A, 0x00, 0x00, 0x00 }; byte[] GSVM = { 0x1d, 0x56, 0x42, 0x00 }; //切纸 escBmp[2] = 0x21; date = new Date(); System.out.println("start:"+sdf.format(date));
try { File f = new File("d:\temp.bmp"); BufferedImage bi = ImageIO.read(f); Graphics g = bi.getGraphics(); Font font = new Font("隶书", Font.BOLD, 20); g.setColor(Color.BLACK); g.setFont(font); g.drawString("这是套打的文字12345678", 250, 200); //g.create(0,0,352,264); //g.drawImage(bi, 0, 0,null); int width=bi.getWidth(); int height=bi.getHeight(); int minx=bi.getMinX(); int miny=bi.getMinY(); System.out.println("width="+width+",height="+height+"."); System.out.println("minx="+minx+",miniy="+miny+"."); //nL, nH
escBmp[3] = (byte)(width % 256); escBmp[4] = (byte)(width / 256);

        date = new Date();
        System.out.println("before data:"+sdf.format(date));  
        // data  
        for (int i = 0; i < (height / 24) + 1; i++)
        {

            for (int n = 0; n < 5; n++)
                cmdList.add(escBmp[n]);

            for (int j = 0; j < width; j++)
            {
                for (int k = 0; k < 24; k++)
                {
                    if (((i * 24) + k) < height)   // if within the BMP size  
                    {
                    	int pixel=bi.getRGB(j, (i * 24) + k); 
    					rgb[0] = (pixel & 0xff0000 ) >> 16 ; 
    					//rgb[1] = (pixel & 0xff00 ) >> 8 ; 
    					//rgb[2] = (pixel & 0xff); 
    					//System.out.println("i="+i+",j="+j+":("+rgb[0]+","+rgb[1]+","+rgb[2]+")");
                        if ((rgb[0]) < 75)
                        {
                            data[k / 8] += (byte)(128 >> (k % 8));
                        }
                    }
                }
                for (int n = 0; n < 3; n++)
                    cmdList.add(data[n]);
                data[0] = 0x00;
                data[1] = 0x00;
                data[2] = 0x00;    // Clear to Zero.  
            }

        } // data 	        
        date = new Date();
        System.out.println("after data:"+sdf.format(date));	        
	}
	catch(Exception e)
	{
		
	}
	finally{
		
	}

// for (int i=0;i<cmdList.size();i++) // System.out.println(cmdList.get(i)); date = new Date(); System.out.println("before array to byte[]:"+sdf.format(date)); Byte[] order = new Byte[cmdList.size()]; cmdList.toArray(order); // ; // for (int i=0;i<cmdList.size();i++) // { // //System.out.println(cmdList.get(i)); // order[i] = (int)cmdList.get(i); // } date = new Date(); System.out.println("after array to byte[]:"+sdf.format(date));
// TODO Auto-generated method stub // int[] order = {0x1b,0x2a,0x21,0x60,0x1,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x1,0x0,0x0,0x3,0x0,0x0,0x7,0x0,0x0,0xf,0x0,0x0,0xf,0x0,0x0,0xf,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x1f,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,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x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0,0x0}; //SerialTool.findPort();

	if (sp != null)
		SerialTool.sendToPort(sp, ByteArrayTobyteArray(order));
    date = new Date();
    System.out.println("after print:"+sdf.format(date));		

	SerialTool.sendToPort(sp, GSVM);
	SerialTool.closePort(sp);

/* byte[] HRI = { 0x1d, 0x48 ,0x00}; //可读字符打印位置-不打印 byte[] HRI_01 = { 0x1d, 0x48, 0x01 }; //可读字符打印位置-条码上方 byte[] HRI_02 = { 0x1d, 0x48, 0x02 }; //可读字符打印位置-条码下方 byte[] HRI_03 = { 0x1d, 0x48, 0x03 }; //可读字符打印位置-条码上方和下方 byte[] BARHIGHT = { 0x1d, 0x68, 0x00 }; //条码高度,最后一字节需换成实际的高1-255 byte[] BARWIDTH = { 0x1d, 0x77, 0x00 }; //条码宽度,最后一字节需换成实际的宽1-6 byte[] CODE_39 = { 0x1d, 0x6b, 0x45, 0x00}; //CODE39,最后一字节需替换成实际条码长度 byte[] CODE_128 = { 0x1d, 0x6b, 0x49, 0x00 }; //CODE128,最后一字节需替换成实际条码长度 byte[] UPC_A = {0x1d, 0x6b, 0x41, 0x00 }; //CPC_A,最后一字节需替换成实际条码长度 byte[] CODABAR = { 0x1d, 0x6b, 0x47, 0x00 }; //CODABAR,最后一字节需替换成实际条码长度 byte[] ESCAT = { 0x1b, 0x40 };//初始化打印机
byte[] GSVM = { 0x1d, 0x56, 0x42, 0x00 }; //切纸
byte[] feedCmd = { 0x1b, 0x64, 0x03 }; byte[] CRLF = { 0x1d, 0x0a}; //换行走纸 byte[] FSAND = { 0x1c, 0x26 };//选择汉字模式 byte[] FSDEL = { 0x1c, 0x2e };//取消汉字模式

	SerialPort sp = SerialTool.openPort("COM2", 9600);   
	if (sp != null)
	{
		SerialTool.sendToPort(sp, ESCAT);
		BARHIGHT[2] = 0x64;
		SerialTool.sendToPort(sp, BARHIGHT);	
		BARWIDTH[2] = 0x02;
		SerialTool.sendToPort(sp, BARWIDTH);			
		SerialTool.sendToPort(sp, HRI_02);	
		String str = "320102197809240813";
		byte[] order = str.getBytes();
		CODE_39[3] = (byte) order.length;
		byte[] data = new byte[4 + order.length];
		for (int i=0;i < 4; i++)
            data[i] = CODE_39[i];
        for (int i = 0; i < order.length; i++)
            data[4 + i] = order[i];			
		SerialTool.sendToPort(sp, data);	
		for (int i = 0; i < 4; i++)
		{
			SerialTool.sendToPort(sp, ESCAT);
			SerialTool.sendToPort(sp, FSAND);
			SerialTool.sendToPort(sp, new byte[]{0x0A});
			SerialTool.sendToPort(sp,CRLF);
			SerialTool.sendToPort(sp,FSDEL);
			
		}


		SerialTool.sendToPort(sp,GSVM);
		
	}
	SerialTool.closePort(sp);		
	*/
}

public static byte[] IntArrayToByteArray(int[] intArray)
{
	byte[] iretVal = new byte[intArray.length];
	for (int i=0 ; i < iretVal.length ; i++)
		iretVal[i] = (byte)intArray[i];
	return iretVal;
}

public static byte[] ByteArrayTobyteArray(Byte[] ByteArray)
{
    date = new Date();
    System.out.println("before Byte to byte:"+sdf.format(date));		
	byte[] iretVal = new byte[ByteArray.length];
	for (int i=0 ; i < iretVal.length ; i++)
		iretVal[i] = ByteArray[i];
    date = new Date();
    System.out.println("after Byte to byte:"+sdf.format(date));		
	return iretVal;
}

}

转载于:https://my.oschina.net/xueptao/blog/3042993

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
### 回答1: ESC/POS HT指令是一种控制打印机打印字符位置的指令。 HT是Horizontal Tab的缩写,意为水平制表符。水平制表符是一种控制字符,用于水平对齐文本,跳到下一个预设的位置。 ESC/POS HT指令的语法为ESC D n,其中ESC是转义字符,D是HT指令的标识符,n是指定要跳转的位置数。 例如,ESC D 4表示跳到第4个位置。 在打印机打印文本之前,可以使用ESC/POS HT指令来设定文本的位置,以便在打印时能够实现水平对齐。 使用ESC/POS HT指令可以实现多种应用场景,比如打印表格、票据等需要水平对齐的文本。 需要注意的是,ESC/POS HT指令的具体功能与打印机型号有关,不同型号的打印机可能会有略微的差别。在使用ESC/POS HT指令时,需要参考相应的打印机手册或文档,了解具体的指令格式和功能。 总之,ESC/POS HT指令是一种控制打印机打印字符位置的指令,可以实现文本的水平对齐,提高打印效果和可读性。 ### 回答2: ESC/POS HT指令打印机命令集的一部分。ESC/POS代表"Escape/Positive",是一种标准的打印机控制语言,主要用于控制热敏打印机的行为和输出内容。 HT指令是其中的一个命令,它的作用是控制打印位置的水平制表符。水平制表符是一种特殊的控制字符,用于在打印输出中创建列对齐的效果。 使用HT指令,可以在打印输出时将光标从当前位置移动到下一个预设的水平制表位置。这些预设位置通常由打印机内部设置,可以是固定间隔的列,用于对齐打印内容。 HT指令的语法比较简单,通常使用字符序列"\t"表示。在ESC/POS命令中,通过发送"\t"字符序列可以触发打印机执行一次水平制表符操作。 使用HT指令可以实现在打印输出中创建列对齐的效果,特别适用于打印不规则宽度的文本或表格。通过在适当的位置插入水平制表符,可以使得打印输出整齐和易读。 总之,ESC/POS HT指令是控制热敏打印机中水平制表符行为的命令。通过使用HT指令,可以在打印输出中创建列对齐的效果,提高打印的整齐度和可读性。 ### 回答3: ESC/POS HT(Horizontal Tab)指令是一种控制打印机指令,用于在打印时设置水平定位符号。 当打印机打印一行文本时,可以使用HT指令在文本中设置水平定位符号。水平定位符号的作用是将打印位置移动到下一个预设的水平位置,可以用于对齐列数据。 HT指令的使用方法是在要设置水平定位符号的位置插入命令,并指定插入的个数。每个HT指令代表一个水平定位符号的宽度,一般为一个制表符(tab)的宽度。 例如,如果我们使用HT指令打印位置移动到下一个水平定位符号的位置,可以在文本中插入"\t",表示一个制表符的宽度。如果需要移动两个水平定位符号的位置,可以插入"\t\t"。 HT指令的使用可以有效地对齐列数据,使得打印出来的文本更加整齐美观。在很多应用场景中,如打印发票、小票等需要对齐列数据的场合,使用HT指令可以达到很好的效果。 总的来说,ESC/POS HT指令是用于控制打印机的一种指令,用于设置水平定位符号,可以通过插入制表符的方式在文本中设置水平定位符号的位置,用于对齐列数据,提高打印文本的整齐度和美观度。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值