Page 1 of 1

Open PDF after rendering

Posted: Wed Feb 19, 2025 11:55 pm
by Asawyer13
I have this code in my index.php

$report->loadFile($t);


$report->render();
$report->exportDocument(StiExportFormat::Pdf);
$report->printHtml();


It export my report to pdf, and the user can click on the upper right of the screen to open it.

Is it possible to create the pdf and then open it without the user having to click to open?

Alan

Re: Open PDF after rendering

Posted: Thu Feb 20, 2025 11:07 am
by Lech Kulikowski
Hello,

You can set the Open After Export option:
$report->exportDocument(StiExportFormat::Pdf, null, true);

Thank you.

Re: Open PDF after rendering

Posted: Thu Feb 20, 2025 2:18 pm
by Asawyer13
Thank you.
Worked perfectly.
Alan

Re: Open PDF after rendering

Posted: Thu Feb 20, 2025 2:46 pm
by Lech Kulikowski
Hello Alan,

You are welcome.

Re: Open PDF after rendering

Posted: Thu Feb 20, 2025 9:39 pm
by Asawyer13
When I do this the pdf opens in a tab on the browser, but the index.php tab also stays open. Can that be automatically closed, or have the pdf open in the index.php tab?
Thanks
Alan

Re: Open PDF after rendering

Posted: Mon Feb 24, 2025 3:07 pm
by Lech Kulikowski
Hello Alan,

Unfortunately, it is not possible.

Thank you.