I won’t say much nonsense, I will just post the code to you. The specific code is as follows:
<script language="javascript"> function printsetup(){ // Print page settings wb.execwb(8,1); } </script> </head> <body> <OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2" height=0 id=wb name=wb width=0></OBJECT> <input type=button name=button_setup value="Print page settings" onclick="javascript:printsetup();">The contents of printing compiled
1. Control the margins of "vertical hit", horizontal hit" and "pages.
(1) <script defer>
function SetPrintSettings() { // -- advanced features factory.printing.SetMarginMeasure(2) // measure margins in inches factory.SetPageRange(false, 1, 3) // need pages from 1 to 3 factory.printing.printer = "HP DeskJet 870C" factory.printing.copies = 2 factory.printing.collate = true factory.printing.paperSize = "A4" factory.printing.paperSource = "Manual feed" // -- basic features factory.printing.header = "This is MeadCo" factory.printing.footer = "Advanced Printing by ScriptX" factory.printing.portrait = false factory.printing.leftMargin = 1.0 factory.printing.topMargin = 1.0 factory.printing.rightMargin = 1.0 factory.printing.bottomMargin = 1.0}</script>(2)
<script language="javascript"> function printsetup(){ // Print page settings wb.execwb(8,1); } function printpreview(){ // Print page preview wb.execwb(7,1); } function printit() { if (confirm('Are you sure to print?')) { wb.execwb(6,6) } } </script></head><body><OBJECT classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"height=0 id=wb name=wb width=0></OBJECT><input type=button name=button_print value="Print"onclick="javascript:printit()"><input type=button name=button_setup value="Print page settings"onclick="javascript:printsetup();"><input type=button name=button_show value="Print preview"onclick="javascript:printpreview();"><input type=button name=button_fh value="Close"onclick="javascript:window.close();">There are other uses of this component, listed as follows:
WebBrowser.ExecWB(1,1) Open
Web.ExecWB(2,1) Close all IE windows now and open a new window
Web.ExecWB(4,1) Save the 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) seems to be cancelled, and it is to be confirmed
Web.ExecWB(17,1) Select all
Web.ExecWB(22,1) Refresh
Web.ExecWB(45,1) Close the form silently
2. Pagination printing
<HTML><HEAD><STYLE> P {page-break-after: always}</STYLE></HEAD><BODY><%while not rs.eof%><p><%=rs(0)%></P><%rs.movenext%><%wend%></BODY></HTML>The above is the relevant content of JavaWeb implementation of printing functions introduced to you by the editor. I hope it can help you!