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 }
代码如下:
function printsetup(){ // 打印页面设置 wb.execwb(8,1); } function printpreview(){ // 打印页面预览 wb.execwb(7,1); } function printit() { if (confirm('确定打印吗?')) { wb.execwb(6,6) } } onclick="javascript.:printit()"> onclick="javascript.:printsetup();"> onclick="javascript.:printpreview();"> onclick="javascript.:window.close();">
<%=rs(0)%>
function button1_onclick() { var doc=window.iframe1.document; var r=odoc.body.createTextRange(); var stxt=r.htmlText; alert(stxt) var pwin=window.open("","print"); pwin.document.write(stxt); pwin.print(); }
function print_onclick //打印函数 dim label label=document.printinfo.label.value //获得HTML页面的数据 set bjfs=CreateObject("Scripting.FileSystemObject") //创建FileSystem组件对象的实例 set bjprinter=objfs.CreateTextFile ("LPT1:",true) //建立与打印机的连接 objprinter.Writeline("__________________________________") //输出打印的内容 objprinter.Writeline("| |") objprinter.Writeline("| 您打印的数据是:"&label& " |”) objprinter.Writeline("| |") objprinter.Writeline("|_________________________________|") objprinter.close //断开与打印机的连接 set bjprinter=nothing set bjfs=nothing // 关闭FileSystem组件对象 end function
<%……… set conn=server.CreateObject ("adodb.connection") conn.Open "DSN=name;UID=XXXX;PWD=XXXX;" set rs=server.CreateObject("adodb.recordset") rs.Open(“select ……”),conn,1,1 ……….%> //与数据库进行交互
………