Skip to content

Instantly share code, notes, and snippets.

@camilamoreiradev
Created October 30, 2021 04:37
Show Gist options
  • Save camilamoreiradev/166a308a3c9f81cb95ff9529297f218b to your computer and use it in GitHub Desktop.
Save camilamoreiradev/166a308a3c9f81cb95ff9529297f218b to your computer and use it in GitHub Desktop.
Criar um botão js e nele colocar o código passando o id da div que quer imprimir na imagem.
Swal.fire({
title: 'Aguarde...',
html: 'Estamos gerando a IMAGEM com as informações da tela.',
timerProgressBar: true,
didOpen: () => {
Swal.showLoading()
}
});
setTimeout(function(){
html2canvas(document.getElementById("container-print"), {
onrendered: function (canvas) {
var link = document.getElementById('btn_jpg_link');
link.href = canvas.toDataURL('image/jpeg');
$('#btn_jpg_link')[0].click();
Swal.close();
}
});
}, 1000);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment