WEB Print Daquan
WEB Print Daquan
1, a longitudinal control, Wang fight "and" page margins.
(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
Manual feed factory.printing.paperSource =
/ / - 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 Preview pages wb.execwb (7,1);
)
Function printit ()
(
If (confirm ( 'Print identified?')) (
Wb.execwb (6,6)
)
)
</ Script>
</ Head>
<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
Onclick = javascript: printit ()>
<Input type = button name = button_setup value = Print Page Setup
Onclick = javascript: printsetup ();>
<Input type = button name = button_show value = Print Preview
Onclick = javascript: printpreview ();>
<Input type = button name button_fh value = = Close
Onclick = javascript: window.close ();>
————————————————
On the other components of usage, are listed below:
WebBrowser.ExecWB (1,1) Open
Web.ExecWB (2,1) closed all the IE window now, and opens a new window
Web.ExecWB (4,1) stored pages
Web.ExecWB (6,1) Print
Web.ExecWB (7,1) Print Preview
Web.ExecWB (8, 1) Print Page Setup
Web.ExecWB (10,1) Show Page Attributes
Web.ExecWB (15,1) seems to be revoked, pending confirmation
Web.ExecWB (17,1) SELECT ALL
Web.ExecWB (22,1) refresh
Web.ExecWB (45,1) closed form Silent
2, page Print
<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, ASP page print removed from the bottom of the page, how the path and the top of the page numbers (1) ie documents -> Page Setup -> stresses inside headers and footers, there are things removed, Print not 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
'/ / Print Web pages in the air for the header footer
Function pagesetup_null ()
On error resume next
Set RegWsh = CreateObject (WScript.Shell)
Hkey_key = \ header
RegWsh.RegWrite hkey_root + + hkey_key hkey_path,
Hkey_key = \ footer
RegWsh.RegWrite hkey_root + + hkey_key hkey_path,
End function
'/ / Print Web pages in the header footer to the default value
Function pagesetup_default ()
On error resume next
Set RegWsh = CreateObject (WScript.Shell)
Hkey_key = \ header
RegWsh.RegWrite hkey_root + + hkey_key hkey_path, Page & b & w, & p / & P
Hkey_key = \ footer
RegWsh.RegWrite hkey_root + + hkey_path hkey_key, & u & b & d
End function
</ Script>
</ HEAD>
<BODY>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/> <p Align=center>
<input Type=button value= Qingkongxiema onclick=pagesetup_null()> <input type=button value=æ¢å¤é¡µå—onclick=pagesetup_default()> <br/>
</ P>
</ BODY>
</ HTML>
4, the floating frame Print
<SCRIPT LANGUAGE=javascript>
Function button1_onclick () (
Var odoc = window.iframe1.document;
Var r = odoc.body.createTextRange ();
Var stxt = r.htmlText;
Alert (stxt)
Var pwin = window.open (and print);
Pwin.document.write (stxt);
Pwin.print ();
)
</ SCRIPT>
4, FileSystem components used in the realization of the local WEB application specific Print
<script Language=VBScript>
Function print_onclick / / Print function
Dim label
Label = document.printinfo.label.value / / HTML pages of data
Set objfs = CreateObject (Scripting.FileSystemObject) / / create examples of FileSystem Component Object
Objfs.CreateTextFile set objprinter = (LPT1:, true) / / printer connection with the establishment
Objprinter.Writeline (__________________________________) / / output print the contents of
Objprinter.Writeline (| |)
Objprinter.Writeline (| you to print the data: & label & | ")
Objprinter.Writeline (| |)
Objprinter.Writeline (|_________________________________|)
Objprinter.close / / disconnect and connect the printer
Set objprinter = nothing
Nothing set objfs = / / Close FileSystem Component Object
End function
</ Script>
Server-side scripting:
<%………
Set conn = server.CreateObject (adodb.connection)
Conn.Open DSN = name; UID = XXXX; PWD = XXXX;
Set rs = server.CreateObject (adodb.recordset)
Rs.Open ( "select……"), conn, 1,1
……….%> / / Interact with the database
HTML pages code:
<HTML>
………
<FORM ID=printinfo NAME=printinfo>
<INPUT Type=button value=打å°>> id = print print name => / / Print function call
<INPUT type = hidden id = text1 name = label value = <% =………%>> / / Retention Data transmitted from the server-side………
</ HTML>
Posted on 2006-11-02 22:48 TrampEagle reading (1069) Comments (0) edit collections cited
Tags: java web






