Complete page printing using the Jqprint plugin

Source: Internet
Author: User

Complete page printing using the Jqprint plugin

Jqprint is a jquery-based page printing of a small plug-in, but have to admit that the plug-in is really very powerful, recent projects to help me, in the aspect of Web printing, the front-end printing is basically by window.print () way to print, And this plugin on the basis of a further package, you can print a page on a region, which is a bright spot. For example, now you want to print one of the following effects:


We can do this by writing code, and then click on a button on the page, call Jqprint () in the processing method of the button, to complete the operation of this area of the print display, first to obtain the area, and then call a method, as follows:

$ ("#visaReport"). Jqprint ({});

This is a simple operation, but the actual need, sometimes our page display style and our printed style is somewhat different, fortunately, CSS declaration of the place provides a media property, we can specify its output as print, that is, media=print this property, After writing this property, some of the styles introduced in the CSS will only take effect when printed, and by the time we print, we can change the display of the current page and the style of the display. Let's look at the code first!

<! DOCTYPE html>

Now the style of the page in the page is this:


And the printed effect is the first image of the style, this is the specified Media=print this property, printing will be loaded when a CSS file is configured. As shown below:

<link href= "Printshou.css" rel= "stylesheet" type= "Text/css" media= "print"/>

Jqprint This plugin can solve most of our development, Web page printing problems, print style is also controllable. Sometimes it is necessary for us to specify some properties to complete the desired effect by default there are four properties as follows:

{              debug:false,//can display the IFRAME view effect if it is true (the IFRAME default height and width are very small, can be increased in the source code), the default is False              Importcss:true,// True indicates that the CSS that introduced the original page is true by default. (If True, the $ ("Link[media=print") will be found first, if not, the CSS file in the $ ("link") will be found              printcontainer:true,// Indicates that if the original selected object must be included in the print (note: setting to false may break your CSS rules).              operasupport:true//indicates that if the plugin must also support the Opera browser, in this case it provides a temporary print tab. The default is True}

If in the development of the project, is not required too high, I think through this plugin can solve some of the printing problems we are currently experiencing. The operation of this plugin is also very simple, through this plugin, most of the page, we can follow the desired style print out.


Complete page printing using the Jqprint plugin

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.