为vb.net打印代码添加打印预览

时间:2014-07-24 05:39:19

标签: vb.net printing preview

更新此功能以添加打印预览,然后在打印预览中添加链接(打印)以打印预览页面     

    function PrintPanel() {

        var panel = document.getElementById("<%=pnlContents.ClientID %>");

        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(panel.innerHTML);

        printWindow.document.write('</body></html>');

        printWindow.document.close();

        setTimeout(function () {

            printWindow.print();

        }, 500);

        return false;

    }

</script>

1 个答案:

答案 0 :(得分:0)

您可以使用内置的打印预览控件在表单中显示打印预览。查看用于在表单中放置打印预览控件的屏幕截图 selected item is the control and the gray colored region is the preview area