Customizable Multiple Elements Printing Plugin With jQuery - printThis

Customizable Multiple Elements Printing Plugin With jQuery - printThis
File Size: 13.2 KB
Views Total:
Last Update:
Publish Date:
Official Website: Go to website
License: MIT

Yet another page printing plugin for jQuery that allows the user to print specific element(s) of your webpage, while preserving the page styles (and even additional CSS) and input/form values.

More features:

  • Auto removes inline styles.
  • Print delay supported.
  • Custom header and page title.


$ npm install print-this

# Bower
$ bower install print-this

How to use it:

1. Place both jQuery library and the jQuery printThis plugin's script right before the closing body tag:

<script src="//"></script>
<script src="printThis.js"></script>

2. Attach the function printThis on any element(s) you want to print.


3. Possible options to customize the printing plugin.


  // shows debug info
  debug: false,

  // import page CSS
  importCSS: true,

  // import styles
  importStyle: false,

  // print outer container
  printContainer: true, 

  // additonal CSS file
  loadCSS: "", 

  // page title
  pageTitle: "",

  // remove inline styles
  removeInline: false, 

  // print delay in ms
  printDelay: 333,

  // header 
  header: null,

  // footer
  footer: null,    

  // preserve input/form values
  formValues: true, 

  // preserve the base tag (if available)
  base: false,

  // copy canvas elements (experimental)
  canvas: false,

  // html doctype
  doctypeString: '<!DOCTYPE html>', 

  // remove script tags before appending
  removeScripts: false,

  // // copy classes from the html & body tag
  copyTagClasses: false    

Change logs:


  • V1.12.2 - Merged fix for top-level Canvas support


  • V1.12.1 - Merged fix for jQuery version limit


  • V1.12.0 - Use clone(true) to copy form values


  • V1.11.0 - Add copyBodyClasses function; Add copyTagClasses


  • V1.10.0 - Added action, disabled by default, to avoid bringing unwanted scripts into the print iframe; Removed undocumented helper function $.fn.outer.


  • V1.9.0 - Canvas updates


  • V1.9.0 - Canvas updates


  • V1.8.0 - Added "footers"


  • Add base URL support and increment version

This awesome jQuery plugin is developed by jasonday. For more Advanced Usages, please check the demo page or visit the official website.