Ultimate cheats for web printing (collation)

Source: Internet
Author: User
Http://www.meadroid.com/scriptx/usually requires scriptx. Cab in web printing. The same is true here, so the principles are the same. Here we will detail how to control the printing problem.

You can print two required files:

1: configuration file: Setting. js
2: display file: print. js

Setting. JS is as follows:

Document. write ("<Object ID =/" Factory/"style =/" display: NONE/"viewastext classid =/" CLSID: 1663ed61-23eb-11d2-b92f-008048fdd814/"codebase =/" images/events/scriptx. cab # version = 0,360,/"> </Object> ");
Function printers (){
Agree = confirm ('Are you sure you want to print? ');
If (agree ){
If (agree)
{
Noprinter. style. Visibility = 'hiddy ';
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 print. js file is displayed as follows:

Document. Write ('<style media = "print"> @ Media Print {. noprint {display: None }}</style> ');
/////////////////////////////////~~ Controls the style of buttons not displayed during printing. You only need to reference this style when you do not need to print it on the page.
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; </div> ');

When using the print function, you only need to include the two files in the place where the print button is placed on the page. 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 essential: Web Printing code Daquan this article mainly introduces how to use ASP to control various web printing effects, it can control vertical, horizontal, and page margins.

[Blocked ads] 1. Control "vertical", "horizontal", 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"
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 settings
Wb.exe CWB (8, 1 );
}
Function printpreview (){
// Print the Page Preview
  
Wb.exe CWB (7,1 );
  
  
}

Function printit ()
{
If (confirm ('Are you sure you want to print? ')){
Wb.exe CWB (6, 6)
}
}
</SCRIPT>
</Head>
<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.