4
rated 0 times
[
7]
[
3]
/ answers: 1 / hits: 18228
/ 11 Years ago, tue, may 7, 2013, 12:00:00
I am trying to create a screengrab button that creates an image of the user's document.body
.
Ideally the user would then have an option to save the image locally as a .jpeg
.
I am getting close to creating the functionality I need using the html2canvas library.
function screenGrabber() {
html2canvas([document.body], {
logging: true,
useCORS: true,
onrendered: function (canvas) {
img = canvas.toDataURL(image/jpg);
console.log(img.length);
console.log(img);
window.location.href=img; // it will save locally
}
});
}
To verify that this is working I've been opening the img
variable in a new browser window. The image does not render completely and I am guessing that's because it's length is over 30,000 characters.
How might I better give the user an option to save the canvas locally after the onrendered
event?
More From » jquery