KoolReport's Forum

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

Export to PDF is coming up blank. #789

Open paulo opened this topic on on Apr 8, 2019 - 2 comments

paulo commented on Apr 8, 2019

Hi,

I have followed the example but I am still getting a blank report. I also tried with the cloud service but nothing . I didn't get any error, but browser kept loading forever and nothing happened. So, I've a MyReport.php connected to Laravel through use \koolreport\laravel\Friendship; I also have MyReport.view.php and MyReportPdf.view.php as per your example. In my controller, I have tried:

$report = new MyReport;
           $report->run()->export("MyReportPdf")->pdf(array(
                "format"=>"A4",
                "orientation"=>"portrait"
            ))->toBrowser("myfile.pdf", true);

blank result I also tried:

 $report->run()
                ->cloudExport("MyReportPdf")
                ->chromeHeadlessio("hidden - but in my code I have it here.")
                ->pdf(array(
                "format"=>"A4",
                "orientation"=>"portrait"
            ))->toBrowser("myfilecloud.pdf", true);

Note: Both scenarios I don't have a return from my controller. If I display in the browser only, I can see the report no problem. $report = new MyReport;

        $report->run();
        return view("report",["report"=>$report]);

The report view contains: <?php $report->render(); ?>

Is there anything else I am missing ? thanks

KoolReport commented on Apr 9, 2019

Note that, when you call export to pdf function, you should not return any html to browser. The return view() will interfere with pdf render so it will end up with corrupted file.

One question: Does our export example work?

paulo commented on Apr 9, 2019

thanks. I am not calling the render view. The controller is sending directly to the screen, but it comes blank. Yes, I am following your example, and it is still not working. I tried with a very basic view , just this: <?php

    Table::create([
        "dataSource" => $this->dataStore("together")
    ]);
    ?>

And the controller has: $report = new BTimeline;

        $report->run();

        $report->run()->export("BTimelinePDF")->pdf(array(
            "format"=>"A4",
            "orientation"=>"portrait"
        ))->toBrowser("myfile.pdf", true);

the file is coming up blank. Help please. thank you

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
help needed

None