How can I see print preview of my invoice generated from website. If I print with the script
print this page>
This is what I used:
printPage(evt: any) {
// add this 'noprint' class to elements you want to hide from printing
let hideElements = document.getElementsByClassName('noprint');
let arr = Array.prototype.slice.call(hideElements)
arr.map(val => {
val.style.visibility = 'hidden';
})
let w = window.open();
// 'main' is the section I want to print
w.document.write(document.getElementById('main').innerHTML);
w.print();
w.close();
arr.map(val => {
val.style.visibility = 'visible';
})
}