KoolReport's Forum

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

Charts is blank when exported to PDF #1777

Open Amr opened this topic on on Dec 19, 2020 - 7 comments

Amr commented on Dec 19, 2020

my report contains chart and table it worked very well on screen, but when i try to export it to pdf, the pdf shows everything well except the chart it is always blank, after lot of searches at the forum with no result, i tried your example the same no chart is shown Please advise ASAP

David Winterburn commented on Dec 21, 2020

Hi,

Please try to use "useLocalTempFolder" when exporting like this:

    $report->run()->export("MyReportPDF")
    ->settings([
        'useLocalTempFolder' => true
    ])
    ->pdf(...)

Then look into your local "tmp" folder (which should be either at your report folder or at koolreport/export) and find the latest .tmp file. Rename it to .html and open it with your browser to see if there's a chart rendered. If there is not please open browser console (F12) to see if there's any error (red) message. Please let us know the result. Thanks!

Charles Eddins commented on Mar 29, 2022

I'm having this same issue. I've tried using different chart packages but they all have the same issue. The reports render fine if I just render them on browser, but if I use the export package to make them pdfs the charts don't appear. I followed the above steps and got the attached console errors. It looks like the initial KoolReport.js file isn't found and every chart fails to load because it can't find the global KoolReport object that that file is supposed to create.

Sebastian Morales commented on Mar 30, 2022

Hi Charles, which type of web server (apache, nginx, php built in, etc) do you use? Rgds,

Charles Eddins commented on Mar 30, 2022

Currently using Caddy

Sebastian Morales commented on Apr 1, 2022

Would you pls find out the url path of KoolReport.js in your export temp file and compare it with the KoolReport.js path in your report web page and let us know values of both paths? Tks,

Charles Eddins commented on Apr 13, 2022

Found the solution. I had to update the hostname to match the internal hostname I was using in my container, install the codeigniter friendship, and update the asset path to point to the now publicly available assets. The codeiginiter friendship documentation says it would do that for you but I still had to do it manually.

Sebastian Morales commented on Apr 14, 2022

Charles, thanks a lot for your valuable information about why export resources didn't load. In export setting we have property called serverLocalAddress which you could try if you server name is different from "localhost" or $_SERVER["HTTP_HOST"]:

$report->run->export("MyReportPDF")
->settings(array(
    "serverLocalAddress" => $serverCustomName,
))
->pdf(...)
...

As for Codeigniter companion package, it can only copy report resources to the default public path: {project_folder}/assets/koolreport_assets. If you want use a different public path you have to set it directly in the report:

https://www.koolreport.com/docs/codeigniter/overview/#details-customize-assets-location

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