Created
February 25, 2019 12:01
-
-
Save ingeit/6f2012419534cca13c956da2d3f78f04 to your computer and use it in GitHub Desktop.
imprimir div html angular print
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// boton ejecuta impruimir | |
<button nz-button nzGhost (click)="printer()"> | |
<i nz-icon type="printer" theme="outline"></i>Imprimir | |
</button> | |
//DIV a imprimir | |
<div style="visibility: hidden;" id="print" class="print"> | |
<div nz-col style="text-align: center;"> | |
<h2>Comprobante número: {{respuesta?.numeroComprobante}}</h2> | |
<h3>Informacion del alumno:</h3> | |
<p>Documento: {{tramite.alumno?.documento | dni }}</p> | |
<p>Apellido y Nombre: {{tramite.alumno?.apellido | uppercase }}, {{tramite.alumno?.nombre | titlecase}}</p> | |
<p>Origen: {{tramite.origen}}</p> | |
<p>Establecimiento destino: {{tramite.alumno?.establecimientoNombre}}</p> | |
</div> | |
</div> | |
printer() { | |
const printContent = document.getElementById("print"); | |
const WindowPrt = window.open('', '', 'left=0,top=50,width=900,height=900,toolbar=0,scrollbars=0,status=0'); | |
WindowPrt.document.write(printContent.innerHTML); | |
WindowPrt.document.close(); | |
WindowPrt.focus(); | |
WindowPrt.print(); | |
WindowPrt.close(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment