我想使用JavaScript将HTML页面以横向格式打印出来。
@page {
size: landscape;
}
对于IE浏览器,请查看以下帖子:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js" type="text/javascript"></script><script language="javascript" type="text/javascript"> function JPrint(){
// Create the WScript
var objWScriptShell = new ActiveXObject("WScript.Shell");
// Send Keys
objWScriptShell.SendKeys("(%f)u");
// Change to landscape
objWScriptShell.SendKeys("(%a)");
objWScriptShell.SendKeys("~");
// Enter O.K.
setTimeout("window.print()",500);
}</script><input onclick="javascript:void(JPrint())" type="button" value="Print Page"/>