render HTML (convert to bitmap)

风格不统一 提交于 2019-11-30 16:06:29

问题


Can somebody recommend the best (and preferably portable) way to render HTML documents onto a bitmap? As far as I understand my main 2 options are WebKit and Gecko, but I wasn't able to find a good starting point on how to do it. When I last tried doing this 5 years ago, I ended up using Gecko to send the document to a printer, which is not really what I need. I need rendering to a in-memory bitmap.

To clarify: server side, no Java, no .NET, batch processing, performance, not interactive, no Javascript.


回答1:


You can do this from the command line using webkit2png.py, which uses Python and QtWebKit (though I haven't tried it myself yet).




回答2:


You can try the ScreenGrab plug-in for Firefox.




回答3:


The most promising solution I found so far is this http://sites.google.com/site/torisugari/commandlineprint2 extension for Firefox which adds a command line option for printing a file to a printer, PNG, PostScript or PDF file.



来源:https://stackoverflow.com/questions/2632280/render-html-convert-to-bitmap

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