Hide page export print

This public forum is for user-to-user discussions of PHPMaker. Note that this is not support forum.
Post Reply
danilo.macri
User
Posts: 100

Hide page export print

Post by danilo.macri »

hi guys,
can you help me do this?
when I click on the print button at the top left phpmaker redirects the page to:
localhost/Rapporti2023/RapportituttiricercaList?export=printxxxxxx
if I insert this code in Page_DataRendered it opens the windows print with the page below
localhost/Rapporti2023/RapportituttiricercaList?export=printxxxxxx

function Page_DataRendered(&$footer)
{
    $footer = "<script>window.print();</script>";
 }

I would like when I click on the print button that Windows print opens and that the listpage remains underneath because in the above case, after printing I have to go back with the browser to return to the listpage.


danilo.macri
User
Posts: 100

Post by danilo.macri »

I solved it like this:

function Page_DataRendered(&$footer)
{
    print preg_replace('/\r?\n|\r/', '<br/>', $this->testorapportohtml->CurrentValue);
            $ritorna = $_SERVER['HTTP_REFERER'];
			$footer = "<script>window.print();
            window.onafterprint = function(event) {
             window.location.href = '$ritorna'
            }</script>";
}

Post Reply