This plugin shows a print preview of the current page in a modal window. It's inspired from the jQuery Print Preview plugin.
The plugin also tries to capture the "CTRL + P" and "Command + P" keybindings. The modal window is shown when you press the keys for the first time. Pressing the keys while the modal is opened will open the print window of the browser. Unlike traditional print previews this plugin brings in all content and print styles within a modal window.
The icons used in the plugin were taken from the FatCow Web Hosting Icon Set.
In order to use this plugin you must insert into the page the followings:
- The jQuery script file;
- The plugin file;
- The plugin dependencies: CSS file and sprite image.
You can initialize the plugin by calling pagePrint function on any jQuery collection.
Example:
$('<a href="#">Print this page</a>').prependTo('body').css({position: 'absolute', top: 0}).pagePrint();
.
Demo:
You can see a demo here.
The following config options can be sent when calling the plugin:
- backgroundColor: the background color of the opened modal window (default: '#fff');
- baseCls: the base CSS class to apply to this widget elements (default: 'page-print');
- destroyOnHide: clean the DOM of the created elements and events (default: false);
- opacity: opacity of the modal window mask (default: 0.75);
- paperMargin: the paper margin (default: '1cm');
- paperWidth: the paper width (default: '19cm');
- zIndex: z-index of the modal window and mask (default: 10000);
- Internet Explorer 7, 8 and 9
- Google Chrome
- Firefox
- Opera
Licensed under the MIT license.