在没有打印机选择对话框的情况下在ASP.net Web应用程序中打印发票 [英] printing invoices in ASP.net web application without printer selection dialogue
本文介绍了在没有打印机选择对话框的情况下在ASP.net Web应用程序中打印发票的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为库存管理系统开发一个asp.net Web应用程序.
我需要在每笔交易上打印发票/账单.我已经创建了用于在gridview中准备账单的代码.我现在想要的是在单击按钮时打印该gridview(bill)的内容.
我尝试使用javascript函数
I am working on a asp.net web application for INVENTORY MANAGEMENT SYSTEM.
I need to print a invoice/bill on every transactions. i have created code for preparing the bill in a gridview. What i want now is to print the content of that gridview(bill) on button click.
I have tried using the javascript function
function printPartOfPage(elementId) {
var printContent = document.getElementById(elementId);
var windowUrl = 'about:blank';
var uniqueName = new Date();
var windowName = 'Print' + uniqueName.getTime();
var printWindow = window.open(windowUrl, windowName, 'left=50000,top=50000,width=0,height=0');
printWindow.document.write(printContent.innerHTML);
printWindow.document.close();
printWindow.focus();
printWindow.print();
printWindow.close();
}
确实会打印GRID的内容,但会提示用户选择打印机.
我希望通过默认打印机在单击按钮时立即打印该帐单.
which does print the content of the GRID but it prompts user to select the printer.
I want the bill to be printed immediately on button click through the default printer.
推荐答案
尝试http://www.aspsnippets.com/Articles/Print-functionality-in-ASP.Net-GridView-control.aspx [ ^ ]
我真的很高兴这不可能!试想一下,如果您可以不加确认地启动某人的打印机,网络将会如何!
I''m really happy that this is not possible! Just imagine how the web could be if you could start someones printer with no confirmation!
这篇关于在没有打印机选择对话框的情况下在ASP.net Web应用程序中打印发票的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文