Http://www.meadroid.com/scriptx/usually need scriptx.cab in Web printing, and here is the same, so the principle is the same, here is going to explain in detail, how to control the printing problem.
There are 2 required documents to print:
1: Configuration file: Setting.js
2: Display file: Print.js
Setting.js as follows:
document.write ("<object id=/" factory/"style=/" display:none/"Viewastext classid=/" clsid : 1663ed61-23eb-11d2-b92f-008048fdd814/"codebase=/" images/events/scriptx.cab#version=5,60,0,360/"></ Object> ");
function Printers () {
Agree = confirm (' OK to print? ');
if (agree) {
if (agree)
{
noprinter.style.visibility= ' hidden ';
Factory.printing.Print ();}
else noprinter.style.visibility= ' visible ';
}
}
Factory.printing.header = ""
Factory.printing.footer = ""
Factory.printing.leftMargin = 0.75
Factory.printing.topMargin = 0.75
Factory.printing.rightMargin = 0.75
Factory.printing.bottomMargin = 0.75
The display file Print.js is as follows:
document.write (' <style media= ' print ' > @media print {. Noprint{display:none}} </style> ');
~ ~ Control does not show the style of the button when printing, only need to refer to the style where the page does not need to print
document.write (' <div id=noprinter name=noprinter align=right style= ' visibility:visible ' class= ' noprint ' >< br> ');
document.write (' <input Type=button class=button value= close name= "BFQ" id= "BFQ" onclick=/"Javascript/:window.close () /">");
document.write (' <input type= ' button "value=" Print Settings "onclick=/" Factory.printing.PageSetup ()/">");
document.write (' <input type= ' button "value=" Print Preview "onclick=/" Factory.printing.Preview ()/">");
document.write (' <input type=button name=button3 value= ' print ' onclick= ' Printers () ' > & Nbsp; </div> ');
When using the print function, simply include the file 2 files in the page where the Print button is placed, the code is as follows:
<script src= ". /inc/print/printer.js "></script>
<script src= ". /inc/print/printers.js "></script>
Trackback:http://tb.blog.csdn.net/trackback.aspx? postid=322954 ASP Development Prerequisites: Web Printing Code Daquan ASP Development Prerequisites: Web Printing Code Daquan This article mainly introduces how to use ASP to control the Web's various printing effects, it can control the vertical, horizontal and page margin.
[Blocked ads] 1, control "vertical hit", "Horizontal hit" and "margin of the page."
(1)
|
<script defer> Function setprintsettings () { //--Advanced F eatures 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" F Actory.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 = "Ad vanced Printing by ScriptX " factory.printing.portrait = false Factory.printing.leftMargin = 1.0&nb Sp Factory.printing.topMargin = 1.0 Factory.printing.rightMargin = 1.0 Factory.printing.bottomM Argin = 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> |