From e52ea86512aad8e7c338aadf3e7b8888248b2ff7 Mon Sep 17 00:00:00 2001 From: Sathvik P Date: Wed, 18 Jul 2012 14:50:55 +0530 Subject: [PATCH] Added iframe based printing support --- jQuery.print.js | 154 ++++++++++++++++++++++++++++-------------------- 1 file changed, 89 insertions(+), 65 deletions(-) diff --git a/jQuery.print.js b/jQuery.print.js index e201729..c5503e3 100644 --- a/jQuery.print.js +++ b/jQuery.print.js @@ -6,9 +6,7 @@ (function($) { // A nice closure for our definitions - console.log($, $.fn); - - $.fn.print = function() { + $.print = $.fn.print = function() { // Print a given set of elements var options, $this; @@ -59,7 +57,8 @@ } if (options.stylesheet) { // Add a custom stylesheet if given - styles = $.merge(styles, $('')); + styles = $.merge(styles, $('')); } var copy = $this.clone(); // Create a copy of the element to print @@ -71,21 +70,31 @@ var content = copy.html(); copy.remove(); - var w; + var w, wdoc; if (options.iframe) { // Use an iframe for printing - $iframe = $(options.iframe); - iframeCount = $iframe.length; - if (iframeCount === 0) { - // Create a new iFrame if none is given - $iframe = $('