| Lodop设置指定打印机打印,避免默认打印机被修改
					当前位置:点晴教程→知识管理交流
					
					→『 技术文档交流 』
					
				 
 createOneFormPage(); LODOP.SET_PRINT_MODE("TRYLINKPRINTER_NOALERT",true);//这个语句设置网络共享打印机连接不通时是否提示一下 if (LODOP.SET_PRINTER_INDEX(0))//这里指定第0号打印机打印 LODOP.PRINT(); 1.C-Lopdop选择打印机(C-Lodop特有的函数create_Printer_List) C-Lodop获取打印机列表create_Printer_List,此方法Lodop不支持,是C-Lodop特有的函数,客户端本地打印单独用c-lodop,或集中打印等,可以获得本机或云主机的打印机列表。 2.Lodop选择打印机 <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>WEB打印控件LODOP</title> <script language="javascript" src="LodopFuncs.js"></script> <style> </style> </head> <input type="button" value="选择打印机" onclick="creatPrintList()" > <select id="PrinterList" size="1" style="margin-top:10px;"></select> <input type="button" value="选择打印机" onclick="creatPrintList2()" > <select id="PrinterList2" size="1" style="margin-top:10px;"></select> <script language="javascript" type="text/javascript"> var LODOP; //声明为全局变量        function creatPrintList(){LODOP=getLodop(); var iPrinterCount=LODOP.GET_PRINTER_COUNT();         for(var i=0;i<iPrinterCount;i++){               var option=document.createElement('option');option.innerHTML=LODOP.GET_PRINTER_NAME(i); option.value=i;             document.getElementById('PrinterList').appendChild(option);};        document.getElementById('PrinterList').style.display='block';};        function creatPrintList2(){    if (document.getElementById('PrinterList2').innerHTML!="") return;//点第二次以上,在列表已经填充不为空情况下,不再执行后面的代码,直接返回,避免重新装载打印机。 LODOP=getLodop(); var iPrinterCount=LODOP.GET_PRINTER_COUNT();         for(var i=0;i<iPrinterCount;i++){               var option=document.createElement('option');option.innerHTML=LODOP.GET_PRINTER_NAME(i); option.value=i;             document.getElementById('PrinterList2').appendChild(option);};        document.getElementById('PrinterList2').style.display='block';};     function prn1_preview() {LODOP=getLodop();         LODOP.PRINT_INIT("");        LODOP.SET_PRINTER_INDEX(document.getElementById("PrinterList").value);LODOP.SET_PRINT_PAGESIZE(1,300,500,""); LODOP.ADD_PRINT_TEXT(4,62,150,40,"文字"); LODOP.PREVIEW(); }; </script> </body> 该文章在 2023/9/25 19:04:49 编辑过 | 关键字查询 相关文章 正在查询... |