jqPlot 的打印选项
我有一个 ASP.NET 页面,它使用 jqPlot 在运行时在客户端中生成一些图形(图形的数量可能会有所不同)。我希望能够仅打印生成的图表,但我不确定最好的方法。
我从来没有真正准备过要打印的网页,但从我读到的内容来看,有两种思想流派:
- 使用 CSS 使用 media="print" 关闭所有不需要的元素。
- 使用JS创建一个新窗口,并将要打印的内容传入其中。大概对于 jqPlot,这意味着我必须传递生成图形并重新渲染图形对象所需的所有对象。
由于图表是在客户端创建的,我可以排除任何 ASP.Net 服务器端打印技术。上面的第二种方法似乎有点矫枉过正,而且实现起来很复杂。到目前为止我更喜欢 CSS 方法。
很想听听其他人如何解决类似问题。
I have a ASP.NET page which uses jqPlot to generate some graphs in the client at runtime (the number of graphs can vary). I would like to be able to print out just the generated graphs but I'm not sure of the best approach.
I have never really worked with preparing web pages for printing, but from what I have read there are two schools of thought:
- Use CSS to turn off all the undesirable elements using media="print".
- Use JS to create a new window and pass into it the content to print. Presumably with jqPlot, this would mean I have to pass over all the objects required to produce the graphs and re-render the graph objects.
As the graphs are created on the client I can rule out any ASP.Net server side printing techniques. The second method above seems like overkill and would be complicated to implement. So far I'm favouring the CSS method.
Would love to hear how others have tackled similar problems.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
看看这个,也许会有帮助。它是 .net 中 hightChart 的打印解决方案。
希望那里能有一些鼓舞人心的东西......
https://github.com/imclem/Highcharts-export-module-asp.net
Take a look at this, may be it'll be helpful. it's a print solution for hightChart in .net.
Hope there could be something there inspirational...
https://github.com/imclem/Highcharts-export-module-asp.net