- var strPrintFormat="";
- // 参数: 纸张宽度 (毫米), 纸张上, 下, 左, 右边预留空白宽度 (毫米), 每行之间空白分隔的高度 (毫米)
- strPrintFormat+="Paper,74.0,10.0,10.0,5.0,5.0,5.0";
- var strPrintValue="";
- // 参数: 字体名称, 字体大小, 字体颜色, 字体背景颜色, 字体样式, 打印文本
- strPrintValue+="宋体, 14,000000,FFFFFF,0, 某某公司收费凭条";
- strPrintValue+="| 宋体, 12,000000,FFFFFF,0, 缴费项目: 某某公司费用";
- strPrintValue+="| 宋体, 12,000000,FFFFFF,0, 缴费号码: 88888888";
- strPrintValue+="| 宋体, 12,000000,FFFFFF,0, 缴费金额: 68.00";
- strPrintValue+="| 宋体, 12,000000,FFFFFF,0, 大写金额: 陆拾捌元";
- strPrintValue+="| 宋体, 12,000000,FFFFFF,0, 客户名称: 张三";
- strPrintValue+="| 宋体, 12,000000,FFFFFF,0, 客户地址: 四川省成都市光华大道";
- strPrintValue+="| 宋体, 12,000000,FFFFFF,0, 交易时间: 2019-12-12 10:21:37";
- strPrintValue+="| 宋体, 12,000000,FFFFFF,0, 交易流水: 9fa3a177-54a7-4fe2-a6bb-fb347d4a98ac";
- strPrintValue+="| 宋体, 12,000000,FFFFFF,0, 操作人员: 李四";
- strPrintValue+="| 宋体, 12,000000,FFFFFF,0, 操作分店: 光华分店";
- // 提交打印数据, 并立即向默认打印机打印
- // 飞天 web 打印助手: http://www.cnft.cn
- $("#btnRun").click(function(){
- $.post("http://localhost:8918/cnftPrintTicket",
- {
- PrintFormat:strPrintFormat,
- PrintValue:strPrintValue
- },
- function(strResult){
- $("#txtResult").val("返回值:" + strResult);
- });
- });
- });
- </script>
- </head>
- <body>
- <input id="txtResult" type="text" value="" />
- <button id="btnRun" type="button"> 运行 </button>
来源: http://www.bubuko.com/infodetail-3351886.html