官方网址:
MeadCo's ScriptX控件有两种使用方式,一种是做为免费版本使用,一种是做为收费版本使用,免费版本支持的功能要少些,不过最重要也是最常用的页面设置,它还是提供的,因此使用免费版本即可。不过这两个版本用的都是同一个cab文件,只不过在代码设置中有一些不同。
去这里下载smsx.cab文件。
页面调用示例:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns=""><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 οnlοad="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="打印本页" οnclick="factory.printing.print(false)"> <input type=button value="页面设置" οnclick="factory.printing.PageSetup()"> <input type=button value="打印预览" οnclick="factory.printing.Preview()"></center></body></html>官方说明文档:,建议看看这个。