I don't have even any idea how to do this and the documentation of html2canvas is not really helpful at this part.
I'm able to make a screenshot of my html with this little piece of code:
target = $('#myDiv');
html2canvas( target, {
onrendered: function( canvas ) {
/* canvas is the actual canvas element,
to append it to the page call for example
*/
document.body.appendChild( canvas );
}
})
but i want to be able to pass an url and make a screenshot of this page. Like they do in their example page on: http://html2canvas.hertzen.com/screenshots.html
If anyone could give me a hint how to get started with that, I would be really glad.
You can't, for security reasons, load just any external URL. That's why, as they described on the page you linked to, you need to set up a separate server-side script that fetches the page. You then use that script, either directly or via AJAX, to provide the input for html2canvas.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With