How do I make an HTML page print in landscape when the user selects 'print'?

萝らか妹 提交于 2019-12-04 20:09:55

问题


We generate web pages that should always be printed in landscape mode. Web browser print dialogs default to portrait, so for every print job the user has to manually select landscape. It's minor, but would be nice for the user if we can remove this unnecessary step.

Thanks in advance to all respondents.


回答1:


A quick Google indicates that it's not really supported. There's more than a few folks out there trying to hack their way to it - but I'd strongly suggest just rendering a server side PDF instead.




回答2:


Possible in CSS2 (@page, looks like Opera only) and in CSS3 which will work nowhere. Sorry.




回答3:


The @page rule is supposed to allow this, but is only implemented in Opera.




回答4:


I was looking to do this same thing and found this article. It looks particularly "hacky" and as the author points out, may invoke an active x warning in IE. Seems like a losing proposition to confuse the user with an active x warning when they just wanted to print a web page.



来源:https://stackoverflow.com/questions/37162/how-do-i-make-an-html-page-print-in-landscape-when-the-user-selects-print

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!