Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
If your report data depends on input values pls put your Export button (use button, not a tag) inside a form tag so that when it's clicked the form data is submitted as well for your report to show non-empty data. In any case pls post your report setup, web view and pdf view code for us to check it for you.
Courbe_predic.php :
<?php
require_once "CourbePredic.php";
$CourbePredic = new CourbePredic(array(
"data"=>$data_source,));
$CourbePredic->run()->render();
?>
CourbePredic.php :
<?php
require_once "koolreport/core/autoload.php";
use \koolreport\processes\Group;
use \koolreport\processes\Sort;
use \koolreport\processes\Limit;
class CourbePredic extends \koolreport\KoolReport
{
use \koolreport\export\Exportable;
public function settings()
{
//include ("ext/config_report_adm.php");
return array(
"dataSources"=>array(
"mydata"=>array(
"class"=>'\koolreport\datasources\ArrayDataSource',
"data"=>$this->params["data"],
"dataFormat"=>"associate",
)
)
);
}
public function setup()
{
$this->src('mydata')
->pipe(new Sort(array("date"=>"asc",)))
->pipe($this->dataStore('courbe_predic'));
}
}
?>
CourbePredic.view.php :
<?php
use \koolreport\widgets\koolphp\Table;
use \koolreport\widgets\google\LineChart;
?>
<?php
LineChart::create(array(
"title"=>"",
"dataSource"=>$this->dataStore('courbe_predic'),
"options"=>array(
"curveType"=>"function"
),
"columns"=>array(
"date",
"prod"=>array(
"label"=>"Production",
"type"=>"number",
"prefix"=>"W"
),
"predic"=>array(
"label"=>"Prevision",
"type"=>"number",
"prefix"=>"W"
),
)
));
?>
Export.php :
<?php
require_once "report/CourbePredic.php";
$report = new CourbePredic;
$report->run()
->export('CourbePredicPdf')
->settings([
"useLocalTempFolder" => true,
])
->pdf(array(
"format"=>"A4",
"orientation"=>"portrait",
//"zoom"=>2
))
->toBrowser("courbe_predic.pdf");
?>
In your Export.php, you have to create the report with the same parameters as in your web view since your datassource is populated with "data"=>$this->params["data"]:
//Export.php
require_once "report/CourbePredic.php";
$CourbePredic = new CourbePredic(array(
"data"=>$data_source,));
$report->run()
->export('CourbePredicPdf')
->settings([
"useLocalTempFolder" => true,
])
->pdf(array(
"format"=>"A4",
"orientation"=>"portrait",
//"zoom"=>2
))
->toBrowser("courbe_predic.pdf");
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo