Jquery printing plug-in jqprint for web Front-end printing

Source: Internet
Author: User

Web printing methods are as follows:

1. JQuery plug-in Jqprint implementation
2. JQery printing plug-in PrintArea for web page Printing
3. CSS controls the webpage printing Style

JQuery plug-in Jqprint implementation:
First, import the js file:
Download jquery. jqprint. js
Copy codeThe Code is as follows:
<Script language = "javascript" src = "jquery-1.7.1.min.js"> </script>
<Script language = "javascript" src = "jquery. jqprint. js"> </script> html code:

Copy codeThe Code is as follows:
<Div class = "my_show">
This is displayed during printing.
</Div>
<Div class = "my_hidden">
This is hidden during printing.
</Div>
<Input type = "button" id = "print"/>

Javascript code:
Copy codeThe Code is as follows:
<Script type = "text/javascript">
$ (Document). ready (function (){
$ ("# Print"). click (function (){
$ (". My_show"). jqprint ();
})
});
</Script>

The plug-in also provides some configurable parameters:
Debug: false, // if it is true, the iframe display effect can be displayed (iframe defaults to very small height and width, and can be adjusted in the source code). The default value is false.
ImportCSS: true, // true indicates that the css of the original page is imported. The default value is true. (If it is true, $ ("link [media = print]") is first found. If it is not true, the css file in $ ("link") is not found)
PrintContainer: true, // indicates that if the selected object must be included in the print (Note: setting it to false may break your CSS rules ).
OperaSupport: true // indicates that if the plug-in must also support the operabrowser, it provides a temporary print tab. The default value is true.
I only use importCSS: the link on the original page will be imported to iframe. For the first time, the media searchs = print. If not, the normal css file will be imported.

ImportCSS example:
Copy codeThe Code is as follows:
$ ('. My_show'). jqprint ({
ImportCSS: // CSS Style File
});

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.