利用打印控件实现打印

 

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="adminprelook1.aspx.cs" Inherits="SDMS.student.adminprelook2" %>

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

 

<html xmlns="http://www.w3.org/1999/xhtml" >

<head runat="server">

    <title>无标题页</title>

     <script language="javascript"> 

//  function preview()

//  {

//  pazu.TPrinter.doPreview();

//  }

 

function demo(){

alert("打印中");

//window.frames['myifrm'].focus();

pazu.TPrinter.header="";

pazu.TPrinter.footer="";

pazu.TPrinter.doPrint(false);

//pazu.TPrinter.writeHTMLtoOfficeFile

}

 

</script>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

 <!--media=print 这个属性可以在打印时有效-->

 <style media=print>

 .Noprint{display:none;}

 .PageNext{page-break-after: always;}

 </style>

</head>

<body>

<object  classid="clsid:AF33188F-6656-4549-99A6-E394F0CE4EA4"

codebase="http://www.4Fang.net/4ff/sc_setup.exe"

id="pazu"

name="pazu" > 

    <param  name="License"  value="You Need a License from 4Fang"/>

  </object>

 

    <form id="WebForm1" method="post" runat="server">  

        <table class="Noprint" style="text-align:left; width:100%">

           <tr>

                    <td align="center">

                       

                        &nbsp;<asp:Label ID="lblNum1" runat="server" Text="学号" Visible="False"></asp:Label>

                                    &nbsp;<asp:Label ID="Lblcardnumber" runat="server" Text="证书编号" Visible="False"></asp:Label>

                            &nbsp;<asp:Label ID="Lblstates" runat="server" Text="状态" Visible="False"></asp:Label>

                                    &nbsp;<input type="button" name="123" value="预览并打印" οnclick="demo()"

                            style="height: 23px; width: 86px" />

                      <asp:Button ID="Btnreturn" runat="server" οnclick="Btnreturn_Click" Text="返回"

                            Height="22px" Width="46px" />

                        </td>

            </tr>

    </table>                                             </center>

</div>  

</form>

</body>

</html>

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值