简体   繁体   中英

Convert a div and contents inside it to image

I have a DIV container which has some text, background-image, image. I need to convert that whole DIV contents into image and save.

I have googled it around but could not find the perfect answer. some are giving answers that uses a windows application , but i need it on a web platform .

any help will be highly appreciated

From what I understood, you have to do that in the client side, so you should take a look at the toDataURL method of the canvas.

If you don't know, the canvas support text and image.

Example and little library at this link: http://www.nihilogic.dk/labs/canvas2image/

http://html2canvas.hertzen.com/

Does't support IE though. Looks solid other than that.

这是可能的,修改代码http://html2canvas.hertzen.com/screenshots.html你可以执行所需的screenshot :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM