showing results for - "how to print canvas image in js"
Sergio
15 Oct 2017
1function printCanvas()  
2{  
3    var dataUrl = canvas.toDataURL(); //attempt to save base64 string to server using this var  
4    var windowContent = '<!DOCTYPE html>';
5    windowContent += '<html>'
6    windowContent += '<head><title>Print canvas</title></head>';
7    windowContent += '<body>'
8    windowContent += '<img src="' + dataUrl + '">';
9    windowContent += '</body>';
10    windowContent += '</html>';
11    var printWin = window.open('','','width=1197,height=793');
12    printWin.document.open();
13    printWin.document.write(windowContent);
14    printWin.document.close();
15    printWin.focus();
16    printWin.print();
17}