官方网址:http://www.meadroid.com/scriptx/index.asp

MeadCo's ScriptX控件有两种使用方式,一种是做为免费版本使用,一种是做为收费版本使用,免费版本支持的功能要少些,不过最重要也是最常用的页面设置,它还是提供的,因此使用免费版本即可。不过这两个版本用的都是同一个cab文件,只不过在代码设置中有一些不同。

http://www.meadroid.com/scriptx/sxdownload.asp这里下载smsx.cab文件。

页面调用示例:

<!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" class;
//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>

官方说明文档:http://www.meadroid.com/scriptx/docs/printdoc.asp,建议看看这个。

相关文章:

  • 2022-12-23
  • 2021-11-16
  • 2021-09-07
  • 2022-12-23
  • 2022-02-03
  • 2022-12-23
猜你喜欢
  • 2021-07-03
  • 2022-12-23
  • 2021-12-25
  • 2022-12-23
  • 2021-07-21
  • 2021-11-02
相关资源
相似解决方案