2016-05-20 176 views
1

我有一個MVC Web應用程序,我們要打印收據,但由於我們有POS系統和熱敏打印機,我們不想打印對話框和收據應直接打印。在MVC中直接打印沒有熱打印機的打印對話框.net

我們有以下代碼,但正在彈出。任何人都可以提供幫助嗎?我們正在尋找完整的跨瀏覽器支持。

的代碼如下附:預先

<script type="text/javascript"> 
     // var q = jQuery.noConflict(); 
     $("#btnPrint").live("click", function() { 
      var divContents = $("#dvContainer").html(); 
      var printWindow = window.open('', '', 'height=400,width=800'); 
      printWindow.document.write('<html><head><title>DIV Contents</title>'); 
      printWindow.document.write('</head><body >'); 
      printWindow.document.write(divContents); 
      printWindow.document.write('</body></html>'); 
      printWindow.document.close(); 
      printWindow.print(); 
      q('.print default').trigger('click'); 

     }); 
    </script> 

感謝。

+0

你不能。這是瀏覽器的控制器。 –

回答

1

您有2個選項。

選擇一個

原始數據發送到從Microsoft .NET Framework中的打印機,你的程序必須使用Win32的假脫機功能工作。但是,使用.NET Framework,您無法將預先格式化的打印機就緒數據發送到打印機。

瞭解更多here

選擇二

WebClientPrint爲ASP.NET。這裏有更多的信息。