一.打印需求1.控制页眉页脚和上下左右的页边距
2.可选横向打印
3.跳过配置对话直接打印
二.环境与背景
1.浏览器版本:IE8
2.不能使用ScriptX
3.不能开发新ActiveX
三.实现
1.控制页眉页脚和页边距
2.可选横向打印
3.跳过配置对话直接打印
二.环境与背景
1.浏览器版本:IE8
2.不能使用ScriptX
3.不能开发新ActiveX
三.实现
1.控制页眉页脚和页边距
使用ActiveX组件"WScript.Shell"对注册表进行访问修改,相当于修改了IE中的打印设置。
web_printer.js:
function JSActiveXPrinter()
{
this.header = null;
this.footer = null;
this.marginTop = null;
this.marginBottom = null;
this.marginLeft = null;
this.marginRight = null;
this.localHeader = null;
this.localFooter = null;
this.localMarginTop = null;
this.localMarginBottom = null;
this.localMarginLeft = null;
this.localMarginRight = null;
this.portrain = false;
this.wsShell = new ActiveXObject("WScript.Shell");
this.regPath = "HKEY_CURRENT_USER\\Software\\M