KoolReport's Forum

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

Error On Exporting PDF and Excel KoolReport Dashboard #3200

Closed afieq opened this topic on on Nov 28, 2023 - 5 comments

afieq commented on Nov 28, 2023

Hi,

I have included the export setting on my dashboard inside the onInit and the content function. But after i clicked my dropdown button, nothing happend and there's no file being export at all and there is no error occur. Is there any way can i solve this problem?

Thanks in advance.

Regards, Afieq

afieq commented on Nov 29, 2023

Hi,

Any help can i get from this issue?

Regards, Afieq

KoolReport commented on Nov 29, 2023

Please turn on the debugMode of dashboard to know what may went wrong. Please provide your code of how you setup the exporting so that we can understand the case.

afieq commented on Nov 30, 2023

Hi KoolReport,

This is my codes for dashboard KoolReport, i have added the debugMode. But after i clicked the button nothing happen, my debugMode also does not popup any error from after clicked the button. So do i miss something in my codes?

class MyBoard extends Dashboard
{
    protected function onInit()
    {
        $this->pdfExportable(true); //Turn on pdf exportable for dashboard
    }

    protected function content()
    {
        return [
            Panel::success([
                YearlyReport::create()->pdfExportable(true),
                Button::create()->text("Export to PDF")->onClick(
                    Client::widget("YearlyReport")->exportToPDF()
                )
            ])
        ];
    }
}

Thanks in advance.

Regards, Afieq

afieq commented on Nov 30, 2023

Hi,

Never mind, i have found the solution for this problem. I missed the setup on the application to enable the exporting process. Below is the code function needed to enable exporting on dashboard.

use \koolreport\dashboard\ExportHandler;
use \koolreport\dashboard\export\LocalExport; // used for PDF, JPG, and PNG export
use \koolreport\dashboard\export\ChromeHeadlessio; // used for PDF, JPG, and PNG export
use \koolreport\dashboard\export\XLSXEngine; // used for XLSX export
use \koolreport\dashboard\export\CSVEngine; // used for CSV export

protected function export()
    {
        return ExportHandler::create()
                ->storage(dirname(__DIR__)."/storage")
                ->engine( // provide multiple engines for multiple file types export
                    LocalExport::create('LocalPdfEngine'),
                    ChromeHeadlessio::create('CloudPdfEngine')->token("your-token"),
                    XLSXEngine::create('ExcelEngine'),
                    CSVEngine::create('CsvEngine')
                );
    }

Regards, Afieq

KoolReport commented on Nov 30, 2023

That's awesome!

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
solved

Export