Preface This control will have a watermark at the bottom when printed directly, which can be solved by purchasing it from the official website; Calling in method print(){ let LODOP = getLodop(); LODOP.PRINT_INITA(0,0,800,1600,"Print location name"); LODOP.SET_PRINT_PAGESIZE(1,700,500,"") //Set paper size LODOP.NewPage(); //Initialize LODOP.SET_PRINT_MODE("RESELECT_PRINTER",true); : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : : LodopFuncs.js File //==This JS is a comprehensive example of loading the Lodop plug-in and CLodop service. It can be used directly. It is recommended to integrate it into your own page program after understanding it== var CreatedOKLodopObject, CLodopIsLocal, CLodopJsState; //==Determine whether CLodop is needed (for browsers that do not support plug-ins):== export function needCLodop() { try { var ua = navigator.userAgent; if (ua.match(/Windows\sPhone/i)) return true; if (ua.match(/iPhone|iPod|iPad/i)) return true; if (ua.match(/Android/i)) return true; if (ua.match(/Edge\D?\d+/i)) return true; var verTrident = ua.match(/Trident\D?\d+/i); var verIE = ua.match(/MSIE\D?\d+/i); var verOPR = ua.match(/OPR\D?\d+/i); var verFF = ua.match(/Firefox\D?\d+/i); var x64 = ua.match(/x64/i); if ((!verTrident) && (!verIE) && (x64)) return true; else if (verFF) { verFF = verFF[0].match(/\d+/); if ((verFF[0] >= 41) || (x64)) return true; } else if (verOPR) { verOPR = verOPR[0].match(/\d+/); if (verOPR[0] >= 32) return true; } else if ((!verTrident) && (!verIE)) { var verChrome = ua.match(/Chrome\D?\d+/i); if (verChrome) { verChrome = verChrome[0].match(/\d+/); if (verChrome[0] >= 41) return true; } } return false; } catch (err) { return true; } } //==Reference CLodop's main JS, using dual ports 8000 and 18000 (in case one of them is occupied):== if (needCLodop()) { var head = document.head || document.getElementsByTagName("head")[0] || document.documentElement; var JS1 = document.createElement("script"); JS1.src = "http://localhost:8000/CLodopfuncs.js?priority=1"; head.insertBefore(JS1, head.firstChild); var JS2 = document.createElement("script"); JS2.src = "http://localhost:18000/CLodopfuncs.js?priority=0"; head.insertBefore(JS2, head.firstChild); CLodopIsLocal = !!((JS1.src + JS2.src).match(/\/\/localho|\/\/127.0.0./i)); if (JS1.attachEvent) { CLodopJsState = "loading"; var onChange = function(){ if (window.event.srcElement.readyState == 'loaded') CLodopJsState = "complete"; }; JS1.attachEvent('onreadystatechange',onChange); JS2.attachEvent('onreadystatechange',onChange); } } //==Get the main process of the LODOP object to determine whether it is installed and whether it needs to be upgraded:== export function getLodop(oOBJECT, oEMBED) { var strHtmInstall = "<br><font color='#FF00FF'>Print control is not installed! Click here <a href='https://wms.warehousing.com/download/install_lodop32.exe' target='_self'>to perform the installation</a>, please refresh the page or re-enter after installation.</font>"; var strHtmUpdate = "<br><font color='#FF00FF'>The print control needs to be upgraded! Click here <a href='https://wms.warehousing.com/download/install_lodop32.exe' target='_self'>to perform the upgrade</a>, please re-enter after the upgrade.</font>"; var strHtm64_Install = "<br><font color='#FF00FF'>Print control is not installed! Click here <a href='https://wms.warehousing.com/download/install_lodop64.exe' target='_self'> to perform the installation</a>. Please refresh the page or re-enter after installation.</font>"; var strHtm64_Update = "<br><font color='#FF00FF'>The print control needs to be upgraded! Click here <a href='https://wms.warehousing.com/download/install_lodop64.exe' target='_self'>to perform the upgrade</a>, please re-enter after the upgrade.</font>"; var strHtmFireFox = "<br><br><font color='#FF00FF'> (Note: If you have installed the old version of Lodop attachment npActiveXPLugin, please uninstall it first in [Tools] -> [Add-ons] -> [Extensions])</font>"; var strHtmChrome = "<br><br><font color='#FF00FF'>(If it was normal before, the problem only occurred due to browser upgrade or reinstallation, and you need to re-execute the above installation)</font>"; var strCLodopInstall_1 = "<br><font color='#FF00FF'>Web printing service CLodop is not installed and started, click here <a href='https://wms.warehousing.com/download/CLodop_Setup_for_Win32NT.exe' target='_self'>download and install</a>"; var strCLodopInstall_2 = "<br>(If it has been installed before, you can <a href='https://wms.warehousing.com/download/CLodop.protocol:setup' target='_self'>click here to start again</a>)"; var strCLodopInstall_3 = "Please refresh this page after success.</font>"; var strCLodopUpdate = "<br><font color='#FF00FF'>Web printing service CLodop needs to be upgraded! Click here <a href='https://wms.warehousing.com/download/CLodop_Setup_for_Win32NT.exe' target='_self'> to perform the upgrade</a>, please refresh the page after the upgrade.</font>"; var LODOP; try { var ua = navigator.userAgent; var isIE = !!(ua.match(/MSIE/i)) || !!(ua.match(/Trident/i)); if (needCLodop()) { try { LODOP = getCLodop(); } catch (err) {} if (!LODOP && (document.readyState !== "complete" || (isIE && CLodopJsState == "loading")) ) { alert("The webpage has not been downloaded yet, please wait a moment before operating again."); return; } if (!LODOP) { document.body.innerHTML = strCLodopInstall_1 + (CLodopIsLocal ? strCLodopInstall_2 : "") + strCLodopInstall_3 + document.body.innerHTML; return; } else { if (CLODOP.CVERSION < "3.0.9.3") { document.body.innerHTML = strCLodopUpdate + document.body.innerHTML; } if (oEMBED && oEMBED.parentNode) oEMBED.parentNode.removeChild(oEMBED); if (oOBJECT && oOBJECT.parentNode) oOBJECT.parentNode.removeChild(oOBJECT); } } else { var is64IE = isIE && !!(ua.match(/x64/i)); //==If the page has Lodop, use it directly, otherwise create a new one:== if (oOBJECT || oEMBED) { if (isIE) LODOP = oOBJECT; else LODOP = oEMBED; } else if (!CreatedOKLodopObject) { LODOP = document.createElement("object"); LODOP.setAttribute("width", 0); LODOP.setAttribute("height", 0); LODOP.setAttribute("style", "position:absolute;left:0px;top:-100px;width:0px;height:0px;"); if (isIE) LODOP.setAttribute("classid", "clsid:2105C259-1E0C-4534-8141-A753534CB4CA"); else LODOP.setAttribute("type", "application/x-print-lodop"); document.documentElement.appendChild(LODOP); CreatedOKLodopObject = LODOP; } else LODOP = CreatedOKLodopObject; //==Prompt download address when Lodop plugin is not installed:== if ((!LODOP) || (!LODOP.VERSION)) { if (ua.indexOf('Chrome') >= 0) document.body.innerHTML = strHtmChrome + document.body.innerHTML; if (ua.indexOf('Firefox') >= 0) document.body.innerHTML = strHtmFireFox + document.body.innerHTML; document.body.innerHTML = (is64IE ? strHtm64_Install : strHtmInstall) + document.body.innerHTML; return LODOP; } } if (LODOP.VERSION < "6.2.2.6") { if (!needCLodop()) document.body.innerHTML = (is64IE ? strHtm64_Update : strHtmUpdate) + document.body.innerHTML; } //===The following blank positions are suitable for calling unified functions (such as registration statements, language selection, etc.):== //======================================================= return LODOP; } catch (err) { alert("getLodop error: " + err); } } This is the end of this article about how Vue uses the lodop print control to achieve browser-compatible printing. For more relevant Vue browser-compatible printing content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of 2 methods to synchronize network time in Linux/CentOS system
>>: How to assign a public IP address to an instance in Linux
Table of contents Variable Scope The concept of c...
Table of contents Events in js Event Type Common ...
To achieve the background color flashing effect, j...
Preface This article mainly summarizes some of th...
Prerequisites Need to install git Installation St...
Preface When sharing a page, you hope to click th...
In order to express the deep condolences of peopl...
This article mainly introduces the sample code of...
Traceroute allows us to know the path that inform...
Demand background A statistical interface, the fr...
Table of contents Get the content of the iframe o...
First of all, what is 404 and soft 404? 404: Simpl...
Main library binlog: # at 2420 #170809 17:16:20 s...
"Page screenshot" is a requirement ofte...
Table of contents 1. Where is the slowness? 2. Ha...