HTML2Canvas does not render full div, only what is visible on screen?
I hope that help you: html2canvas(htmlSource, {scrollY: -window.scrollY}) .then(function(canvas) { var img = canvas.toDataURL(); window.open(img); });
I hope that help you: html2canvas(htmlSource, {scrollY: -window.scrollY}) .then(function(canvas) { var img = canvas.toDataURL(); window.open(img); });
I modified temporary: _html2canvas.Util.isTransparent from _html2canvas.Util.isTransparent = function(backgroundColor) { return (backgroundColor === “transparent” || backgroundColor === “rgba(0, 0, 0, 0)”); }; to _html2canvas.Util.isTransparent = function(backgroundColor) { return (backgroundColor === “transparent” || backgroundColor === “rgba(0, 0, 0, 0)” || backgroundColor === undefined); }; and after that it was enough to call html2canvas with background parameter set: … Read more
You should use it this way: $(‘body’).html2canvas(); var queue = html2canvas.Parse(); var canvas = html2canvas.Renderer(queue,{elements:{length:1}}); var img = canvas.toDataURL(); window.open(img); It took me few hours to figure it out, how to use it the right way. The {elements:{length:1}} is required, due to incomplete implementation of the plugin, otherwise you’ll get an error. Good luck!
Apparently, the problem seems to stem from html2canvas not being able to render css transforms, at least in chrome (I could only reproduce the problem in chrome, on OSX). The container that holds the tiles, is translated using -webkit-transform. So what we could do is to grab the values that the container is shifted, remove … Read more
I ran into the same type of error you described, but mine was due to the dom not being completely ready to go. I tested with both jQuery pulling the div and also getElementById just to make sure there wasn’t something strange with the jQuery selector. Below is an example that works in Chrome: <html> … Read more
NOTE: this answer is from 2015 and the library has been updated. Check the answers below for alternate implementations. Try this (Note that it makes use of the download attribute. See the caniuse support table for browsers that support the download attribute) <script> $(‘#save_image_locally’).click(function(){ html2canvas($(‘#imagesave’), { onrendered: function (canvas) { var a = document.createElement(‘a’); // … Read more
you can use scale options in html2canvas. In the latest release, v1.0.0-alpha.1, you can use the scale option to increase the resolution (scale: 2 will double the resolution from the default 96dpi). // Create a canvas with double-resolution. html2canvas(element, { scale: 2, onrendered: myRenderFunction }); // Create a canvas with 144 dpi (1.5x resolution). html2canvas(element, … Read more
JavaScript can read the DOM and render a fairly accurate representation of that using canvas. I have been working on a script which converts HTML into a canvas image. Decided today to make an implementation of it into sending feedbacks like you described. The script allows you to create feedback forms which include a screenshot, … Read more