dimanche 29 novembre 2015

JasperPHP error "Your report has an error and couldn't be processed! ...."

I'm trying to generate reports using JasperPHP library in my laravel application and facing the error:

Exception in JasperPHP.php line 178: Your report has an error and couldn't be processed! Try to output the command using the function output(); and run it manually in the console.

My php code:

$database = array(
        'driver'    => 'mysql',
        'database'  => 'infolady_service',
        'username'  => 'root',
        'host' => 'localhost',
        'password'  => '',
        'charset'   => 'utf8',
    );
    $output = public_path() . '/report/'.time().'_codelution';
    $ext = "pdf";

    $jasper = new JasperPHP;
    // Compile a JRXML to Jasper
    $jasper->compile(__DIR__ . '/../../vendor/cossou/jasperphp/examples/hello_world.jrxml')->execute();

    // Process a Jasper file to PDF and RTF (you can use directly the .jrxml)
    $jasper->process(
        __DIR__ . '/../../vendor/cossou/jasperphp/examples/hello_world.jasper',     //.jasper file link
        $output,                                                                    //Output location
        array($ext),                                                                //Extension name
        array(),                                                                    //Any parameter as variable
        $database,                                                                  //DB informations
        false,                                                                      
        false
    )->execute();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire