The ultimate cheats for Web printing (grooming)

Source: Internet
Author: User
Tags visibility
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>&nbsp; ');
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;&nbsp;& Nbsp;&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>


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.