Home > Web Front-end > JS Tutorial > body text

Various front-end printing methods on the web: jquery printing plug-in jqprint realizes web page printing_jquery

WBOY
Release: 2016-05-16 17:44:02
Original
2277 people have browsed it

The web printing methods that I know are:

1. JQuery plug-in Jqprint implementation
2. JQery printing plug-in PrintArea to implement web page printing
3. CSS control web page printing style

JQuery plug-in Jqprint implementation:
First import the js file:
jquery.jqprint.js download

Copy code The code is as follows:

html code:

Copy code The code is as follows:


This is displayed when printing
< ;/div>

This is hidden when printing.



javascript code:
Copy code The code is as follows:



The plug-in also provides some configurable parameters:
debug: false,//If true, the iframe viewing effect can be displayed (iframe default The height and width are very small and can be increased in the source code), the default is false
importCSS: true, //true means importing the css of the original page, the default is true. (If it is true, it will first look for $("link[media=print]"), if not, it will look for the css file in $("link"))
printContainer: true, // means if the original selection The object must be included in printing (note: setting to false may break your CSS rules).
operaSupport: true//Indicates that if the plug-in must also support the opera browser, in this case, it provides the creation of a temporary printing tab. The default is true
and I only use importCSS: links in the original page will be imported into the iframe. The first time it prints media searches = print, if not, the normal css file will be imported.

importCSS example:
Copy code The code is as follows:

$('.my_show').jqprint({
importCSS://CSS style file
});
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!