Web|web Printing ASP Development Prerequisites: Web Printing Code encyclopedia This article mainly introduces how to use ASP to control the various printing effects of the web, it can control the vertical, horizontal and page margins.
1, control "vertical dozen", "horizontal dozen" and "page margin".
(1)
<script defer>
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
}
</script>
(2)
<script language= "JavaScript" >
function Printsetup () {
Print Page Setup
WB.EXECWB (8,1);
}
function PrintPreview () {
Print Page Preview
WB.EXECWB (7,1);
}
function PrintIt ()
{
if (confirm) (' OK to print? ')) {
WB.EXECWB (6,6)
}
}
</script>
<body>
<object classid= "CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"
Height=0 ID=WB NAME=WB width=0></object>
<input Type=button name=button_print value= "print"
>
<input Type=button name=button_setup value= "Print Page Setup"
>
<input Type=button name=button_show value= "Print Preview"
>
<input Type=button name=button_fh value= "Off"
>
------------------------------------------------
There are other uses for this component, as listed below:
WEBBROWSER.EXECWB (1,1) Open
WEB.EXECWB (2,1) closes all of the IE windows now and opens a new window
WEB.EXECWB (4,1) Save Web page
WEB.EXECWB (6,1) printing
WEB.EXECWB (7,1) Print preview
WEB.EXECWB (8,1) print Page Setup
WEB.EXECWB (10,1) view page Properties
WEB.EXECWB (15,1) seems to be withdrawn, pending confirmation
WEB.EXECWB (17,1) Select all
WEB.EXECWB (22,1) Refresh
WEB.EXECWB (45,1) Close the form without prompting
2, Paging printing
<HTML>
<HEAD>
<STYLE>
P {Page-break-after:always}
</STYLE>
</HEAD>
<BODY>
<%while not rs.eof%>
<p><%=rs (0)%></p>
<%rs.movenext%>
<%wend%>
</BODY>
</HTML>
3. How to get rid of the path at the bottom of the page and the number of the top page when printing ASP page
(1) IE file-〉 page settings-〉 said inside the header and footer inside of the things are removed, printing will not come out.
(2)
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<meta name= "generator" content= "EditPlus" >
<meta name= "Author" content= "YC" >
<script language= "VBScript" >
Dim Hkey_root,hkey_path,hkey_key
Hkey_root= "HKEY_CURRENT_USER"
Hkey_path= "\SOFTWARE\Microsoft\Internet Explorer\PageSetup"
'//Set page to print header and footer empty
function Pagesetup_null ()
On Error Resume Next
Set regwsh = CreateObject ("Wscript.Shell")
hkey_key= "\header"
Regwsh.regwrite Hkey_root+hkey_path+hkey_key, ""
hkey_key= "\footer"
Regwsh.regwrite Hkey_root+hkey_path+hkey_key, ""
End Function
'//Set the page header footer as the default value
function Pagesetup_default ()
On Error Resume Next
Set regwsh = CreateObject ("Wscript.Shell")
hkey_key= "\header"
Regwsh.regwrite hkey_root+hkey_path+hkey_key, "&w&b page number, &p/&p"
hkey_key= "\footer"
Regwsh.regwrite Hkey_root+hkey_path+hkey_key, "&u&b&d"
End F