Printing from browser

General discussion forum about all things TD Mobile
FRBhote
India
Posts: 34
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Printing from browser

Post by FRBhote » 18 Mar 2017, 05:06

How can I print directly from browser on a PC?

If not, what is the best method?

a_sivababu
India
Posts: 8
Joined: 10 Mar 2017, 08:46
Location: Chennai,India

Re: Printing from browser

Post by a_sivababu » 19 Mar 2017, 04:28

AFAIK, The Javascript window.print might be used for printing HTML web but not sure whether your requirement is something different.

FRBhote
India
Posts: 34
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Printing from browser

Post by FRBhote » 20 Mar 2017, 04:56

Thanks - I had forgotten about the html print. Kept thinking of PDF only.

FRBhote
India
Posts: 34
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Printing from browser

Post by FRBhote » 20 Mar 2017, 07:02

Is there a way to figure out whether the system is running on a PC or a phone?

FRBhote
India
Posts: 34
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Printing from browser

Post by FRBhote » 20 Mar 2017, 07:02

Is there a way to figure out whether the system is running on a PC or a phone?

a_sivababu
India
Posts: 8
Joined: 10 Mar 2017, 08:46
Location: Chennai,India

Re: Printing from browser

Post by a_sivababu » 20 Mar 2017, 12:36

I think we can go with resolution but we have to do some testing and correct the code accordingly.

For eg, to check resolution for phone.

IsPhoneSize: function() {
var w,h;
w=widow.screen.width;
h=window.screen.height;
return ( w <= 480);
}

We may need to check different solution to support from small form factor to large farm factor.


To check for devices, indexof() or match() can be used


isAndroid: function() {
return (navigator.userAgent.tolowercase().indexOf("android") > -1)
}


var isMobile = {
Android: function() {
return navigator.userAgent.match(/Android/i);
},
BlackBerry: function() {
return navigator.userAgent.match(/BlackBerry/i);
},
iOS: function() {
return navigator.userAgent.match(/iPhone|iPad|iPod/i);
},
Opera: function() {
return navigator.userAgent.match(/Opera Mini/i);
},
Windows: function() {
return navigator.userAgent.match(/IEMobile/i);
},
any: function() {
return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
}
};

FRBhote
India
Posts: 34
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Printing from browser

Post by FRBhote » 21 Mar 2017, 05:09

Bigger problem. Window.print( ) opens the print dialog box.

Very difficult to have a POS with a dialog box.

FRBhote
India
Posts: 34
Joined: 09 Mar 2017, 05:32
Location: Hyderabad, India

Re: Printing from browser

Post by FRBhote » 06 Apr 2017, 12:16

I accept the dialog box, but if I call window.print immediately after the RunReport, it is called before the report is done.

Since RunReport does not return anything, how would I know that the report is complete?

a_sivababu
India
Posts: 8
Joined: 10 Mar 2017, 08:46
Location: Chennai,India

Re: Printing from browser

Post by a_sivababu » 09 Apr 2017, 14:59

I have tried TDM a quite back but need to check it to recall. I think CallBack mechanism might not implemented for RunReport like Invoke with Indentation.

Not sure whether below work around is ok but just thought since RunReport will not have Indentation (CallBack) but Invoke has.

RunReport<Name>
Invoke <Dummy with some status>
JavaScript <<window.print function>

Return to “General Discussion”

Who is online

Users browsing this forum: Ccbot [Crawler] and 0 guests