From d43c959301df4c96a3b4c1c288498acaa6f19091 Mon Sep 17 00:00:00 2001 From: dhruvenshah Date: Thu, 18 May 2017 15:46:32 -0700 Subject: [PATCH] Print Preview is blank if there are more than 30 pages, so wait for document ready state complete --- js/jquery.printarea.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/js/jquery.printarea.js b/js/jquery.printarea.js index 9713ea3..a073f00 100644 --- a/js/jquery.printarea.js +++ b/js/jquery.printarea.js @@ -60,7 +60,15 @@ PrintArea.write( PrintAreaWindow.doc, $printSource ); - setTimeout( function () { PrintArea.print( PrintAreaWindow ); }, 1000 ); + printFunc = function(PrintAreaWindow){ + if(PrintAreaWindow.doc.readyState === 'complete'){ + PrintArea.print( PrintAreaWindow ); + } + else{ + setTimeout( function () { printFunc( PrintAreaWindow ); }, 1000 ); + } + } + printFunc(PrintAreaWindow); }; var PrintArea = {