Click here to Skip to main content
15,890,897 members
Please Sign up or sign in to vote.
2.60/5 (2 votes)
See more:
I have created a aspx page in vs 2012 with print button but i want whenever i click the print button it will give the print out without giving the print option. is there any way to avoid the print option because i am having problem whenever i used it from my mobile. my mobile is connected with printer through bluetooth. please help.
Posted
Comments
Suvabrata Roy 11-Jun-14 0:37am    
if your mobile is connected with printer via bluetooth then just choose the printer and give print.
Member 10551326 11-Jun-14 0:52am    
Having problem when print dialogue box appear, i want to avoid it, when i will click print it will give me the print out without giving the dialogue box or print option.
Suvabrata Roy 11-Jun-14 1:38am    
Ok

Try this : http://forums.asp.net/t/1751503.aspx?Directly+Print+to+printer+using+javascript+[^]

You can also use this script to do the same
JavaScript
if (navigator.appName == "Microsoft Internet Explorer")
{
var PrintCommand = '<object id="PrintCommandObject" width="0" height="0<br" mode="hold" />CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2">';
document.body.insertAdjacentHTML('beforeEnd', PrintCommand);
PrintCommandObject.ExecWB(6, -1); PrintCommandObject.outerHTML = "";
}
else {
window.print();
}


For Mozilla : http://forums.mozillazine.org/viewtopic.php?t=48336
 
Share this answer
 
Comments
Suvabrata Roy 11-Jun-14 2:46am    
why down voted?
The root of the problem is forcing printing, while your user knows better when, what and how to print. The problem is that many Wen pages are not suitable for printing, and some should produce printout per special requirements (like in case with bills and other formal documents). There is an elegant and legitimate solution based on @media CSS elements.

For basic ideas, please see my past answers:
Print Functionality in JavaScript[^],
How to Print a Invoice[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900