KoolReport's Forum

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

Exporting to pdf/jpg by calling a JS function #1384

Open ankit raj opened this topic on on Apr 14, 2020 - 1 comments

ankit raj commented on Apr 14, 2020

Hello , i saw the examples of export which calls a different php file for exporting the report but i only use one file for my report. So how do i write my javascript function "exportfunction()" to export the given gauge card ?

<div class="col-md-4 offset-md-2">
    <a onclick="exportfunction()" href="javascript:void(0);" class="btn btn-primary">Download PDF</a>
    <?php
    \koolreport\amazing\GaugeCard::create(array(
        "title"=>"Revenue",
        "value"=>7500,
        "preset"=>"success",
        "baseValue"=>10000,
        "format"=>array(
            "value"=>array(
                "prefix"=>"$"
            )
        ),
    ));
    ?>
    </div>
KoolReport commented on Apr 14, 2020

All the exporting job is done at server side, so basically your javascript function will send a post or get to server with parameter. At server-side, upon receive exporting request, it will run report, export the report (with gaugecard inside) in form of PDF or JPG and return to client.

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

Export