render HTML (convert to bitmap)

2020-02-29 15:12发布

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.

3条回答
Evening l夕情丶
2楼-- · 2020-02-29 15:48

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

查看更多
霸刀☆藐视天下
3楼-- · 2020-02-29 15:53

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.

查看更多
别忘想泡老子
4楼-- · 2020-02-29 16:07

You can try the ScreenGrab plug-in for Firefox.

查看更多
登录 后发表回答