Reputation: 84
I want to print some data that I have in a variable. The code I have is:
public printData(data) {
let printContents, popupWin;
printContents = data;
popupWin = window.open('', '_blank','resizable=yes,top=0,left=0,height=100%,width=auto');
popupWin.document.write(`
<html>
<head>
<title>Print</title>
</head>
<body onload="window.print();window.close()">${printContents}</body>
</html>`
);
popupWin.document.close();
}
It works fine but i get something like this:
and i don't want the want the window behind the printer options. I want to show the user only:
Is there any way to do this?
Thank you in advance.
Upvotes: 0
Views: 900
Reputation: 36
You could use a IFrame, remember not to use window.open in this case...
Upvotes: 1