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

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

Hi Igor,
I have debugged the application by following the instructions provided in the link you provided,

I am getting following error : Image

Igor
Posts: 0
Joined: Tue Apr 02, 2013 12:05 pm

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

Hi,

Can you show us JS code from the ipadscreen1.js file lines 360-370 ?

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

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

Hi Igor,
Given below is the code you have asked for :
code
$(document).off("click", '#ipadscreen1_mobilecontainer2 [name="mobilebutton_80"]').on({
click: function() {
if (!$(this).attr('disabled')) { // Get HTML string
var page = document.body.innerHTML;

Code: Select all

                     // Pass the HTML 
                     window.plugin.printer.print(page); 

                 } 
             }, 
         }, '#ipadscreen1_mobilecontainer2 [name="mobilebutton_80"]'); 

/code

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

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

Hi Asif,

Where did you tested your app? Is it .apk or other way?

You can test plugins only when compile app in .apk and install it into device.

http://prntscr.com/3c86s7/direct

In your screenshoot, we can see an error of window.plugin. - there is no object.

So, that means only two things: whether you tested it not as the native app (with installed plugin) or you didn't install plugin correctly.

Please add this following code on the "page show" event to understand whether a plugin was successfully integrated:
precode
alert("window.plugin = " + window.plugin);
alert("window.plugin.printer" + window.plugin.printer);/code/pre
Regards.

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

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

Hi lllya,

I am testing the app using .apk file only on the device.

For first alert, i am getting "window.plugin = undefined"
and for second alert, i m getting "Uncaught TypeError: Cannot read property 'printer' of undefined "

Illya Stepanov
Posts: 0
Joined: Mon Mar 18, 2013 8:48 am

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

Hi Asif.

precode
"window.plugin = undefined"/code/pre
It means: plugin did't inited correctly.

Please share your app with us.

Regards.

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

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

Hi lllya,
I have shared my app with 'a href="mailto:support@appery.io" rel="nofollow"support@appery.io/a'. Name of the app is 'POS'

Nikita
Posts: 0
Joined: Fri Feb 28, 2014 4:02 pm

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

Hi,

In Printer.java change row
packet de.appplant.cordova.plugin.printer;
on
packet com.phonegap.plugins.printer;

And rename folder "de.appplant.cordova.plugin.printer" on "com.phonegap.plugins.printer" (folder contains www/printer.js)

In file cordova_plugins.js change rows that include plugin on next rows
{
"file": "plugins\com.phonegap.plugins.printer\www\printer.js",
"id": "com.phonegap.plugins.Printer",
"clobbers": [
"Printer"
]
}

And try create event on any button click with such code
alert("window.plugin = " + window.plugin);

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

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

Hi Nikita,
I have made changes which you have mentioned,but still i m getting same error

code
window.plugin= undefined
/code

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,

You have included plug-in correctly. Try using this function:prewindow.plugin.print (...)/pre

Return to “Issues”