rendering html to png (server-side) [closed]

孤街醉人 提交于 2019-12-28 05:51:46

问题


I have a workflow model. Internet Explorer doesn't support some features required for model editing functionality (and regular user doesn't need it).

I want a read-only preview of my model. Is it possible to server-side render my HTML to an image?

I would prefer offline solution to allow our system run in corporate LAN without access to internet.


回答1:


Here are 'local' solutions:

  • wkhtmltoimage from the wkhtmltopdf package

    does exactly its name says

  • PhantomJS

    more advanced capabilities, like evaluating any js code in the page's context before rendering it to an image or pdf.




回答2:


You can try using a java library called flyingsaucer (aka xhtmlrenderer). It has worked very well for me in the past.

Homepage: http://code.google.com/p/flying-saucer//

FAQ for generating an image: http://pigeonholdings.com/projects/flyingsaucer/R8/doc/guide/users-guide-R8.html#xil_29



来源:https://stackoverflow.com/questions/2651173/rendering-html-to-png-server-side

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