The Encyclopedia of Web Printing code in the development of ASP Dynamic Web page

Source: Internet
Author: User
Tags empty header
Web|web Printing | dynamic | Web Page This article mainly describes how to use ASP to control the various printing effects of the web, it can control the vertical hit, horizontal and page margins.

1, control "vertical dozen", "horizontal dozen" and "page margin".

(1)

<scriptdefer>
Functionsetprintsettings () {
--advancedfeatures
Factory.printing.SetMarginMeasure (2)//measuremarginsininches
Factory. Setpagerange (false,1,3)//needpagesfrom1to3
Factory.printing.printer= "hpdeskjet870c"
factory.printing.copies=2
Factory.printing.collate=true
Factory.printing.papersize= "A4"
Factory.printing.papersource= "Manualfeed"

--basicfeatures
Factory.printing.header= "Thisismeadco"
Factory.printing.footer= "Advancedprintingbyscriptx"
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)

<scriptlanguage= "JavaScript" >
Functionprintsetup () {
Print Page Setup
WB.EXECWB (8,1);
}
Functionprintpreview () {
Print Page Preview
  
WB.EXECWB (7,1);
  
  
}

Functionprintit ()
{
if (confirm) (' OK to print? ')){
WB.EXECWB (6,6)
}
}
</script>
<body>

<objectclassid= "CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"

Height=0id=wbname=wbwidth=0></object>
<inputtype=buttonname=button_printvalue= "Print"

Onclick= "Javascript:printit ()" >
<inputtype=button name=button_setupvalue= "Print Page Setup"

Onclick= "Javascript:printsetup ();" >
<inputtype=button name=button_showvalue= "Print Preview"

Onclick= "Javascript:printpreview ();" >
<inputtype=buttonname=button_fhvalue= "Off"

Onclick= "Javascript:window.close ();" >

------------------------------------------------
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>
<%whilenotrs.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>NewDocument</TITLE>
<metaname= "generator" content= "EditPlus" >
<metaname= "Author" content= "YC" >
<scriptlanguage= "VBScript" >

Dimhkey_root,hkey_path,hkey_key
Hkey_root= "HKEY_CURRENT_USER"
Hkey_path= "\software\microsoft\internetexplorer\pagesetup"
'//Set page to print header and footer empty
Functionpagesetup_null ()
Onerrorresumenext
Setregwsh=createobject ("Wscript.Shell")
hkey_key= "\header"
Regwsh.regwritehkey_root+hkey_path+hkey_key, ""
hkey_key= "\footer"
Regwsh.regwritehkey_root+hkey_path+hkey_key, ""
Endfunction
'//Set the page header footer as the default value
Functionpagesetup_default ()
Onerrorresumenext
Setregwsh=createobject ("Wscript.Shell")
hkey_key= "\header"
Regwsh.regwritehkey_root+hkey_path+hkey_key, "&w&b page number, &p/&p"
hkey_key= "\footer"
Regwsh.regwritehkey_root+hkey_path+hkey_key, "&u&b&d."
Endfunction
</script>
</HEAD>
<BODY>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/><palign=center>
<inputtype= "button" value= "empty page number" onclick=pagesetup_null () ><inputtype= "button" value= "Recovery page" onclick= Pagesetup_default () ><br/>

</p>
</BODY>
</HTML>


4, floating frame printing

<SCRIPTLANGUAGE=javascript>
Functionbutton1_onclick () {
Varodoc=window.iframe1.document;

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.