一:安装CLodop_Setup_for_Win32NT.exe
二:页面上引用<script src="/JS/LodopFuncs.js"></script>
三:body里加上控件,
<body>
<object id="LODOP1" classid="clsid:2105C259-1E0C-4534-8141-A753534CB4CA" width="0" height="0">
<embed id="LODOP_EM1" type="application/x-print-lodop" width="0" height="0"></embed>
</object>
</body>
四:调用JS打印
function dayin03(thisdiv, tiao) {
CreatePrintPage(tiao);
}
function prn_Design() {
CreatePrintPage();
LODOP.PRINT_DESIGN();
};
function CreatePrintPage(cont) {//cont要打印的条形码的内容
LODOP = getLodop(document.getElementById('LODOP1'), document.getElementById('LODOP_EM1'));
//LODOP.PRINT_INITA(0, 0, 800, 1600, "打印控件功能演示_Lodop功能_打印条码");
LODOP.ADD_PRINT_BARCODE(5, 5, 200, 100, "128A", cont);
LODOP.SET_PRINT_STYLEA(0, "FontSize", 18);
LODOP.PRINT();
};
上面的128A是条形码类型
具体参考官方示例
WEB打印控件LODOP的样例十一:演示直接打印条形码
相关下载的文件,连接如下,不要积分:LODOP打印需要的资源https://download.csdn.net/download/wybshyy/88414413?spm=1001.2014.3001.5503