All Projects → jasonday → Printthis

jasonday / Printthis

Licence: mit
jQuery printing plugin; print specific elements on a page

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Printthis

Jquery.print
Easy to use, Element Printing Plugin for jQuery
Stars: ✭ 772 (-14.41%)
Mutual labels:  print, jquery
Selectpage
A simple style and powerful selector, including ajax remote data, autocomplete, pagination, tags, i18n and keyboard navigation features
Stars: ✭ 679 (-24.72%)
Mutual labels:  jquery-plugin, jquery
Isinviewport
An ultra-light jQuery plugin that tells you if an element is in the viewport but with a twist.
Stars: ✭ 646 (-28.38%)
Mutual labels:  jquery-plugin, jquery
Tableexport
The simple, easy-to-implement library to export HTML tables to xlsx, xls, csv, and txt files.
Stars: ✭ 781 (-13.41%)
Mutual labels:  jquery-plugin, jquery
Push State
Turn static web sites into dynamic web apps.
Stars: ✭ 16 (-98.23%)
Mutual labels:  jquery-plugin, jquery
Form2js
Javascript library for collecting form data
Stars: ✭ 630 (-30.16%)
Mutual labels:  jquery-plugin, jquery
Jquery Powertip
💬 A jQuery plugin that creates hover tooltips.
Stars: ✭ 822 (-8.87%)
Mutual labels:  jquery-plugin, jquery
Paroller.js
Parallax scrolling jQuery plugin
Stars: ✭ 535 (-40.69%)
Mutual labels:  jquery-plugin, jquery
Jquery Selectric
jQuery plugin for easy manipulation and customization of HTML selects
Stars: ✭ 724 (-19.73%)
Mutual labels:  jquery-plugin, jquery
Animatescroll.js
A Simple jQuery Plugin for Animating Scroll
Stars: ✭ 708 (-21.51%)
Mutual labels:  jquery-plugin, jquery
Jcanvas
A jQuery plugin that makes the HTML5 canvas easy to work with.
Stars: ✭ 612 (-32.15%)
Mutual labels:  jquery-plugin, jquery
Trip.js
🚀 Trip.js is a plugin that can help you customize a tutorial trip easily with more flexibilities.
Stars: ✭ 789 (-12.53%)
Mutual labels:  jquery-plugin, jquery
Form
jQuery Form Plugin
Stars: ✭ 5,122 (+467.85%)
Mutual labels:  jquery-plugin, jquery
Jquery Smartwizard
The awesome jQuery step wizard plugin
Stars: ✭ 635 (-29.6%)
Mutual labels:  jquery-plugin, jquery
Bootstrap Fileinput
An enhanced HTML 5 file input for Bootstrap 5.x/4.x./3.x with file preview, multiple selection, and more features.
Stars: ✭ 5,097 (+465.08%)
Mutual labels:  jquery-plugin, jquery
Rowgrid.js
A small, lightweight JavaScript plugin for placing items in straight rows (jQuery and vanilla JS version) – Demo:
Stars: ✭ 670 (-25.72%)
Mutual labels:  jquery-plugin, jquery
Jquery Cropper
A jQuery plugin wrapper for Cropper.js.
Stars: ✭ 516 (-42.79%)
Mutual labels:  jquery-plugin, jquery
Jquery.sumoselect
A jQuery Single/Multi Select plugin which can be used on almost any device
Stars: ✭ 527 (-41.57%)
Mutual labels:  jquery-plugin, jquery
Stupid Table Plugin
A stupidly small and simple jQuery table sorter plugin
Stars: ✭ 704 (-21.95%)
Mutual labels:  jquery-plugin, jquery
Jquery Drawsvg
Lightweight, simple to use jQuery plugin to animate SVG paths
Stars: ✭ 759 (-15.85%)
Mutual labels:  jquery-plugin, jquery

Financial Contributors on Open Collective npm version

printThis

Printing plug-in for jQuery

Try the Demo

Features

  • Print specific & multiple DOM elements
  • Preserve page CSS/styling ** or add new CSS; the world is your oyster!
  • Preserve form entries
  • Canvas support

Usage

Basic

$('selector').printThis();

Advanced Features

$('#kitty-one, #kitty-two, #kitty-three').printThis({
    importCSS: false,
    loadCSS: "",
    header: "<h1>Look at all of my kitties!</h1>"
});

Troubleshooting

Check the printThis wiki for common issues and questions

Covers common issues related to styling and printing limitations regarding page breaks

Options

Now with TypeScript definitions.

debug

Debug leaves the iframe visible on the page after printThis runs, allowing you to inspect the markup and CSS.

importCSS

Copy CSS <link> tags to the printThis iframe. On by default.

importStyle

Copy CSS <style> tags to the printThis iframe. Off by default.

printContainer

Includes the markup of the selected container, not just its contents. On by default.

loadCSS

Provide a URL for an additional stylesheet to the printThis iframe. Empty string (off) by default.

pageTitle

Use a custom page title on the iframe. This may be reflected on the printed page, depending on settings. Blank by default.

removeInline

Eliminates any inline style attributes from the content. Off by default.

removeInlineSelector

Filter which inline style attributes to remove. Requires removeInline to be true. Accepts custom CSS/jQuery selectors. Default is "*"

printDelay

The amount of time to wait before calling print() in the printThis iframe. Defaults to 333 milliseconds. Appropriate values depend heavily on the content and network performance. Graphics heavy, slow, or uncached content may need extra time to load.

header & footer

A string or jQuery object to prepend or append to the printThis iframe content. null by default.

$('#mySelector').printThis({
    header: "<h1>Amazing header</h1>"
});

$('#mySelector').printThis({
    footer: $('.hidden-print-header-content')
});

As of 1.9.1, jQuery objects are cloned rather than moved.

base

The base option allows several behaviors. By default it is false, meaning a the current document will be set as the base URL.

If set to true, a <base> attribute will be set if one exists on the page. If none is found, the tag is omitted, which may be suitable for pages with Fully Qualified URLs.

When passed as a string, it will be used as the href attribute of a <base> tag.

formValues

This setting copies the current values of form elements into the printThis iframe. On by default.

canvas

As of 1.9.0 you may be able to duplicate canvas elements to the printThis iframe. Disabled by default. This has received only limited testing and so may not work in all browsers and situations.

As of 1.12.2 you can call printThis directly on a canvas element.

doctypeString

A doctype string to use on the printThis iframe. Defaults to the HTML5 doctype.

removeScripts

Deletes script tags from the content to avoid errors or unexpected behavior during print. Disabled by default.

copyTagClasses: false

Copies classes from the body and html tags into the printThis iframe.
Accepts true or test for the strings "b" and "h" for the body and html tags, respectively.
Disabled by default.

beforePrintEvent: null

Function to run inside the iframe before the print occurs.
This function has not been validated on all browsers.

beforePrint: null

Function called before the iframe is populated with content.

afterPrint: null

Function called after the print and before the iframe is removed from the page.
This is called even if debug: true, which does not remove the iframe.

All Options

$("#mySelector").printThis({
    debug: false,               // show the iframe for debugging
    importCSS: true,            // import parent page css
    importStyle: false,         // import style tags
    printContainer: true,       // print outer container/$.selector
    loadCSS: "",                // path to additional css file - use an array [] for multiple
    pageTitle: "",              // add title to print page
    removeInline: false,        // remove inline styles from print elements
    removeInlineSelector: "*",  // custom selectors to filter inline styles. removeInline must be true
    printDelay: 333,            // variable print delay
    header: null,               // prefix to html
    footer: null,               // postfix to html
    base: false,                // preserve the BASE tag or accept a string for the URL
    formValues: true,           // preserve input/form values
    canvas: false,              // copy canvas content
    doctypeString: '...',       // enter a different doctype for older markup
    removeScripts: false,       // remove script tags from print content
    copyTagClasses: false,      // copy classes from the html & body tag
    beforePrintEvent: null,     // function for printEvent in iframe
    beforePrint: null,          // function called before iframe is filled
    afterPrint: null            // function called before iframe is removed
});

Please read

  • "It's not working" without any details is not a valid issue and will be closed
  • A url, or html file, is necessary to debug. Due to the complexities of printing and this plugin, an example is the best way to debug
  • When troubleshooting, set debug: true and inspect the iframe. Please report your findings when reporting an issue
  • Every user should be active in the debugging process

ToDo:

  • Look at alternative to setTimeout ($.deferred?)

Contributors

Code Contributors

This project exists thanks to all the people who contribute. [Contribute].

Financial Contributors

Become a financial contributor and help us sustain our community. [Contribute]

Individuals

Organizations

Support this project with your organization. Your logo will show up here with a link to your website. [Contribute]

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].