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.