Asif
Posts: 0
Joined: Tue Aug 13, 2013 12:56 pm

How to do print currnt page when click on Print button.

Hi Maryna,
As u said i have given parameters to window.open() function

And i also go through the link you provided

where i saw this line
var ref= window.open('next.html','_self');

which means i can pass local html also in 'inAppBrowser'

So now i have written this code
pre
function printClick() {
//nextHtml.html is a blank html file which i have manually created in the webresources
var w = window.open('nextHtml.html','_self');
var html = $("#ipadscreen1_mobilegrid_119").html();
// how do I write the html to the new window with JQuery?
$(w.document.body).html(html);
}
/pre

Now in this code what i m doing is that first i m opening nextHtml file in a browser and then i m writing "ipadscreen_mobilegrid_119" in its body.

but when i ran this code in android device it does not find nextHtml file

then I use this code
pre
var ref = window.open('file:///android_asset/www/nextHtml.html','_self');
/pre

when i ran this code a blank page opens along with an error in the eclipse :
pre
cannot read property 'body' of undefined
/pre

so please let me know how will i pass this "nextHtml" file in window.open browser and then how to write content in it.

Evgene Karachevtsev
Posts: 12
Joined: Mon Apr 28, 2014 1:12 pm

How to do print currnt page when click on Print button.

Hello,

Sorry for delay, you should keep this
prevar html = $("#ipadscreen1_mobilegrid_119").html();/pre
in local storage
prelocalStorage.setItem("html", $("#ipadscreen1_mobilegrid_119").html());/pre
Add eventListener for inAppBrowser on loadstop page like here:
http://docs.phonegap.com/en/3.3.0/cor... and in the function you should run code
pre$("body").html(localStorage.getItem("html"));/pre

Amith Reddy
Posts: 0
Joined: Wed Aug 06, 2014 5:48 am

How to do print currnt page when click on Print button.

can u share me the steps for adding cordova printer plugin into appery

Return to “Issues”