It has been 2 days that this error appears when trying to export to pdf the SalesByCustomer Example with cloudExport. Before, it worked perfectly. Here is the code :
//index.php
require_once "../koolreport/autoload.php";
require_once "SalesByCustomer.php";
$salesbycustomer = new SalesByCustomer;
$salesbycustomer->run()
->cloudExport("SalesByCustomer")
->chromeHeadlessio("myToken")
->pdf()
->toBrowser("myreport.pdf", true);
// SalesByCustomer.php
require_once "../koolreport/autoload.php";
//Specify some data processes that will be used to process
use \koolreport\processes\Group;
use \koolreport\processes\Sort;
use \koolreport\processes\Limit;
//Define the class
class SalesByCustomer extends \koolreport\KoolReport
{
use \koolreport\clients\Bootstrap;
use \koolreport\cloudexport\Exportable;
protected function settings()
{
//Define the "sales" data source which is the orders.csv
return array(
"dataSources"=>array(
"sales"=>array(
"class"=>'\koolreport\datasources\CSVDataSource',
"filePath"=>"orders.csv",
),
)
);
}
protected function setup()
{
//Select the data source then pipe data through various process
//until it reach the end which is the dataStore named "sales_by_customer".
$this->src('sales')
->pipe(new Group(array(
"by"=>"customerName",
"sum"=>"dollar_sales"
)))
->pipe(new Sort(array(
"dollar_sales"=>"desc"
)))
->pipe(new Limit(array(10)))
->pipe($this->dataStore('sales_by_customer'));
}
}
<?php
//SalesByCustomer.view.php
use \koolreport\widgets\koolphp\Table;
use \koolreport\widgets\google\BarChart;
?>
<div class="report-content">
<div class="text-center">
<h1>Sales By Customer</h1>
<p class="lead">This report shows top 10 sales by customer</p>
</div>
<?php
BarChart::create(array(
"dataStore"=>$this->dataStore('sales_by_customer'),
"width"=>"100%",
"height"=>"500px",
"columns"=>array(
"customerName"=>array(
"label"=>"Customer"
),
"dollar_sales"=>array(
"type"=>"number",
"label"=>"Amount",
"prefix"=>"$",
"emphasis"=>true
)
),
"options"=>array(
"title"=>"Sales By Customer",
)
));
?>
<?php
Table::create(array(
"dataStore"=>$this->dataStore('sales_by_customer'),
"columns"=>array(
"customerName"=>array(
"label"=>"Customer"
),
"dollar_sales"=>array(
"type"=>"number",
"label"=>"Amount",
"prefix"=>"$",
)
),
"cssClass"=>array(
"table"=>"table table-hover table-bordered"
)
));
?>
</div>