Yii libraries to use Jasper Server Reports


Yii libraries to use Jasper Server Reports

This extension provides access to show Jasper Reports in Yii from Jasper Server.

** Note: This IS NOT a .jrxml parser version, you must install Jasper Server **


Copy YiiJasper folder to yii extensions folder.

You can import the extension where you use this or in the config main adding


Then you need configure some parameters in JasperReport.php to communicate with your Jasper Server:

/* Jasper server URL (Default Value) */
    protected $baseUrl = 'http://localhost:8080/jasperserver/';
    /* Jasper server username (Default Value) */
    protected $jusername = 'jasperadmin';
    /* Jasper server password (Default Value) */
    protected $jpassword = 'jasperadmin';


  • Yii Version 1.1.14

  • Installed and working Jasper Server (Tested in Community v5.2.0)


Examples for basic usage

/* Html Report */
    $pages = '1-4';
    $re = new JasperReport('/reports/samples/AllAccounts');
    echo $re->toHTML($pages); //Page 1 to 4
    /* Pdf Report */
    $re = new JasperReport('/reports/samples/AllAccounts');
    echo $re->toPDF(); //All pages
    /* Xls Report */
    $re = new JasperReport('/reports/samples/AllAccounts');
    echo $re->toXLS(8); //Page 8
    /* Widget Report, Html report with pagination */
    $this->widget('JReportView', array(


GitHub repository - https://github.com/cezario/yiijasper


  • Demo file is included in download file, but I recommend download from GitHub

Total 13 comments

#17381 report it
cezario at 2014/05/31 12:04pm
Re:Conflicting JS

Hello, What is your Jasper Server version?

#17126 report it
Selim at 2014/05/06 02:08am
Conflicting JS

Dear, This extension is working nicely. But when I want to view the report into a view file then it conflicting with js. How can I solve it ?

#15796 report it
Selim at 2013/12/18 05:39am
RE: Where is the Ext?

just Under the "Search Extensions" field

#15658 report it
C.S.Putera at 2013/12/05 03:54am
Using $this when not in object context

Yes, my php version is above 5.1, I still cannot figure out why, but if I access the actionPdf, it runs well

#15645 report it
cezario at 2013/12/03 10:33am
Using $this when not in object context

Hello C.S.Putera, I don't have any error with the url demo/index.php?r=site/index, I need more information to replicate the error or you can download and try again.

Note: Check your php version, the server must have PHP 5.1 or above, I tested this in PHP 5.4.9

#15642 report it
C.S.Putera at 2013/12/03 04:13am
Using $this when not in object context

Hello, when I try to access http://localhost/demo/index.php?r=site/index I got this err : "Using $this when not in object context" is there anything wrong in my setting ? Please help, thank you

#15347 report it
cezario at 2013/10/30 12:23pm
Parameters example

Hi Jose, it is good to know is working.

Hi Girish, you need to send parameters in one associative array,

array('param1' => 'value1', 'param2' => 'value2', 'param3' => 'value3',...)

Suppose you have report with a query like that:

select * from students where group = $P{group}

And you want to show, all students in the group B:

$re = new JasperReport('/reports/students', JasperReport::FORMAT_HTML, array(
            'group' => 'B',
$html = $re->toHTML();;
$this->render('groups', array(
    'html' => $html,

JasperReport::FORMAT_HTML is the initial format, you can export later if is necesary.

Here you show a widget with students in group C:

$this->widget('JReportView', array(
    'params' => array(
        'group' => 'C',
#15343 report it
JFReyes at 2013/10/30 09:20am
Re: Exception 'Limite de tiempo excedido, por favor intente de nuevo'

After some experimentation I got it: the pathname was wrong because I though it was relative to the Yii app but instead is relative to the JR server "root".

Thanks! José

#15338 report it
Girish at 2013/10/30 05:34am
How to pass parameter?

How can I add report parameters? Could you please give an example?

#15323 report it
cezario at 2013/10/28 06:33pm
Re: Exception 'Limite de tiempo excedido, por favor intente de nuevo'

Hi, this error can be appear when the yiijasper can't be connect with jasperserver, first check in your browser that you Jasper Server is running, you must see a window like this:


Then check if you can loggin with the params that you have in class JasperReport

protected $baseUrl = 'http://localhost:8080/jasperserver/';
protected $jusername = 'jasperadmin';
protected $jpassword = 'jasperadmin';

If everything it's ok, check if report path it's correct, you can copy this from the Jasper Server web interface


Finally check the time of execution for your report, if takes a lot of time, you must wait to execution finish to show the report, you can check the status with the method "isReady" and the exportID

Let me know how it goes.

#15319 report it
JFReyes at 2013/10/28 01:59pm
Exception 'Limite de tiempo excedido, por favor intente de nuevo'


I'm just getting started with Jasper Reports and tried your extension but am getting the timeout error even with a very simple report. Any ideas?


#15197 report it
cezario at 2013/10/16 10:01pm
Tomorrow :)

Hello Gustavo, tomorrow I'll upload it, was going to go up now but I was a little busy. In this page I'll to put the link.

#15196 report it
Gustavo Andrade at 2013/10/16 09:28pm
Where is the Ext?

Hi, where is the download file?

Leave a comment

Please to leave your comment.

Create extension