1
I have a page that I need to print only a part of, I used window.open followed by a window.print for that, only the print doesn’t come out in the expected format, it’s a form and should be printed as it is in a css file that I have, How do I create this new window when it contains css? I tried with href, target_blank and referencing in Document.write but there was no way.
follows the code used to open the printing 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();
});
I have already tried to do this and the print window opens blank, I believe I’m missing something "basic" but I can’t figure out exactly what. I’ll take a look at the other options of the English question and see if any of them resolve.
– Natã Minetto