I am trying to export a Data table and Js Donut chart to a PDF using chrome headless IO. When I print the report, the graph does not show up, and the data table is not formatted correctly. Just checking to see what I am doing incorrectly.
Export.php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once "CodeActivityGraphList.php";
$date = date('m/d/Y');
$text = 'WorkLogReport' . $date . '.xls';
$date1 = $_GET['date1'];
$date2 = $_GET['date2'];
$dateField = $_GET['dateField'];
$typeStatus = $_GET['typeStatus'];
$settings = [
"pageWaiting" => "networkidle2", //load, domcontentloaded, networkidle0, networkidle2
];
$pdfOptions = [
"format"=>"A4",
'landscape'=>false,
"noRepeatTableFooter" => true,
];
$report = new CodeActivityGraphList(['date1' => $date1, 'date2' => $date2, "dateField" => $dateField, "typeStatus" => $typeStatus]);
$report->run();
$report
->cloudExport("CodeActivityGraphPdf")
->chromeHeadlessio("mytoken")
->settings($settings)
->pdf($pdfOptions)
->toBrowser("CodeActivityGraphReport.pdf");
CodeActivityGraphPdf.view.php
use koolreport\datagrid\DataTables;
use koolreport\chartjs\DonutChart;
$sid = $_GET['sid'];
$fid = $_GET['fid'];
$aid = $_GET['aid'];
$date1 = $this->params['date1'];
$date2 = $this->params['date2'];
$dateField = $this->params['dateField'];
$typeStatus = $this->params['typeStatus'];
?>
<style>
.tables{
text-align: center;
text-decoration: underline;
}
* {
-webkit-print-color-adjust: exact !important;
}
</style>
<html>
<body style="margin:0.5in 1in 0.5in 1in">
<link rel="stylesheet" href="../../../assets/bs3/bootstrap.min.css" />
<link rel="stylesheet" href="../../../assets/bs3/bootstrap-theme.min.css" />
<div class="text-center">
<h1 class="tables">Code Activity Table</h1>
<div style="width: 45%;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;">
<?php
if ($typeStatus == 'type') {
DonutChart::create([
"title" => "Activity Types",
"dataSource" => $this->dataStore("typeStatusGraph"),
"columns" => [
"Activity Type",
"Activities" => [
"type" => "number"
]
]
]);
?>
</div>
<br>
<br>
<div style="width: 80%;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;">
<?php
DataTables::create([
"dataStore" => $this->dataStore("typeStatusTable"),
"columns" => [
"Case #",
"Activity Type",
"Activity Date",
"Scheduled Date",
"Completed Date",
"Description",
],
"cssClass" => [
"table" => "table table-bordered table-striped table-hover"
]
]);
?>
</div>
<?php
} else {
DonutChart::create([
"title" => "Activity Status",
"dataSource" => $this->dataStore("typeStatusGraph"),
"columns" => [
"Status",
"Activities" => [
"type" => "number"
]
]
]);
?>
</div>
<br>
<br>
<div style="width: 80%;
top:0;
bottom: 0;
left: 0;
right: 0;
margin: auto;">
<?php
DataTables::create([
"dataStore" => $this->dataStore("typeStatusTable"),
"columns" => [
"Case #",
"Status",
"Activity Date",
"Scheduled Date",
"Completed Date",
"Description",
],
"cssClass" => [
"table" => "table table-bordered table-striped table-hover"
]
]);
}
?>
</div>
</body>
</html>
Any help would be great, thank you.