I've been working on a HTML page that I want to convert into an image.
I have been using the html2canvas and canvas2image scripts and taken this code http://jsfiddle.net/8ypxW/3/ here that has allowed me to create a button that will take a screenshot and download my HTML page as an image.
The problem I'm having is that my downloaded screenshot image shows my text but not my image, even though they are from the same origin. I'm not sure if it's a problem with my HTML, HTML2canvas or canvas2image.
My example is not live yet but my code is below:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script src="html2canvas.js"></script>
<script src="Canvas2Image.js"></script>
<div id="wrapper" style="background-color: white"; width="1000px" height="900px">
<img src="header.jpg" width= "900px">
tecno diagnostics
</div><!---- End Wrapper ---->
<br/>
<input type="button" id="btnSave" value="Save PNG"/>
<div id="img-out"></div>
<script type="text/javascript">
$(function() {
$("#btnSave").click(function() {
html2canvas($("#wrapper"), {
onrendered: function(canvas) {
// Convert and download as image
Canvas2Image.saveAsPNG(canvas);
$("#img-out").append(canvas);
// Clean up
//document.body.removeChild(canvas);
}
});
});
});
</script>
If anyone can help me out or point me in the right direction that would be much appreciated.
Thanks in advance