Using html2canvas

Hi,

I want to capture a part of the screen to an image. I’ve read the posts here, looked at examples, videos and code, but my knowledge of HTML and JavaScript is to shallow. So, I don’t understand why this code is not working when I put it in a HTML element: :blush:

html2canvas(document.body, {
onrendered: function(canvas) {
document.body.appendChild(canvas);
},
width: 300,
height: 300
});

I’m I way off here?

How about wrapping in it “script”? (LOL)

Still not getting it to work. Managed to get the whole screen, but not part of it.

I played around with this previously. I would urge you to use the ID of a group instead of body. Group all elements you want to fetch within a group with a unique “div id”, and reference this in the html2canvas script.

Good idea! Tried it in:

But it won’t work either.

Were you able to get this to work?

No. I have dropped it. :neutral_face:

If you need it for capturing a part of the screen like the OP then the Documental plugin will help you out. It has a snapshot element that can let you take a snapshot of any element by its ID.

Thanks. I’ll check it out.

It’s not really a need at the moment, more of an exploration of what’s possible.

This topic was automatically closed after 70 days. New replies are no longer allowed.