1. 安装打印机及驱动;
2. 将logo图片放到”C“盘下;如:”C:/hxsd.pcx“;
3. 将TSCActiveX.dll放在window -> system下;
4. 浏览器设置:工具->internet选项->安全->自定义级别->对未标记为可安全之星脚本的ActiveX控件初始化并执行脚本(不安全)
5. 运行-》Regsvr32 TSCActiveX.dll;
6. 将TSCLIB.dll放在window -> system下;
7. 运行-》Regsvr32 TSCLIB.dll;
二、 具体应用时大致js如下:
<script type="text/javascript">
function printBar() {
var time = new Date();
time = time.format('yyyy-MM-dd hh:mm:ss');
var TSCObj;
TSCObj = new ActiveXObject("TSCActiveX.TSCLIB");
TSCObj.ActiveXabout();
TSCObj.ActiveXopenport ("TSC TTP-342 Plus");
TSCObj.ActiveXdownloadpcx ("C:/hxsd.pcx","hxsd.pcx");
TSCObj.ActiveXsetup ("60","40","3","12","0","2","0");
TSCObj.ActiveXsendcommand ("SET TEAR ON");
TSCObj.ActiveXclearbuffer();
TSCObj.ActiveXprinterfont ("10","10","4","0","8","8","");
TSCObj.ActiveXsendcommand ("PUTPCX 40,40,\"hxsd.pcx\"");
TSCObj.ActiveXwindowsfont (40, 150, 45, 0, 2, 0, "黑体", "AOC显示器");
TSCObj.ActiveXwindowsfont (40, 400, 45, 0, 2, 0, "黑体", "AOC201103310000001");
TSCObj.ActiveXbarcode ("40", "200", "128", "195", "0", "0", "3", "3", "AOC201103310000001");
TSCObj.ActiveXprintlabel ("1","1");
TSCObj.ActiveXcloseport();
}
</script>