进一步讨论在 ASP 页面中如何设置IE浏览器打印“页面设置”!
在页面打印中直接采用IE浏览器打印,现在用户提出新的要求:在程序中设置打印的纸张大小。我参考了http://www.meadroid.com/scriptx/docs/printdoc.htm?static文档:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>print</title>
</head>
<body>
<!-- MeadCo Security Manager -->
<object viewastext style="display:none"
classid="clsid:5445be81-b796-11d2-b931-002018654e2e"
codebase="smsx.cab#Version=6,1,432,1">
<param name="GUID" value="{67533199-D16A-46D3-BA23-5AA77981F726}">
<param name="Path" value="sxlic.mlf">
<param name="Revision" value="0">
</object>
<!-- MeadCo ScriptX -->
<object id=factory viewastext style="display:none"
classid="clsid:1663ed61-23eb-11d2-b92f-008048fdd814">
</object>
<script defer>
function window.onload() {
// -- 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
// -- basic features
factory.printing.header = "This is MeadCo";
factory.printing.footer = "Advanced 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;
}
function Print(frame) {
factory.printing.Print(true, frame) // print with prompt
}
</script>
<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()"><br>
<a href="http://www.meadroid.com/scriptx/docs/printdoc.htm?static" target=_blank>具体使用手册,更多信息,点这里</a>
</body>
</html>
但是这个需要注册的控件,不知各位有何高见?除了自己再开发一个类似的控件吗?