web打印

http://hi.baidu.com/sunjsp/blog/item/12d9c824e63eb33ac9955969.html

 

http://tech.it168.com/KnowledgeBase/Articles/4/6/7/467aebe448d18ea42df3ea7b107e078c.htm

 

http://www.meadroid.com/scriptx/docs/printdoc.asp#testing  doc

 

<!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>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
<object id=factory viewastext style="display:none" classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814" codebase="smsx.cab#Version=6,5,439,12"></object>
<title></title>
<style media="print">
.noprint {
display:none;
}
</style>
<script type="text/javascript">
<!--
function SetPrintSettings() {
// -- advanced features
//factory.printing.SetMarginMeasure(2); // measure margins in inches
//factory.printing.printer = "HP DeskJet 870C";
//factory.printing.paperSize = "A4";
//factory.printing.paperSource = "Manual feed";
//factory.printing.collate = true;
//factory.printing.copies = 2;
//factory.printing.SetPageRange(false, 1, 3); // need pages from 1 to 3

//注意,如果页面报了JS错误,可以先将以上advanced features全部去掉,只留下面的basic features,这里我将上面的全部注释掉

// -- basic features
factory.printing.header = "";
factory.printing.footer = "";
factory.printing.portrait = false;
factory.printing.leftMargin = 1.0;
factory.printing.topMargin = 1.0;
factory.printing.rightMargin = 1.0;
factory.printing.bottomMargin = 1.0;
}

function Print(frame) {
factory.printing.Print(true, frame) // print with prompt
}

//-->
</script>
</head>

<body onload="SetPrintSettings()">
<table border="1" width="100%">
<tr>
   <td>a哈</td>
   <td>b</td>
</tr>
<tr>
   <td>c</td>
   <td>d</td>
</tr>
</table>
<center class="noprint">
<input type=button value="打印本页" onclick="factory.printing.print(false)">
<input type=button value="页面设置" onclick="factory.printing.PageSetup()">
<input type=button value="打印预览" onclick="factory.printing.Preview()">
</center>
</body>
</html>

 

你可能感兴趣的:(JavaScript,Web,XHTML,asp,HP)