Page 1 of 1

Print on new Blank Page

Posted: 2020-06-19 16:00
by lzonca
I need help,
how can I make sure that by pressing the "STAMPA" button the page is opened in a new blank page ??? the "STAMPA" page automatically creates a pdf page by script FPDF, but opens above the DV and therefore I am forced to go back with the browser's back button.
It would be more convenient to open new pages and then close it with the X.
ThankYou




$j(function(){
<?php if($selectedID){ ?>
$j('#Servizi_dv_action_buttons .btn-toolbar').append(
'<div class="btn-group-vertical btn-group-lg" style="width: 100%;">' +
'<button type="button" class="btn btn-default btn-lg" onclick="print_servizio()">' +
'<i class="glyphicon glyphicon-print"></i>STAMPA</button>' +
'</div>'
);
<?php } ?>
});

function print_servizio(){
var selectedID = '<?php echo urlencode($selectedID); ?>';
window.location = 'Servizi_stampa.php?id_servizio=' + selectedID;
}
</script>

Re: Print on new Blank Page

Posted: 2020-06-20 07:25
by pbottcher
Hi,

try instead

window.location = 'Servizi_stampa.php?id_servizio=' + selectedID;

Code: Select all

var url='Servizi_stampa.php?id_servizio=' + selectedID;
$('<a href="'+url+'" target="_blank"></a>')[0].click();

Re: Print on new Blank Page

Posted: 2020-06-27 17:09
by lzonca
hi, i change my code with this, but when i press the button no action run

Code: Select all

function print_servizio(){
var selectedID = '<?php echo urlencode($selectedID); ?>';
var url='Servizi_stampa.php?id_servizio=' + selectedID;
$('<a href="'+url+'" target="_blank"></a>')[0].click();
			}

Re: Print on new Blank Page

Posted: 2020-06-27 19:16
by pbottcher
Hi,

there is a missing j in my code.

Pls. try

Code: Select all

function print_servizio(){
var selectedID = '<?php echo urlencode($selectedID); ?>';
var url='Servizi_stampa.php?id_servizio=' + selectedID;
$j('<a href="'+url+'" target="_blank"></a>')[0].click();
}

Re: Print on new Blank Page

Posted: 2020-07-06 12:41
by lzonca
Thanks a lot, it works great