Home > Article > Web Front-end > JavaScript implements printing, print preview, and print settings_javascript skills
WebBrowser is IE’s built-in browser control and does not require users to download it.
1. WebBrowser control
2. Method of WebBrowder control //Print
WebBrowser1.ExecWB(6,1);
//Print settings
WebBrowser1.ExecWB(8,1);
//Print preview
WebBrowser1.ExecWB(7,1);
There are other uses for this component, listed below:
WebBrowser.ExecWB(1,1) opens Web.ExecWB(2,1) closes all current IE windows and opens a new window Web.ExecWB(4,1)
Save web page Web.ExecWB(6,1) Print Web.ExecWB(7,1) Print preview Web.ExecWB(8,1)
Print page settings Web.ExecWB(10,1)
View page properties Web.ExecWB(15,1)
It seems to be revoked and needs to be confirmed Web.ExecWB(17,1)
Select all Web.ExecWB(22,1) Refresh Web.ExecWB(45,1)
Close the form silently but printing will print out the entire page. Whatever is on the page will be printed out. Sometimes we only need to print the data table, then we have to write a style:
Hide the parts you don’t want to print: Style content:
Then use the style:
The code is as follows: