Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines
Sorry forgot to add - this is when using the Export package. I have included it in my main report class as stated in the instructions - error occurs when I try and call the toBase64() method. If I take that out, the report generates fine. I have multiple resultsets being processed and this was never a problem before. Any insight please let me know.
Thanks for reply.
I have updated and I am still seeing the same error - I believe I have an idea how. My reports are handled by one class that extends Koolreport - I am calling the report like so.
$maxkool = new MaxtimeKoolReport($reports[$r['reportid']]['koolreport'], $resultset);
$base64report = 0;
$reporthtml = $maxkool -> run()->render(null, true);
$pdf = $maxkool -> export($reporthtml) -> settings(["useLocalTempFolder" => true]) -> pdf(["format" => "A4", "orientation" => "portrait"])->saveAs("report.pdf");
This is working fine if I run the
$reporthtml = $maxkool -> run()->render(null, true);
by itself
as this gets me my raw html output which is what I require, it's when I call:
$pdf = $maxkool -> export($reporthtml) -> settings(["useLocalTempFolder" => true]) -> pdf(["format" => "A4", "orientation" => "portrait"])->saveAs("report.pdf");
and pass in the $reporthtml aka the "view" that I still get
Fatal error: Cannot redeclare koolreport\widgets\koolphp\groupLevel() (previously declared in /var/www/gags/api/scheduledreport/koolreport/src/widgets/koolphp/Table.php:229)
So it seems calling methods on the object twice is the cause? I'm assuming somewhere down the line, the export() method must also perform similar functions to the run() or render() method?
Please let me know.
More than happy to share more code if need be.
Thanks.
It seems to me the Table.php has not been updated. Could you please do me a favor, you open the \koolreport\src\widgets\koolphp\Table.php and replace with the code here:
https://github.com/koolphp/koolreport/blob/master/src/widgets/koolphp/Table.php
Ah ok thanks! Yes this has solved it - I see you've made the function static - good call! :)
I have another issue related - as I am trying to export a PDF - it goes through the export() function fine but there is no output and keep getting blank PDF files - I have included
use \koolreport\export\Exportable;
in my report class file and the file that I am creating the Koolreport object from.
I know I am getting data out because when I do a file_put_contents on the $reporthtml and view it I can see my report has successfully generated. But it doesn't seem to translate into the PDF?
Please any help would be appreciated.
Ok so I am placing contents of report html in a file called "test.html" and running that through the instant exporter package as another test. The test.html file contains the same information and structure as your SakillaRental.view.php file in PDF export example, except it just has my datasources in.
Sending HTML into export() function as variable i.e. export($html) AFTER running $report -> run() -> render() is this possible? If not, how can it be made possible?
Biggest problem using instant exporter - when the script attempts to execute the "runPhantom()" method for some reason it all just freezes. It does not execute further in the PHP, but just hangs and causes network disconnect eventually. So I can not get it to export at all currently.
I have ran phantomjs -v on the command line in the bin folder of packages/export and I am seeing 2.1.1 return meaning I have installed correctly as PATH variable etc. I am on CentOS 6.9.
Please let me know.
Let KoolReport help you to make great reports. It's free & open-source released under MIT license.
Download KoolReport View demo