Advertisement
NubeColectiva

Imprimir HTML 2 Canvas

Mar 28th, 2020
755
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $(function() {
  2.           $("#crearimagen").click(function() {
  3.               html2canvas($("#contenido"), {
  4.                 onrendered: function(canvas) {
  5.                     var myImage = canvas.toDataURL("image/png");
  6.                     var tWindow = window.open("");
  7.                     $(tWindow.document.body)
  8.                         .html("<img id='Image' src=" + myImage + " style='width:100%;'></img>")
  9.                         .ready(function() {
  10.                             tWindow.focus();
  11.                             tWindow.print();
  12.                         });
  13.                 }
  14.             });
  15.           });
  16.       });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement