Hi,
I am using ChromeHeadless.io to generate PDF files in Laravel. My app is deployed to Digital Ocean.
I am able to generate the pdf file, in which the text and the tables are displayed. However, the google charts (column, donut) are not being displayed. It is just blank there.
On my local dev machine, using Phantomjs on windows and using temp folder, I am able to see the charts after refreshing the page. However, locally using ChromeHeadless.io, I am not able to view the charts locally.
The same charts are displayed on the dashboard and working as expected.
PS: I am also trying to load phantomjs on the Digital Ocean droplet. I have downloaded in the vendor/koolreport/export/bin folder. However, not able to run phantomjs -- version. Any help.
Look forward to your help.
In MyReport.php
use \koolreport\cloudexport\Exportable;
In MyReportPDF.view.pdf
<?php
Table::create([
"dataSource"=>$this->dataStore("plant_group_score"),
"showFooter"=>true,
"columns"=>array(
"plant"=>array(
"label"=>"Plant"),
"group_percent"=>array(
"type"=>"percent",
"label"=>"Scores",
"footer"=>"avg",
"footerText"=>"<b>Avg Score:</b> @value"
),
),
"removeDuplicate"=>array("plant")
]);
google\ColumnChart::create(array(
"title" => "Total MFG Safety Score (All Plant - All Weeks)",
"dataSource" => $this->datastore('checklist_score_total_by_week'),
"columns" => array(
"start_date",
"score" => array("label" => "Score", "type" => "number"),
)
));
google\DonutChart::create(array(
"title" => "All Plants By Finding Type",
"dataSource" => $this->datastore('finding_by_type'),
"columns" => array(
"finding_type",
"id" => array(
"type" => "number",))));
?>
Calling the report
// Using Cloud Export
$report->run()
->cloudExport("MyReportPDF")
->chromeHeadlessio("inserted my token")
->pdf()
->toBrowser("MyReport.pdf");