How to print HTML Design In Angular 8

How to print HTML Design In Angular8


It is easily to print HTML Design without any Plugin and Extra Code.

Lets See How?

Eg. HTML


    <div id="divid">Whatever want to print...</div>

    <button(click)="printComponent('divid')" title="Print" />


   Eg. Component.ts


    printComponent(compo) {

     let printContents = document.getElementById(cmpName).innerHTML;

    let originalContents = document.body.innerHTML;

    document.body.innerHTML = printContents;

    window.print();

    document.body.innerHTML = originalContents;

    }


This Will Reflect To Print Option From Where You Can Print Entire Html with Design.

No comments:

Post a Comment