window.print()打印时,如何自定义页眉/页脚、页边距
来源:互联网 发布:php默认登录页面 编辑:程序博客网 时间:2024/06/16 10:27
自定义页眉/页脚、页边距,要用到ActiveX控件(在ie的安全设置的启用),会修改注册表中ie的设置,代码如下。
try{ var hkey_root,hkey_path,hkey_key; hkey_root="HKEY_CURRENT_USER"; hkey_path="\\Software\\Microsoft\\Internet Explorer\\PageSetup\\";var RegWsh = new ActiveXObject("WScript.Shell");//设置页眉/脚的字体样式hkey_key="font";RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"font-size: 12px; font-family: 黑体; line-height: 24px");//设置页眉hkey_key="header";RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"打印编号");//设置页脚hkey_key="footer"; RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"&b第 &p 页/共 &P 页"); //设置页边距(0.6 要乘以 2.5为实际打印的尺寸)hkey_key="margin_bottom"; RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"0.6");hkey_key="margin_left"; RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"0.6");hkey_key="margin_right"; RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"0.6"); hkey_key="margin_top"; RegWsh.RegWrite(hkey_root+hkey_path+hkey_key,"0.6");window.print();}catch(e){ alert(e.name+" "+e.message);}
阅读全文
0 0
- window.print()打印时,如何自定义页眉/页脚、页边距
- window.print() 去掉页眉页脚及打印链接
- 使用window.print打印frame框架,可以设置页眉页脚
- window.print打印网页
- window.print 页面打印
- window.print分页打印
- web打印 window.print()
- window.print()打印功能
- web打印window.print
- window.print 页面打印
- window.print 页面打印
- window.print打印时设置打印布局(纵向、横向)
- 网页打印javascript:window.print()
- window.print()打印指定区域
- window.print()打印页面部分内容
- javascript:window.print() 打印--(转载)
- 网页打印javascript:window.print()
- window.print()打印页面部分内容
- 最常用 最完整 最清晰 的git使用命令大全!
- JavaScript获取浏览器高度和宽度值(documentElement,clientHeight,offsetHeight,scrollHeight,scrollTop,offsetParent,
- Nginx invalid socket number 解决思路
- eclipse jpa project change event handler问题解决
- NFC-标签内容的读取
- window.print()打印时,如何自定义页眉/页脚、页边距
- 用CSS开启硬件加速来提高网站性能
- IOS 添加子控制器
- Redis入门到精通只需要三篇博客
- 57. Insert Interval
- vSphere及vCenter安装及使用说明
- springboot的druid监控
- 轻量化网络:MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications
- 这个跳槽问题,讲出来很气人!