将预览打印到网页 [英] Print Preview to a web page

查看:88
本文介绍了将预览打印到网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好专家,



我有一个类似数据录入网站的网页表格。 A

在字段中输入数据后,如果用户点击提交按钮,我想要一些下面应该做的功能



1 )屏幕截图/图像/复制网页,因为它是

2)显示第二/新标签/新窗口

3)像打印预览一样工作



我已经工作了很长时间才能将PDF表格填写并打印出来。

既然ASPX页面应该打印预览,对我来说似乎很困难和困惑。



你能帮我解决这个问题吗?

Hello experts,

I have a web form something like data entry website. A
After entering the data in the fields, if user clicks on Submit button, I want some function that should do below things

1) screen shot/ image / copy the web page as it is
2) display it second / new tab /new window
3) Work like print preview

I have working on quite sometime to get the PDF form fillable and printed.
Now that ASPX page should be print previewed , it seems difficult and confusing for me.

Could you please help me with this?

推荐答案

我得到了一些解决方案......

但我真的不满意。因为预览的风格不合适。

如何在宽度上调整宽度并在JavaScript函数中调整该样式现在是我的问题...



可以有人帮我这个吗?



I kind of got some solution...
But I am really not satisfied with it. Because the Style of the Preview is not proper.
How can I do a shrink fit to width in style and adapt that style in JavaScript function is my question now...

Can someone help me with that?

function PrintPanel() {
        debugger;
        var panel = document.getElementById("<%=Upnl1.ClientID %>");
//        panel.style.visibility = "visible";
        panel.style = 'preview-message';
        var printWindow = window.open(panel, '', 'height=600,width=900');
        printWindow.document.styleSheets = 'preview-message';
        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();
        }, 1000);
        return false;
    }


这篇关于将预览打印到网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆