如何使用javascript直接打印而不打开打印对话框

时间:2017-05-17 13:52:53

标签: javascript jquery css asp.net-mvc

我正在尝试使用此代码打印PDF文件,但我不想打开确认打印页面。你能帮帮我吗?

    function PrintRdlcReport() {
        var divtoPrint = document.getElementById('ReportViewer1_fixedTable');
        var newwin = window.open('', 'Print-Window');
        newwin.document.open();
        $("#ReportViewer1_ctl07_img").remove();
        $("#ReportViewer1_ToggleParam_img").remove();
        $("#ReportViewer1_ctl05").remove();
        newwin.document.write('<html><body onload="window.print()" style=" border: 1px  #000000 solid; font-family: verdana ;font-size: 14px ;">' + divtoPrint.innerHTML + '</body></html>');
        newwin.document.close();
    }

0 个答案:

没有答案
相关问题