如何在Asp.Net C中避免打印选项# [英] How Can I Avoid Print Option In Asp.Net C#

查看:83
本文介绍了如何在Asp.Net C中避免打印选项#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在vs 2012中创建了一个带有打印按钮的aspx页面,但我希望每当我点击打印按钮时它都会在不给出打印选项的情况下打印出来。是否有任何方法可以避免打印选项,因为每当我从手机上使用它时我都会遇到问题。我的手机通过蓝牙与打印机连接。请帮助。

解决方案

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



您也可以使用此脚本执行相同的操作

  if  navigator  .appName ==   Microsoft Internet Explorer
{
var PrintCommand = ' < object id =PrintCommandObjectwidth =0height =0< brmode =hold/> CLASSID =CLSID:8856F961-340A-11D0-A96B-00C04FD705A2>';
document .body.insertAdjacentHTML(' beforeEnd ',PrintCommand);
PrintCommandObject.ExecWB( 6 , - 1); PrintCommandObject.outerHTML = ;
}
else {
window .print();
}





对于Mozilla:http://forums.mozillazine.org/viewtopic.php?t = 48336


问题的根源是强制打印,而您的用户更了解何时,何地以及如何打印。问题是许多Wen页面不适合打印,有些应该根据特殊要求(例如票据和其他正式文档)进行打印输出。有一个基于@media CSS元素的优雅和合法的解决方案。



基本想法,请看我过去的答案:

JavaScript中的打印功能 [ ^ ],

如何打印发票 [ ^ ]。



-SA

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.

解决方案

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

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


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


这篇关于如何在Asp.Net C中避免打印选项#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆