jQuery Plugin To Print Any Part Of Web Page – print

Other
jQuery Plugin To Print Any Part Of Your Page - Print
File Size: 4.44 KB
Views Total: 2345 views
Last Update:April 17, 2024
Publish Date: July 16, 2012
Official Website: Go to website
License: MIT
Plugin Author:
Demo    Download

jQuery Print Plugin helps to print the content of a particular web page. To print contents of a page we have option of directly using ctrl+P but this plugin helps you to implement dynamic functionality like printing the input fields given or the selected content in particular section of the page.

This plugin supports the following unique options:

How to use :

Add a jQuery library and jQuery print plugin.

<script src="jquery.min.js"></script> 
<script src="jQuery.print.js"></script> 

Add an unique ID in your html element where you want to make it printable.

<div id="printable">
Your Content
</div>

Add a button to print the specified html element.

<button class="print"> Print this </button>

Call the plugin on the print button.

<script type='text/javascript'>
$(function() {
$("#printable").find('.print').on('click', function() {
$.print("#printable");
});
});
</script> 

Global Styles
Default: true
Acceptable-Values: Boolean
Function: Whether or not the styles from the parent document should be included
This style is helpful in selecting or not selecting particular element in the page. As George Boole theory, Boolean refers to logic, function, expression. While using this option, “Boolean” may refer to: Boolean data type, a form of data with only two possible values (usually “true” and “false”).

mediaPrint
Default: false
Acceptable-Values: Boolean
Function: Whether or not link tags with media=’print’ should be included; Over-riden by the globalStyles option
This option is dependent on the previously given global style properties and its default given value if false. It is also Boolean data type and can be given true as well.

stylesheet
Default: null
Acceptable-Values: URL-string
Function: URL of an external stylesheet to be included
CSS properties for the given code of the plugin is called using external stylesheet and it helps to design the colors and user interface of the webpage.

noPrintSelector
Default: “.no-print
Acceptable-Values: Any valid jQuery-selector
Function: This function helps to select an item or set of items that are to be excluded from the webpage to be printed. For example if the user wants to print only given input fields then .no-print is used to rest of the page elements which helps to print only input fields, similarly if the user doesnt want to print header or footer part of the page such sections can be exluded.

iframe
Default: true, creates a hidden iframe if no-vaild iframe selector is passed
Acceptable-Values: Any valid jQuery-selector or Boolean
Function: This function decides if we need to print  from a pop-up window or from  a iframe. In the given Boolean value if true is selected, it prints from the iframe and if false is selected it prints from pop-up window. It takes jQuery-selector content from the existing values of the iframe.

append/prepend
Default: null
Acceptable-Values: Any valid jQuery-selector or HTML-text
Function: If user wishes to inser specific content or values before or after the selected content this option is used and this helps to align the sequence order of the content that needs to be printed in the output. This option Adds custom HTML before (prepend) or after (append) the selected content or values. Thus jQuery.print is an essential plugin for a webpage, particularly where we wish to help users print a specific part

Done

Thanks for make jQuery plugin is developed by For more Helpfull for users, please check the demo page or visit the official website.
List Of Version :
  • 1.6.2
  • 1.6.1
  • 1.6.0
  • 1.5.1
  • 1.5.0
  • 1.4.1
  • 1.4.0
  • 1.3.3
  • 1.3.2
  • 1.3.1
  • 1.3.0
  • 1.2.0

Mady

Mady Schaferhoff is an expert jQuery script at jQuerypost. He offers web development services to clients globally. He also loves sharing Html,CSS, jQuery knowledge through blog posts like this one.

Related jQuery Plugins

You Might Also Like