KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Unable to save pdf using Laravel scheduler #2401

Open FinChamps opened this topic on on Oct 21, 2021 - 3 comments

FinChamps commented on Oct 21, 2021

Hi team,

I have to send the reports as pdf in an email. Emails will be sent by a scheduler in Laravel (Using the command line).

For storing pdf on the server I am using saveAs() method in place of toBrowser() as suggested in the Koolreport documentation.

But when I started to use it is giving an error for undefined request URI (PHP Notice: Undefined index: REQUEST_URI in /myproject/vendor/koolreport/export/Handler.php on line 193).

So I added a line in the beginning $_SERVER['request_uri'] = ''.

And after that, my pdf is saved on the server successfully but the pie charts and logo images are not shown inside pdf.

This is a high-priority task for my project but I am stuck due to this problem.

If possible please look into this issue asap.

Thanks

Sebastian Morales commented on Oct 22, 2021

Hi, I'm assuming you have the same problem posted in this topic:

Couldn't save pdf file into local storage using Laravel command line

Pls find our answers and solution there and post your feedback/result if necessary. Tks,

Javier Córdova commented on Mar 3, 2022

Hi Sebastian, I have tried to save the generated report from Laravel, but I keep getting Undefined array key "REQUEST_URI" error, I attach my code:

$report = new AtencionGeneralReport($data_report);
                $filename = storage_path('app\public\pdf\reporte_'.$datos->nombre.'.pdf');  
                FacadesLog::info('Reporte ATC instanciado. ' . $filename);
                $report->run()
                    ->export("AtencionGeneral")
                    ->settings([
                        "useLocalTempFolder"=>true
                    ])
                    ->pdf(array(
                        "format"=>"A4",
                        "orientation"=>"portrait",
                        //"zoom"=>2
                    ))
                    ->saveAs($filename);



I hope you can help with this little problem. Thank you

Sebastian Morales commented on Mar 7, 2022

Pls check our answer in a previous similar topic:

https://www.koolreport.com/forum/topics/2400#p13005

Basically we need some $_SERVER variable information to render a report with their resources (js, css, images, etc). Therefore, you would need to setup a route to render your report and your export command is a request to that route. Rgds,

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
None yet

None