How to print HTML content in angular8 project?

Discussão em 'Angular' iniciado por chaabani nejma, Dezembro 17, 2024.

  1. I want to print just the chart but when I click to the button it prints to all of the window (with buttons and icons)

    [​IMG]

    the code is app.component.ts

    OnPrint() {

    window.print();
    }


    styles.css

    @media print {

    body * {

    visibility: visible;

    }

    #section-to-print, #section-to-print * {

    visibility: visible;

    }
    :host {
    display: none;
    }

    #section-to-print {

    position: absolute;

    left: 0;

    top: 10px;
    width: 230px;
    height: 330px;

    }

    }

    body{
    margin: 10px;
    }

    *{
    box-sizing: border-box;
    }

    Continue reading...

Compartilhe esta Página