Open PDF after rendering

Stimulsoft Reports.PHP discussion
Post Reply
Asawyer13
Posts: 24
Joined: Fri Aug 23, 2019 12:16 am

Open PDF after rendering

Post 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
Lech Kulikowski
Posts: 7122
Joined: Tue Mar 20, 2018 5:34 am

Re: Open PDF after rendering

Post by Lech Kulikowski »

Hello,

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

Thank you.
Asawyer13
Posts: 24
Joined: Fri Aug 23, 2019 12:16 am

Re: Open PDF after rendering

Post by Asawyer13 »

Thank you.
Worked perfectly.
Alan
Lech Kulikowski
Posts: 7122
Joined: Tue Mar 20, 2018 5:34 am

Re: Open PDF after rendering

Post by Lech Kulikowski »

Hello Alan,

You are welcome.
Asawyer13
Posts: 24
Joined: Fri Aug 23, 2019 12:16 am

Re: Open PDF after rendering

Post 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
Lech Kulikowski
Posts: 7122
Joined: Tue Mar 20, 2018 5:34 am

Re: Open PDF after rendering

Post by Lech Kulikowski »

Hello Alan,

Unfortunately, it is not possible.

Thank you.
Post Reply