KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Export PDF - HTTP ERROR 500 #1653

Closed Thomas opened this topic on on Oct 8, 2020 - 1 comments

Thomas commented on Oct 8, 2020

I need help to get the export package to work. Here is my current code, based on an example:

MyReport.php

<?php
//Step 1: Load KoolReport
require_once ".../vendor/autoload.php";

//Step 2: Creating Report class
class MyReport extends \koolreport\KoolReport
{
    use \koolreport\export\Exportable;
    
    protected function settings()
    {
        return array(
            "dataSources"=>array(
                "data"=>array(
                    "class"=>'\koolreport\datasources\ArrayDataSource',
                    "dataFormat"=>"table",
                    "data"=>array(
                        array("name","age","income"),
                        array("John",26,50000),
                        array("Marry",29,60000),
                        array("Peter",34,100000),
                        array("Donald",28,80000),
                    )
                )
            )
        );
    }
    protected function setup()
    {
        $this->src("data")
        ->pipe($this->dataStore("data"));
    }    
}

export.php

<?php
require_once "MyReport.php";
$report = new MyReport;

$report->export()->pdf()->toBrowser("myreport.pdf");

I've tried it also with:

->settings(array(
    "useLocalTempFolder"=>true,
    "phantomjs"=>".../vendor/koolreport/export/bin",
    "resourceWaiting"=>2000,
))

All the packages are installed by the composer on our ubuntu server. I've also downloaded the phantomjs and put it into koolreport/export/bin.

It doesn't matter what I try, it is same result -> HTTP ERROR 500

Thomas commented on Oct 8, 2020

Hi, I did another search in the forum and found the solution. The phantomjs file had not the correct rights.

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed
solved

Export