JavaWeb完成打印功效。本站提示廣大學習愛好者:(JavaWeb完成打印功效)文章只能為提供參考,不一定能成為您想要的結果。以下是JavaWeb完成打印功效正文
空話不多說了,直接給年夜家貼代碼了,詳細代碼以下所示:
<script language="javascript"> function printsetup(){ // 打印頁面設置 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 class="button" name=button_setup value="打印頁面設置" onclick="javascript:printsetup();">
整頓的關於打印的內容
1、掌握"縱打"、 橫打”和“頁面的邊距。
(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(){ // 打印頁面設置 wb.execwb(8,1); } function printpreview(){ // 打印頁面預覽 wb.execwb(7,1); } function printit() { if (confirm('肯定打印嗎?')) { 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="打印" onclick="javascript:printit()"> <input type=button name=button_setup value="打印頁面設置" onclick="javascript:printsetup();"> <input type=button name=button_show value="打印預覽" onclick="javascript:printpreview();"> <input type=button name=button_fh value="封閉" onclick="javascript:window.close();">
關於這個組件還有其他的用法,羅列以下:
WebBrowser.ExecWB(1,1) 翻開
Web.ExecWB(2,1) 封閉如今一切的IE窗口,並翻開一個新窗口
Web.ExecWB(4,1) 保留網頁
Web.ExecWB(6,1) 打印
Web.ExecWB(7,1) 打印預覽
Web.ExecWB(8,1) 打印頁面設置
Web.ExecWB(10,1) 檢查頁面屬性
Web.ExecWB(15,1) 似乎是撤消,有待確認
Web.ExecWB(17,1) 全選
Web.ExecWB(22,1) 刷新
Web.ExecWB(45,1) 封閉窗體無提醒
2、分頁打印
<HTML> <HEAD> <STYLE> P {page-break-after: always} </STYLE> </HEAD> <BODY> <%while not rs.eof%> <p><%=rs(0)%></P> <%rs.movenext%> <%wend%> </BODY> </HTML>
以上所述是小編給年夜家引見的JavaWeb完成打印功效的相干內容,願望可以或許贊助到年夜家!