WEB打印设置解决方案一(通过修改注册表改变IE打印设置)

以下是IE打印设置脚本

 1<script language="VBScript">   
 2Dim hkey_root,hkey_path,hkey_key 
 3
 4hkey_root = "HKEY_CURRENT_USER"   
 5hkey_path = "\Software\Microsoft\Internet Explorer\PageSetup" //IE打印设置的注册表地址 
 6
 7//设置修改函数   
 8function pagesetup_null()   
 9On Error Resume Next 
10
11Set RegWsh = CreateObject("WScript.Shell")   
12hkey_key="\header"   
13RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"" //页眉 
14
15hkey_key="\footer"   
16RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"" //页脚 
17
18hkey_key="\margin_left"   
19RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"1" //键值设定--左边边界 
20
21hkey_key="\margin_top"   
22RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"1" //键值设定--上边边界 
23
24hkey_key="\margin_right"   
25RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"1" //键值设定--右边边界 
26
27hkey_key="\margin_bottom"   
28RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"1" //键值设定--下边边界   
29end function   
30  
31//恢复默认设置   
32function pagesetup_default()   
33On Error Resume Next   
34Set RegWsh = CreateObject("WScript.Shell") 
35
36hkey_key="\header"   
37RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&w&b页,&p/&P" //页数- 
38
39hkey_key="\footer"   
40RegWsh.RegWrite hkey_root+hkey_path+hkey_key,"&u&b&d" //网址,日期等信息   
41end function   
42</script>

除了以上键值以外还有以下几项,其值有待确认。
duplex
orientation
paper_size
paper_source
printer

注意:上面对页边距的设置为:1,实际设置值为25.4。

Published At
Categories with Web编程
Tagged with
comments powered by Disqus