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

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

Hi Levgen,
Thanks for you help.
I have made changes in the id field and now i m not getting any error but when i click on the button to execute my code nothing is happening and i m getting this warning:
code
05-01 00:40:29.297: W/PluginManager(25023): THREAD WARNING: exec() call to Printer.print blocked the main thread for 45ms. Plugin should use CordovaInterface.getThreadPool().
05-01 00:40:39.427: D/webview(25023): blockWebkitViewMessage= false

/code

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

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

I think it is working now
thanks a lot for your support..!!

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

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

Hi,
I have tried the print plugin for giving print from the app but i got stuck after calling third party printing apps. So what i have thought that i will save my page content as an html file and then open it in app browser and then with normal window.print i'll take a print.

Please let me know if it is doable and how to do it..

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

Hi Asif,

This plug-in works with a third-party app that you specify when call print() (https://github.com/katzer/cordova-plu...). You can also use usual window.print() (https://developer.mozilla.org/en-US/d...) but note it works only in browser, not on device.

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

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

Hi Katya,
I know that this plugin works with the third party app. When i call print () from my app, it opens the third party app which i have specified but after that nothing happens. Some of the the app does not even open and it crashes my app also. Only one app opens successfully which is Bluetooth Smart Printing, but this app is also not scanning the printer, So finally i thought of not using this plugin.
Some app gives error as invalid intent or some says internal error.

Now what i am thinking is that i'll save my invoice as html page and open it in a new phone browser then with window.print() function i'll give a print.

If you have successfully used the plugin than please guide me with that otherwise let me know if the second option is doable or not.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

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

Hi Asif,

Please try using another plug-in. You can also use Google cloud print.
http://stackoverflow.com/questions/19...
http://www.badrit.com/blog/2014/1/28/...

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

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

Hi Katya,
This plugin is almost same as the old one.

I have written a code to open my print content on a new page(browser)
pre
function printClick() {
var w = window.open();
var html = $("#ipadscreen1_mobilegrid_119").html();

// how do I write the html to the new window with JQuery?
$(w.document.body).html(html);

}
/pre

This code is working in browser but when i am doing it from the app, next window opens but the page is coming with following message
"The Web page at null might be temporarily down or it may have moved permanently to a new web address."

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

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

Hello Asif,

Could you please try to use inAppBrowser for devices: http://devcenter.appery.io/tutorials/...

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

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

Hi Evgene,
I thought of using inAppBrowser, but i need to pass a url to it, and in my case i have the html content not the url,
If you can show me an example of inAppBrowser with html content as input parameter then it would be a great help
thanks..!!

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

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

Hello!

Sorry, we don't have example unfortunately. There is an error because you missed url parameter in request prewindow.open();/preHere is more information http://cordova.apache.org/docs/en/3.3...

Return to “Issues”