Using Jquery Jqprint to print web pages, jqueryjqprint

Source: Internet
Author: User
Tags comparable

Using Jquery Jqprint to print web pages, jqueryjqprint

Today, I have studied the Jquery Jqprint plug-in with free time. Using this Jquery script, you can easily print content in a specified area of a webpage:

Example 1:

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Strict // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 

Example 2:

<! DOCTYPE html PUBLIC "-// W3C // dtd xhtml 1.0 Strict // EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 

(The above two examples need jquery-1.6.2.js and 1jquery. jqprint-0.3.js two files, the two files can be found in the download resources below, tested, the print plug-in can support all mainstream browsers.

Download resources at 0 Points]


Jquery or js calls the adobe print plug-in to print the specified html Area

A. Use JS's window. print (); to achieve the simplest
B. Because this method prints all pages, you must replace the whole page with the content to be printed. After printing, replace it with the following:
Var bodyhtml###doc ument. body. innerHTML;
Registry.document.body.innerhtml##('{xxx'{.html ();
Window. print ();
Too many Doc ument. body. innerHTML = bodyHTML;

For example, I want to print this image.

After this method is executed:




JqueryPrintAreajs can only be used for partial printing, but does not support print preview and print settings?

Print preview is provided by the browser, and print settings are printer. JS is not omnipotent.
I know that you want to set preview pages, margins, and other things, but JS has limited operation permissions on the computer and cannot control too many things, unless you are solely targeting ie browsers.
In addition, we recommend that you do not rely too much on the JS package of external integration. You 'd better make a print style or a page for printing.

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.