1
I have a system that shows the result of a consultation. On this page you have the print button, but I need to make sure that when you click the print button, print another page formatted without having to open it, or if that’s the case, do not even happen to download, open and close automatically. I have the following code on the main page ( index.php ):
<script>
$(function(){
//evnto que deve carregar a janela a ser impressa
$('#imprimir').click(function(){
newWindow = window.open('imprimir.php');
//imprime e fecha a nova janela quando estiver carregada
$(newWindow).ready(function() {
newWindow.print();
newWindow.close();
});
});
});
</script>
<a href="#" style="color: #666666; font-weight: bold" id="imprimir"><i class="fa fa-print"></i> Imprimir Orçamento</a>
instead of using the
window.open
you could use an iframe for the job.– Tobias Mesquita
Sorry Tobymosque, I don’t understand
– user24136
You want it to print automatically?
– Randrade
Yes. After clicking the print button, he will read the page that will be printed and then close the page. Type what occurs in file download, where it opens, sends the file and the page closes automatically.
– user24136