关于asp.net打印功能问题

小曾杰哥 2015-03-02 11:09:33
请教大神问题:
asp.net 调用ScriptX插件, 在单独一个html页面做测试时能直接打印(点击[打印]按钮,打印机直接运行) , 但当我把这个html放到.net项目里面后就会弹出选择打印机的界面.这是什么原因?
下面是html页面代码:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>打印</title>
</head>
<body>

<object id="factory" viewastext style="display:none"
codeBase="scriptx/ScriptX.cab#Version=6,1,429,14"
classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814">
</object>

<form id="form1" runat="server">
<input type="button" id="cmdPRINT" onclick="printReport()" value="打印" />
<input type="button" id="butColes" onclick="window.close();" value="关闭" />
<table border="0" cellspacing="0" cellpadding="2" align="center" id="TableDayin">
<tr>
<td align="center" style="height:100px"><font size="2" face="宋体">
打印的内容</font></td>
</tr>
</table>
</form>
</body>
<script type="text/javascript" language="javascript">
//用于设置打印参数
function printBase() {
factory.printing.portrait = true; //true为纵向打印,flase为横向打印
factory.printing.leftMargin = 1.5; //左页边距
factory.printing.topMargin = 0; //上页边距
factory.printing.rightMargin = 1.5; //右页边距
factory.printing.bottomMargin = 0; //下页边距
}

//用于调用设置打印参数的方法和显示预览界面
function printReport() {
//打印时隐藏"打印"按钮和"关闭"按钮
var cmdPRINT = document.getElementById("cmdPRINT");
cmdPRINT.style.visibility = "hidden";
var butColes = document.getElementById("butColes");
butColes.style.visibility = "hidden";
printBase();
factory.printing.Print(false); //false为默认打印机,true为选择打印机
//打印完成后显示"打印"按钮和"关闭"按钮
cmdPRINT.style.visibility = "visible";
butColes.style.visibility = "visible";
}
</script>
</html>

望指教,第一次碰到这样的问题 . . 也可以邮件沟通:450135662@qq.com
...全文
140 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
月之点点 2015-03-04
  • 打赏
  • 举报
回复
没用过ScriptX
software_artisan 2015-03-03
  • 打赏
  • 举报
回复
没有设置默认打印机吧
小曾杰哥 2015-03-03
  • 打赏
  • 举报
回复
求帮助 . .. .
小曾杰哥 2015-03-02
  • 打赏
  • 举报
回复
没大神的出现吗? 我自己先顶一个 . . .

62,046

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术交流专区
javascript云原生 企业社区
社区管理员
  • ASP.NET
  • .Net开发者社区
  • R小R
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

.NET 社区是一个围绕开源 .NET 的开放、热情、创新、包容的技术社区。社区致力于为广大 .NET 爱好者提供一个良好的知识共享、协同互助的 .NET 技术交流环境。我们尊重不同意见,支持健康理性的辩论和互动,反对歧视和攻击。

希望和大家一起共同营造一个活跃、友好的社区氛围。

试试用AI创作助手写篇文章吧