The WebBrowser component isIEThe built-in browser control, when used, first declare the WebBrowser component with the <object>... </object> tag under the <body> label. The Code is as follows:
<object id="WebBrowser1"width="0" height="0" classid = "CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"> </object>
Print the page mainly through the execWB () method of the WebBrowser component.
Syntax: WebBrowser.exe cWB (n1_id, nCmdOpt)
NCmdID: required. Command for executing the operation function
NCmdOpt: required. Execute the corresponding option, usually 1.
Common parameters are as follows:
WebBrowser. ExecWB () Open
Web. ExecWB () Close all existing IE Windows and open a new window
Web. ExecWB () save Web Page
Web. ExecWB (6, 1) Printing
Web. ExecWB (6, 6) Direct Printing
Web. ExecWB (7,1) print and preview
Web. ExecWB (8, 1) Printing page settings
Web. ExecWB () view page properties
Select all Web. ExecWB ()
Web. ExecWB (22, 1) Refresh
Web. ExecWB () Close form no prompt
Paging Printing
CSS has a Media attribute that allows you to set the print and display formats separately.
For example, <style media = "print" type = "text/css">... </Style> the format in the middle will only take effect during printing and will not affect the display interface.
So you can set
<style media="print" type="text/css">.Noprint {display:none;}.PageNext {page-break-after:always;}</style>
Then, add "class =" Noprint "to the page element that you do not want to print. This will not appear in print or print preview.
Add <divclass = "PageNext"> </div> to the page.
Print content in the specified iframe framework
The framework content on the print page is that you first need to get the focus for the Framework, which can be implemented using the built-in object parent. parent refers to the parent window that contains the current split window.
parent.printFrame.focus();window.print();
PrintFrame is the name of the framework to be printed.