The html2canvas library behaves strangely when I need to capture a control placed on an html body which is more than 30000 pixels long. My control is small (100 x 100) - but the script doesn't work when the body is long.
Here are two fiddles one is working other one is not working different body sizes
$(document).ready(function() {
$('#test').on('click', function() {
html2canvas(document.getElementById('container'), {
onrendered: function(canvas) {
document.body.appendChild(canvas);
},
});
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://html2canvas.hertzen.com/build/html2canvas.js"></script>
<body style="height:40000px">
<button id="test">test</button>
<div id='container'>
<img style='width:200px; height:200px;' src="www.example.com/example.jpg">
</div>
</body>
In the above example, the library returns an image - but the data is not valid. If I change the body height to something like 20000 pixels, everything works fine