web 打印

下载控件 ScriptX.cab

下载此控件,放到项目目录中,
.ASPX页中添加如下元件:

<object id=factory style="display:none"
classid="clsid:1663ed61-23eb-11d2-b 92f -008048fdd814"
codebase="
目录路径/ScriptX.cab#Version=6,1,432,1">
</object>

设置打印格式语法:
<script>
function printWindow( ) {
    factory.printing.header =
"This is MeadCo";            '頁首
    factory.printing.footer =
"Printing by ScriptX";        '頁尾
    factory.printing.portrait =
false;                                '橫印
    factory.printing.leftMargin =
1.0;
    factory.printing.topMargin =
1.0
    factory.printing.rightMargin =
1.0;
    factory.printing.bottomMargin =
1.0;
    factory.printing.Print(false);
}
</script>
执行打印:
<input type="button" name="Print" value="
列印" onclick="printWindow('');">

你可能感兴趣的:(Web)