KoolReport's Forum

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

Twig and absolute path #3178

Open Salvatore Scalia opened this topic on on Oct 22, 2023 - 1 comments

Salvatore Scalia commented on Oct 22, 2023

hello,

My framework is symfony. i'm trying to create a pdf file from a twig template. This twig template combines a number of graphs (koolreport is very usefull for that) and other data (in a multilingual environment).

When i try to create this pdf ( i'm trying to use dompdf) because i didn't found a way to do it with export feature from koolreport, the graphs are not shown . I suppose this is because path is not in absolute url.

example if i print the $myreport->run()->render(true) , we can see that the src is /kool...

<script type='text/javascript' src='/koolreport_assets/3157288213/KoolReport.js'>

is there a way to fix that. Or (even better) a way to use koolreports features .

thanks in advance

Sebastian Morales commented on Oct 23, 2023

It's most likely dompdf can not print chart from your report because the chart is rendered dynamically with javascript executed in a browser. Both our Export and CloudExport packages can render charts created dynamically. In your framework's controller, you can use the following command to export:

class ReportController ...
{
    function exportPDF()
    {
        $report = new MyReport();
        $report->run()->export("MyReportTwigPdfView")->pdf(array(
            "format"=>"A4",
            "orientation"=>"portrait"
        ))->toBrowser("myfile.pdf"); 
    }
}

If there's any issue pls let us know to find a solution for 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