I have a page that I need to print only one part of, I used window.open followed by a window.print for this, except that the output does not come out in the expected format, it's a form and it should be printed as it is in a css file I have, how do I when to create this new window it contain the css? I tried with href, target_blank and referencing in document.write but there was no way.
follows the code used to open the print page:
$('#btnPrint').click(function() {
var prtContent = document.getElementById("dados");
var WinPrint = window.open('', '', 'left=0,top=0,width=800,height=900,toolbar=0,scrollbars=0,status=0');
WinPrint.document.write(prtContent.innerHTML,);
WinPrint.document.close();
WinPrint.focus();
WinPrint.print();
document.getElementById('dados').remove()
WinPrint.close();
});