Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
No, its my own report:
ComplaintsbyCompanyType.php
class ComplaintsbyCompanyType extends \koolreport\KoolReport
{
use \koolreport\laravel\Friendship;
use \koolreport\bootstrap4\Theme;
//Register cloud export service in your report
use \koolreport\cloudexport\Exportable;
function setup()
{
......
ComplaintsbyCompanyTypePDF.view.php
<?php
use \koolreport\widgets\koolphp\Table;
use \koolreport\widgets\google\BarChart;
?>
<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="page-header" style="text-align:right"><i>Complaints Analysis By Company Type</i></div>
<div class="page-footer" style="text-align:right">{pageNum}</div>
<div class="container">
<div class="row"><br/></div>
<div class="row">
<div class="col-md-12 text-center">
<h3>Complaints Analysis By Company Type</h3>
<h4><?php echo "{$this->params['quarter']}, {$this->params['year']}" ?></h4>
</div>
</div>
.....
ReportController.php:
public function kool() {
$report = new ComplaintsbyCompanyType(['quarter' => 'Q3', 'year' => 2018]);
$report->run()
->cloudExport("ComplaintsbyCompanyTypePDF")
->chromeHeadlessio("6320572b6de053c90f8c5d68afa96f08718a92f548a95602890479e4579904ab")
->pdf()
->toBrowser("ComplaintsbyCompanyType.pdf");
I have found the problem. I was using the Laravel built-in server (php artisan serve). So I switched to my XAMPP (http://localhost/port-transport-api/public/api/auth/reports/kool).
But now I am getting: mkdir(): Permission denied
/Applications/XAMPP/xamppfiles/htdocs/port-transport-api/vendor/chromeheadlessio/php-client/src/Exporter.php:
$relativePath = substr($filePath, strlen($rootPath) + 1);
// Add current file to archive
$zip->addFile($filePath, $relativePath);
}
}
// Zip archive will be created only after closing object
$zip->close();
}
function saveTempContent($content)
{
$settings = $this->settings;
$tmpFolder = $this->getTempFolder();
$tempDirName = uniqid();
$tempZipName = $tempDirName . ".zip";
$tempZipPath = $tmpFolder . "/" . $tempZipName;
$tempPath = $tmpFolder . "/" . $tempDirName;
mkdir($tempPath);
....
Another option is to update cloudexport package to version 1.5.0 with composer and use the following setting:
$report->run()
->cloudExport("MyReportPdf")
->chromeHeadlessio($secretToken)
->settings([
'useLocalTempFolder' => true
])
->pdf($pdfOptions)
->toBrowser($filename)
;
Thanks, but that didnt work because of this function in /vendor/chromeheadlessio/php-client/src/Exporter.php:
function getTempFolder()
{
// if($useLocalTempFolder)
// {
// if(!is_dir(realpath(dirname(__FILE__))."/tmp"))
// {
// mkdir(realpath(dirname(__FILE__))."/tmp");
// }
// return realpath(dirname(__FILE__))."/tmp";
// }
return sys_get_temp_dir();
}
So I replaced the above function with this, and set the tmp folder permission to 777, and it worked:
function getTempFolder()
{
if(!is_dir(realpath(dirname(__FILE__))."/tmp"))
{
mkdir(realpath(dirname(__FILE__))."/tmp");
}
return realpath(dirname(__FILE__))."/tmp";
}
Please, is there a way to clear the tmp folder, I can imagine it building up over time.
composer.json:
...... "koolreport/cloudexport": "^1.5.0", ......
Error:
Your requirements could not be resolved to an installable set of packages.
Problem 1
- koolreport/pro 4.1.2 requires koolreport/cloudexport 1.4.0 -> satisfiable by koolreport/cloudexport[1.4.0] but these conflict with your requirements or minimum-stability.
Please, can you send me a zip of the affected packages? I still could not install.
$ composer require koolreport/cloudexport:1.5.0
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.
Problem 1
- koolreport/pro 4.1.2 requires koolreport/cloudexport 1.4.0 -> satisfiable by koolreport/cloudexport[1.4.0] but these conflict with your requirements or minimum-stability.
- koolreport/pro 4.1.2 requires koolreport/cloudexport 1.4.0 -> satisfiable by koolreport/cloudexport[1.4.0] but these conflict with your requirements or minimum-stability.
- koolreport/pro 4.1.2 requires koolreport/cloudexport 1.4.0 -> satisfiable by koolreport/cloudexport[1.4.0] but these conflict with your requirements or minimum-stability.
- Installation request for koolreport/pro (locked at 4.1.2, required as *) -> satisfiable by koolreport/pro[4.1.2].
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo