开发者

Converting HTML to image

I have a web app that displays the profile of over 600 people, and each profile displays a word cloud. the word cloud is rendered using html.

The client has requested that the same word cloud to appear in an excel macro that pretty much does the same thing as the web app.

I have seen a few solutions that saves image from rendered page but is there a way to create images from the html programa开发者_Go百科tically, without selecting each of the 600 profiles manually.


Since rendering html is a browser's job, you could take a look at doing it by javascript.

Write a nice little program in jQuery (or your favorite js framework) that renders the word cloud of every profile on a canvas, and then use this:

http://www.nihilogic.dk/labs/canvas2image/

to take an image of the rendered html.


I know it has been a while since I asked this question but I'll answer it for the benefit of others. I ended up using something called IECapt to capture rendering of a web page into a BMP, JPEG or PNG image file;

http://iecapt.sourceforge.net/

I then wrote a unit test to iterate over the various urls, passing it as an argument to the IECapt utility. Was able to render over 600 images in a few seconds.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜