页面打印相关.doc_第1页
页面打印相关.doc_第2页
页面打印相关.doc_第3页
页面打印相关.doc_第4页
页面打印相关.doc_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

/打印分页 /设置打印 function window.onload() / - advanced features factory.printing.SetMarginMeasure(2) / measure margins in inches factory.printing.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 = 居左显示&b居中显示&b居右显示页码,第&p页/共&P页 factory.printing.footer = (自定义页脚) factory.printing.portrait = false factory.printing.leftMargin = 0.75 factory.printing.topMargin = 1.5 factory.printing.rightMargin = 0.75 factory.printing.bottomMargin = 1.5 function Print(frame) factory.printing.Print(true, frame) / print with prompt 具体使用手册,更多信息,点这里 /自带的打印预览 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) 关闭窗体无提示 .Noprintdisplay:none; .PageNextpage-break-after: always; /去掉打印时的页眉页脚 var HKEY_Root,HKEY_Path,HKEY_Key; HKEY_Root=HKEY_CURRENT_USER; HKEY_Path=SoftwareMicrosoftInternet ExplorerPageSetup; /设置网页打印的页眉页脚为空 function PageSetup_Null() try var Wsh=new ActiveXObject(WScript.Shell); HKEY_Key=header; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,); HKEY_Key=footer; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,); catch(e) /设置网页打印的页眉页脚为默认值 function PageSetup_Default() try var Wsh=new ActiveXObject(WScript.Shell); HKEY_Key=header; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,&w&b页码,&p/&P); HKEY_Key=footer; Wsh.RegWrite(HKEY_Root+HKEY_Path+HKEY_Key,&u&b&d); catch(e) js打印WEB页面内容代码大全 收藏 第一种方法:指定不打印区域使用CSS,定义一个.noprint的class,将不打印的内容放入这个class内。详细如下: .noprintvisibility:hidden 要打印的内容。哈哈!将不打印的代码放在这里。打印第二种方法:指定打印区域把要打印的内容放入一个 span或div,然后通过一个函数打印。把要打印的内容放这里所有内容div2的内容打印function printme()document.body.innerHTML=document.getElementById(div1).innerHTML+document.getElementById(div2).innerHTML;window.print();如果要打印的只是整个页面中的一小部分,就最好采用第二种方法。第三种方法:如果要打印的页面排版和原web页面相差很大,采用此种方法。点打印按钮弹出新窗口,把需要打印的内容显示到新窗口中,在新窗口中调用window.print()方法,然后自动关闭新窗口。 1、控制纵打、 横打”和“页面的边距。(1)function SetPrintSettings() / - advanced featuresfactory.printing.SetMarginMeasure(2) / measure margins in inchesfactory.SetPageRange(false, 1, 3) / need pages from 1 to 3factory.printing.printer = HP DeskJet 870Cfactory.printing.copies = 2factory.printing.collate = truefactory.printing.paperSize = A4factory.printing.paperSource = Manual feed/ - basic featuresfactory.printing.header = This is MeadCofactory.printing.footer = Advanced Printing by ScriptXfactory.printing.portrait = falsefactory.printing.leftMargin = 1.0factory.printing.topMargin = 1.0factory.printing.rightMargin = 1.0factory.printing.bottomMargin = 1.0(2)function printsetup()/ 打印页面设置wb.execwb(8,1);function printpreview()/ 打印页面预览wb.execwb(7,1);function printit()if (confirm(确定打印吗?) wb.execwb(6,6)-关于这个组件还有其他的用法,列举如下: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、分页打印P page-break-after: always3、ASP页面打印时如何去掉页面底部的路径和顶端的页码编号(1)ie的文件-页面设置-讲里面的页眉和页脚里面的东西都去掉,打印就不出来了。(2) New Document dim hkey_root,hkey_path,hkey_keyhkey_root=HKEY_CURRENT_USERhkey_path=SoftwareMicrosoftInternet ExplorerPageSetup/设置网页打印的页眉页脚为空function pagesetup_null()on error resume nextSet RegWsh = CreateObject(WScript.Shell)hkey_key=headerRegWsh.RegWrite hkey_root+hkey_path+hkey_key,hkey_key=footerRegWsh.RegWrite hkey_root+hkey_path+hkey_key,end function/设置网页打印的页眉页脚为默认值function pagesetup_default()on error resume nextSet RegWsh = CreateObject(WScript.Shell)hkey_key=headerRegWsh.RegWrite hkey_root+hkey_path+hkey_key,&w&b页码,&p/&Phkey_key=footerRegWsh.RegWrite hkey_root+hkey_path+hkey_key,&u&b&dend function 4、浮动帧打印function button1_onclick() var odoc=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();5、用FileSystem组件实现WEB应用中的本地特定打印function print_onclick /打印函数dim labellabel=document.printinfo.label.value /获得HTML页面的数据set objfs=CreateObject(Scripting.FileSystemObject) /创建FileSystem组件对象的实例set objprinter=objfs.CreateTextFile (LPT1:,true) /建立与打印机的连接objprinter.Writeline(_) /输出打印的内容objprinter.Writeline(| |)objprinter.Writeline(| 您打印的数据是:&label& |”)objprinter.Writeline(| |)objprinter.Writeline(|_|)objprinter.close /断开与打印机的连接set objprinter=nothingset objfs=nothing / 关闭FileSystem组件对象end function服务器端脚本: /与数据库进行交互HTML页面编码: id=print name=print /调用打印函数INPUT type=hidden id=text1 name=label value= /保存服务器端传来的数据第四种方法:去除页眉页脚PcyearSeo function doPrint() bdhtml=window.document.body.innerHTML; sprnstr=; eprnstr=; prnhtml=bdhtml.substr(bdhtml.indexOf(sprnstr)+17); prnhtml=prnhtml.substring(0,prnhtml.indexOf(eprnstr); window.document.body.innerHTML=prnhtml; window.print(); var hkey_root,hkey_path,hkey_key hkey_root=HKEY_CURRENT_USER hkey_path=SoftwareMicrosoftInternet ExplorerPageSetup function pagesetup_null() try var RegWsh=new ActiveXObject(WScript.Shell) hkey_key=header RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,) hkey_key=footer RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,) catch(e) 您打印内容开始: 打印的内容结束 直接打印 打印预览 var hkey_root, hkey_path, hkey_key hkey_root = HKEY_CURRENT_USER hkey_path = file:/software/Microsoft/Internet ExplorerPageSetup /设置网页打印的页眉页脚为空 function pagesetup_null() try var RegWsh = new ActiveXObject(WScript.Shell) hkey_key = header RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, ) hkey_key = footer RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, ) catch (e) /设置网页打印的页眉页脚为默认值 function pagesetup_default() try var RegWsh = new ActiveXObject(WScript.Shell) hkey_key = header RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, &w&b页码,&p/&P) hkey_key = footer RegWsh.RegWrite(hkey_root + hkey_path + hkey_key, &u&b&d) catch (e) function setdivhidden(id) /把指定id以外的层统统隐藏 var divs = document.getElementsByTagName(DIV); for (var i = 0; i divs.length; i+) if (divs.item(i).id != id) divs.item(i).style.display = none; function setdivvisible(id) /把指定id以外的层统统显示 var divs = document.getElementsByTagName(DIV); for (var i = 0; i divs.length; i+) if (divs.item(i).id != id) divs.item(i).style.display = block; function pri

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论