KoolReport's Forum

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

Different result on pivot to pdf using export and cloudexport packages #2536

Closed saiful opened this topic on on Jan 14, 2022 - 19 comments

saiful commented on Jan 14, 2022

hi, i'm tried to export pivot table to pdf using Export and CloudExport packages, but when i run the process, it has different result:

this is the result using Export package:

- no table border - small text & different font

and this is the result using CloudExport package:

- no data printed

i use the same view and function to exporting:

    public function fna_export_pdf()
    {
	$report             = new FNAFAD0001_EXPORT([
                                "session_id"=> session('session_id'),
                                "location_cd"=> session('location_cd')
                            ]);
        $report->run()
// just switching this to change between export & cloudexport
//	->cloudExport("FNAFAD0001_PDF")
// 	->chromeHeadlessIo("************************")
//        ->export("FNAFAD0001_PDF")
	->pdf()
        ->toBrowser("FINANCE_DAILY_REPORT.pdf");
    }

saiful commented on Jan 14, 2022

i have seen this sample https://www.koolreport.com/examples/reports/pivot/customers_categories_products/ but there's nothing properties to set table border, but why my report result has no border, while the sample has? and why the cloudexport don't print the result?

Sebastian Morales commented on Jan 14, 2022

For cloud export, you would have to enable a network waiting parameter like this:

    $report->cloudExport("MyReportPDF")
    ->chromeHeadlessio($secretToken)
    ->settings(array(
        "pageWaiting" => "networkidle2", // add this setting, default pageWaiting = load
    ))
    ->pdf($pdfOptions)
    ->toBrowser($filename);

The reason is that PivotMatrix/PivotTable takes some time after loading to render. For local export, it uses a different rendering engine (PhantomJS) from cloud export (headless chromium) so its waiting is different:

    $report->export("MyReportPDF")
    ->settings(array(
        'resourceWaiting' => 5000
    ))
    ->pdf(...)
    ...
saiful commented on Jan 14, 2022

i have been adding parameters like above, but the result still same. no table on CloudExport and no border on Export

saiful commented on Jan 17, 2022

my previous report from datatable to pdf using cloudExport running well, but on this report still print blank page. do you have any suggestion parameter to use?

Sebastian Morales commented on Jan 17, 2022

Do you use PivotTable or PivotMatrix in your pdf view page?

saiful commented on Jan 17, 2022

i use PivotTable on both report and pdf view page

Sebastian Morales commented on Jan 17, 2022

Ok, then pls try this property of PivotTable in your pdf view for both local and cloud exports:

    PivotTable::create(array(
        ...
        "initVisible" => true,
    ));
saiful commented on Jan 18, 2022

i have been adding the properties both on report and pdf view. when i run using local export the result still the same, no table border, while i use CloudExport it just loading for few minutes, no downloading the result.

saiful commented on Jan 18, 2022

hi, after several times trying export using CloudExport, here is the result:

Sebastian Morales commented on Jan 18, 2022

If you comment out "initVisible", does cloud export work?

saiful commented on Jan 18, 2022

no error, but blank result:

Sebastian Morales commented on Jan 18, 2022

In your pdf view, replace PivotTable with a Table using the same datastore F100 like this to see if it works:

//MyReportPDF.view.php
Table::create(array(
    "dataSource" => $this->dataStore("F100"),
));
saiful commented on Jan 19, 2022

i use table like this on pdf view:

here is the result using cloudExport:

and this is the result using local Export:

saiful commented on Jan 19, 2022

i use Koolreport Table and CloudExport, but the result looks like this:

saiful commented on Jan 20, 2022

when i try to preview the report like this:

i got error like this:

Sebastian Morales commented on Jan 20, 2022

I just want to check if there's any data and correct data structure in the pivot datastore. They all seem fine. Still haven't figured out why cloud export doesn't show PivotTable yet.

Pls try this method: open the file KoolReport/GitHub-KoolReport/pivot/widgets/PivotTable.tpl.php and remove this string:

    visibility: <?php echo $this->initVisible ? "visible" : "hidden"; ?>

Then try cloud export and let us know the result. Tks,

saiful commented on Jan 21, 2022

i cannot find the code

saiful commented on Jan 21, 2022

wow, it works!

i just replace the code:

visibility:hidden to -> visibility:visible

and when i run the export, it works perfectly.

Sebastian Morales commented on Jan 21, 2022

That's great to hear it works. We will check why "initVisible" => true doesn't have effect for you. Tks,

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

Pivot