云打印
大致流程
客户端发送打印数据到服务端,服务端下发数据到打印机实现打印
讲人话
在客户端把要打印的数据,存到数据库,在本地去读数据库,然后发指令给打印机
准备
准备打印机 usb 连接的
找客服要开发包(里面有驱动指令,反正也看不明白,建议直接问他们的技术客服方法具体是什么)
引用了 jna-4.5.1.jar 和 TSCLB.dll
具体实现
import com.sun.jna.Library;
import com.sun.jna.Native;
import com.tg.Utils.JDBCUtils;
import com.tg.domian.Com;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
public class TestMain {
//加载库文件
private static final String LOAD_LIBRARY="TSCLIB";
//打印机型号
private static final String print_model="Gprinter GP-9025T";
public interface TscLibDll extends Library {
TscLibDll INSTANCE = (TscLibDll) Native.loadLibrary ("TSCLIB", TscLibDll.class);
int about ();
int openport (String pirnterName);
int closeport ();
int sendcommand (String printerCommand);
int setup (String width,String height,String speed,String density,String sensor,String vertical,String offset);
int downloadpcx (String filename,String image_name);
int barcode (String x,String y,String type,String height,String readable,String rotation,String narrow,String wide,String code);
int printerfont (String x,String y,String fonttype,String rotation,String xmul,String ymul,String text);
i