Not a duplicate as I need to convert to a html canvas, not from one
I am developing a site that puts some elements on the screen.
I need to be able to capture the content of a <div>
in a png
I have tried some chrome extensions but none worked unfortunately
<style type="text/css">
* {
margin: 0px 0px;
padding: 0px 0px;
}
#box {
background: #FFFF00;
width: 100px;
height: 50px;
}
</style>
<div id="box">
This is my box :)
</box>
Not a duplicate as I need to convert to a html canvas, not from one
I am developing a site that puts some elements on the screen.
I need to be able to capture the content of a <div>
in a png
I have tried some chrome extensions but none worked unfortunately
<style type="text/css">
* {
margin: 0px 0px;
padding: 0px 0px;
}
#box {
background: #FFFF00;
width: 100px;
height: 50px;
}
</style>
<div id="box">
This is my box :)
</box>
Share
Improve this question
edited May 3, 2016 at 11:13
Mr Lister
46.6k15 gold badges113 silver badges155 bronze badges
asked Apr 24, 2016 at 15:02
Morgan StephenMorgan Stephen
231 silver badge4 bronze badges
1
- Possible duplicate of Capture HTML Canvas as gif/jpg/png/pdf? – Jongware Commented Apr 24, 2016 at 19:57
1 Answer
Reset to default 4html2canvas can help you.
From official web site:
This script allows you to take "screenshots" of webpages or parts of it, directly on the users browser. The screenshot is based on the DOM and as such may not be 100% accurate to the real representation as it does not make an actual screenshot, but builds the screenshot based on the information available on the page.
html2canvas(document.getElementById('box'), {
onrendered: function(canvas) {
document.body.appendChild(canvas);
},
width: 400,
height: 400
});
Click here to see some live examples.