2

我正在尝试设置一个打印按钮,以便当用户单击它时,将打印 ScrollPanel 的内容或至少将其放入某种形式,以便用户可以打印它。不知道什么是最简单的方法,我已经看到有关使用 css 删除其他项目的建议,但我不确定如何执行此操作。有什么建议或帮助吗?我不知道从哪里开始

4

2 回答 2

0

You could try to extract the dom contents of the scroll panel and append it to a pop-up window that the user can ctrl + p to print.

The CSS way of doing it is by appending a media attribute (i.e. MEDIA="print") to the scrollpanel element, but this may not be compatible in all browsers -- no support in IE8.

See: http://www.w3.org/TR/CSS21/media.html

Compatibility: http://caniuse.com/#search=media

Tutorial: http://coding.smashingmagazine.com/2011/11/24/how-to-set-up-a-print-style-sheet/

于 2012-11-16T23:53:04.967 回答
0

最简单的方法之一可能是在您的单击处理程序中设置Window.print()方法并使用[yourPanelName].seVisible(false)打印前方法和(真)后使用,以重新获得您的本机 GUI。

于 2014-10-28T14:53:08.370 回答