A variety of front-end printing methods of the Web jquery print plug-in jqprint implementation of Web page printing _jquery

Source: Internet
Author: User
The way to print the web I know it by myself:

1, jquery plug-in Jqprint implementation
2, jqery Print plug-in PrintArea to achieve web page printing
3, CSS control page print style

jquery plugin Jqprint Implementation
First you want to import the JS file:
Jquery.jqprint.js Download
Copy Code code as follows:

<script language= "javascript" src= "Jquery-1.7.1.min.js" ></script>
<script language= "javascript" src= "Jquery.jqprint.js" ></script>html Code:

Copy Code code as follows:

<div class= "My_show" >
This print is displayed.
</div>
<div class= "My_hidden" >
This print is hidden.
</div>
<input type= "button" id= "Print"/>

JavaScript code
Copy Code code as follows:

<script type= "Text/javascript" >
$ (document). Ready (function () {
$ ("#print"). Click (function () {
$ (". My_show"). Jqprint ();
})
});
</script>

The plug-in also provides some parameters to configure:
debug:false,//If True, you can display the IFrame view effect (iframe default high and wide are very small, can be adjusted in the source code), the default is False
Importcss:true,//true represents the introduction of the original page CSS, the default is true. (If it is true, the $ ("Link[media=print]") is found first, if no will go to the CSS file in $ ("link")
printcontainer:true,//indicates that if the object originally selected must be printed (note: setting to false may break your CSS rules).
operasupport:true//says if the plugin must also support the Opera browser, in this case it provides a temporary print tab. The default is True
And I use only importcss: the links in the original page will be imported into the IFRAME. The first time it media searchs = print, if not, the normal CSS file will be imported.

Importcss Sample
Copy Code code as follows:

$ ('. My_show '). Jqprint ({
Importcss://css Style File
});

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.