您好,
我们有一篇现有的博客介绍在flashview下的直接打印
http://blog.gcpowertools.com.cn/ ... ts_DirectPrint.aspx
您可以先参考下,
在HtmlViewer下实现打印的思路和flashView是一致的。
将viewer隐藏,然后调用js里面的print方法- <script language="javascript" type="text/javascript">
- var viewModel;
- var printBtn = '<span><input id="btnPrint" type="Button" value="Print" onclick="print()"/></span>';
- var exportSelect = '<select id="ExportSelect" style="width:80px"><option selected disabled>Export</option><option value="PDF" style="background: url(images/pdf.png) right no-repeat; width: 50px">PDF</option><option value="Excel" style="background: url(images/Excel.gif) right no-repeat; width: 50px">Excel</option></select>';
- $(document).ready(function () {
- viewModel = GetViewModel("WebViewer1");
- var toolbar = $('#WebViewer1').find('.arvToolBar');
- toolbar.append(exportSelect);
- toolbar.append(printBtn);
- //Check the selected value in DropDown and Export
- $("#ExportSelect").change(function (e, args) {
- var valueSelected = this.value;
- if (viewModel.PageLoaded()) {
- switch (valueSelected) {
- case "PDF":
- viewModel.Export(ExportType.Pdf, function (uri) {
- window.location = uri;
- }, true);
- break;
- case "Excel":
- viewModel.Export(ExportType.Xls, function (uri) {
- window.location = uri;
- }, true);
- break;
- }
- }
- });
- });
- function print() {
- if (viewModel.PageLoaded()) {
- viewModel.Print();
- }
- };
- </script>
复制代码 |