I'm using canvas2image.js to transform a div into an image, everything works, the problem, I need to set a format for the image at the time of saving, without it it is left without a valid format.
Example:
<link href="~/Content/css/CarimboBanner.css" rel="stylesheet" />
<script src="~/ContentAdmin/plugins/jQuery/jquery-2.2.3.min.js"></script>
<script src="~/Content/js/html2canvas.js"></script>
<script src="~/Content/js/canvas2image.js"></script>
<script src="~/Content/js/CarimboImagens.js"></script>
<div class="carimbo-foto">
<img src="http://img.vmessages.com/en/funny/35.jpg"class="img-responsive" id="carimbo" alt="" width="90" height="98">
<img src="https://thumbs.dreamstime.com/t/bandeira-horizontal-de-cloudscape-43923748.jpg"class="img-responsive" id="banner" alt="" width="560" height="315">
<img src="http://cdnqrcgde.s3-eu-west-1.amazonaws.com/wp-content/uploads/2013/11/jpeg.jpg"class="img-responsive" id="qrcode" alt="" width="80" height="80">
</div>
JS:
$(function () {
$("#btnSave").click(function () {
html2canvas($(".carimbo-foto"), {
onrendered: function (canvas) {
theCanvas = canvas;
document.body.appendChild(canvas);
// Convert and download as image
Canvas2Image.saveAsPNG(canvas);
//$(".main-footer").append(canvas);
// Clean up
//document.body.removeChild(canvas);
}
});
});
});