产生在asp.net网页打印preVIEW [英] Generate print preview of a web page in asp.net

查看:119
本文介绍了产生在asp.net网页打印preVIEW的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<a href="_javascript:window.print()">
<img class="noPrint" src="Images/Print_icon.png" border="0"></a>

这是唯一的code我使用来实现打印功能。它会产生一个打印对话框。而为了让网页打印友好,我已经使用样式表和藏div的,我不想在打印页面。

This is the only code i am using to implement print function. It generates a print dialog box. And to make the page print friendly, I have used stylesheets and hid the div's that I dont want in the print page.

我现在需要生成网页的打印preVIEW。有什么建议?

I now need to generate a print preview of that page. Any suggestions?

感谢

推荐答案

基本上没有可用的功能,到现在为止,但你可以通过名称 print.htm 的打印CSS和打开按钮打印preVIEW单击此文件作为一个弹出网页,并使其,这将preVIEW页:

Basically there is no functionality available until now but you can achieve by creating a copy of same html file with name print.htm with the Print css and open this file on button Print Preview click as a popup page and render it, This will preview the page :

<html> 
<head> 
<title></title> 
//do it in simple way.. 
<script LANGUAGE="JavaScript"> 
function displayMessage(printContent) { 
var inf = printContent; 
win = window.open("print.htm", ‘popup’, ‘toolbar = no, status = no’); 
win.document.write(inf); 
win.document.close(); // new line 
} 
</script> 
</head> 
<body> 
<div id="printarea">Print this stuff.</div> 
<a href="javascript:void(0);" onclick="displayMessage(printarea.innerHTML)">Print Preview</a>

</body> 
</html> 

这篇关于产生在asp.net网页打印preVIEW的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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