html2canvas($('#head'), {
allowTaint: true,
onrendered: function (canvas) {
var base64image = canvas.toDataURL("image/png");
console.log(base64image);
}
});
Asked
Active
Viewed 143 times
0

Ashot Karakhanyan
- 2,804
- 3
- 23
- 28

Rufio Rocco
- 121
- 1
- 6
-
1This question could do with additional context. You mentioned that you don't see an image tag in your DOM, correct? Do you see any errors in your JS console? Any failed network requests? – Richie Thomas Aug 06 '18 at 16:06
1 Answers
0
Try this!
html2canvas($('#head'), {
onrendered: function(canvas) {
var base64image = canvas.toDataURL("image/png");
var tWindow = window.open("");
$(tWindow.document.body)
.html("<img id='Image' src=" + base64image + " style='width:100%;'></img>")
.ready(function() {
tWindow.focus();
tWindow.print();
});
}
});

Nisarg
- 1,631
- 6
- 19
- 31
-
Thanks, I have tried it but it did not work. The picture does not show. – Rufio Rocco Aug 07 '18 at 02:14