lavela / phpjasper

Create Reports in PHP with JasperReports
MIT License
66 stars 20 forks source link

Blank output when adding MySQL db driver info in the route #31

Closed azaman2204 closed 6 years ago

azaman2204 commented 6 years ago

Using Laravel 5.5. Install lavela/phpjaser as per instructions.

  1. Output of hello_world.jrxml to hello_world.pdf working and display output correctly when using the following route entry.
    Route::get('/rpt', function () {
    $output = public_path() . '/examples/'.time().'_hello_world';
    $report = new JasperPHP;
    $report->process(
        public_path() . '/examples/hello_world.jrxml',
        $output,
        array('pdf'),
        array(),
        array()  
        )->execute();
  1. Output of hello_world.jrxml to blank page hello_world.pdf when using the following route.
    Route::get('/rpt', function () {
    $output = public_path() . '/examples/'.time().'_hello_world';
    $report = new JasperPHP;
    $report->process(
        public_path() . '/examples/hello_world.jrxml',
        $output,
        array('pdf'),
        array(),
        array(
                'driver' => 'mysql',
        'username' => 'xxxx',
                'password' => 'xxxx',
        'host' => 'localhost',
        'database' => 'xxxxxx',
        'port' => '3306'
 )  
        )->execute();
  1. When using another simple test jrxml which output simple 3 field data record from MySQL DB where the report created in JasperStudio 6.5.1, it gives ERROR outputs as follow using the following route entry;
    Route::get('/rpt', function () {
    $output = public_path() . '/examples/'.time().'_test123';
    $report = new JasperPHP;
    $report->process(
        public_path() . '/examples/test123.jrxml',
        $output,
        array('pdf'),
        array(),
        array(
                'driver' => 'mysql',
        'username' => 'xxxx',
                'password' => 'xxxx',
        'host' => 'localhost',
        'database' => 'xxxxxx',
        'port' => '3306'
 )  
        )->execute();
_Exception (1)
07:45:41,976 ERROR Digester:1770 - Parse Error at line 8 column 13: cvc-complex-type.2.1: Element 'property' must have no character or element information item [children], because the type's content type is empty._
azaman2204 commented 6 years ago

My bad. It works now. I should used the .jasper file for the use with DB access. Now i changed test123.jrxml and use test123.jasper generated in the jasperstudio