Yii 1.1: ireport

IReport is a PHP class allow us to design PDF report easily via Java based iReport designer.

This extension was based on PHPJasperXML. Is in Beta




$AReport = new IReport('sample2.jrxml');

$AReport->parameters = array("parameter1"=>1);




by Questor Sistemas

Update by #le_top

You can get my update here: Updated ireport extension and you can also Try the updated demo

Total 20 comments

#18890 report it
catataw at 2015/01/30 04:35am
Laravel ireport

Hi Everibody, In Yii2 Is Posible Use Composer To Download Https: //github.com/cossou/JasperPHP but the code is developed to be used in laravel, i wonder if somebaody could work with it and help to every body to use it in yii2

Hello ja unfortunately not work more with PHP, I'm out of date (; sorry

#18889 report it
fil at 2015/01/29 06:05pm
Laravel ireport

Hi everibody, in yii2 is posible use composer to download https://github.com/cossou/JasperPHP but the code is developed to be used in laravel, i wonder if somebaody could work with it and help to every body to use it in yii2.

#16393 report it
Emil Fedorciuc at 2014/02/18 02:34pm
Partially working

After strugling to find an older version of tcpdf as the latest gave an error my report finally renders.

No title displayed, no chart, no report footer, column headers are not displayed on a new report, in demo they are. Grouping gives errors. Maybe I expect too much out of the box.

If anyone found fixes for this erros please share.

#16324 report it
sit at 2014/02/10 10:33pm
I have a problem with font.

I would like to display thai font by tahoma.ttf how to set other font. I get error : tcpdf error could not include font definition file tahoma.ttf. when I embed tahoma.ttf with ireport.

#15365 report it
omar3ar at 2013/11/01 10:50am

Alguien ha intentado imprimir un barcode? code128(A,B) o cualquiera de esta codificacion?

Logro que me imprima todo pero el barcode, no aparece...!!!

#14811 report it
faisallarai at 2013/09/11 12:07pm
Passing parameters from PHP Application

Thank you for the extension,it is really working for me Please can you help me pass parameters

#11436 report it
catataw at 2013/01/14 04:57am
Several issues

@le_top Hello Thank you for the corrections, this week already be making changes.


#11420 report it
le_top at 2013/01/13 07:56am
Several issues (in strict mode), fixed / using phpjasperxml


My dev environment is using strict php settings, so I easily run into any errors like missing variables, ... (in my 'php.ini' I have 'error_reporting = E_ALL | E_STRICT')

I fixed that so that the demo at least generates PDF files except for Sample1 where TCPDF complains that it can not find the 'jpg' file. I also set up the demo using an sqlite3 database. I am not sure that the rendering is perfect, but it renders.

You can get my update here: Updated ireport extension and you can also Try the updated demo

The demo is supposed to be in the 'demo' directory, and the 'index.php' may need an update to reference 'yii'.

Update: I decided to try the original 'phpjasperxml' library and I managed wrapping it. I included it in the above reference zip and demo. This way we'll be able to follow evolutions of 'phpjasperxml' directly and save the effort of modifying a derived version of it.

#10220 report it
CedSha at 2012/10/11 10:08pm
Undefined variable: nameOfTheGroup

I do not know how to directly answer your msg ! Please find copy of report here


Here we have the group :

<group name="Essai">

and the error message and culprit lines are following. I finally comment the line and the report could be edited. I am not sure if I loose fonctionality or not ?

Undefined variable: Essai 
case "groupHeader":
    //$this->pointer = &$this->group[${$xml_path["name"]}]["groupHeader"];
    $this->pointer = &$this->grouphead;
#10192 report it
CedSha at 2012/10/10 04:13am
Undefined index: gname

This error occur when there is no group in the report. (gname = group Name) However I created a group and now I am stuck one step further with an error : Undefined variable: nameOfTheGroup

#8582 report it
catataw at 2012/06/12 08:35pm


#8575 report it
hyde82 at 2012/06/12 11:19am
print different format

if you want to use different format page. IReportRender construct: your array $conf is not processed by TCPDF.So you cannot use different format page than A4. I replaced this line :

if ($this->RParser->pageSetting["orientation"] == "P")   
            $conf = array(
            $conf = array(
        $this->pdf = new _TCPDF($this->RParser->pageSetting["orientation"], 'pt',$conf);


if ($this->RParser->pageSetting["orientation"] == "P")   
            $conf = array(
            $conf = array(
        $this->pdf = new _TCPDF($this->RParser->pageSetting["orientation"], 'px',$conf);
#8512 report it
banamlehsb at 2012/06/08 03:03pm
demo doesn't work

ireport demo doesn't work. Undefined index: gname

#7462 report it
russellfeeed at 2012/03/23 12:45pm
Error Reporting is the issue

Thanks catataw

I found some help on the PHPJasperXML forum, and even tried using PHPJasperXML without your extension. The errors go away if I use


Like this:

public function actionMonthlyreport() {
        $reportdef =  dirname(__FILE__) . '/../reports/report2.jrxml';
        $AReport = new IReport($reportdef);
        $AReport->parameters = array("parameter1"=>1);

So now your iReport extension is pumping out a .PDF for me now... I've just got to work out why is blank ;-)

Thanks again

#7461 report it
catataw at 2012/03/23 12:08pm
This extension was based on PHPJasperXML ?

@russellfeeed Hello this extension was based on PHPJasperXML, referring to the errors must be because of the php.ini configuration is able to send me your php.ini so I can check and correct errors.

#7460 report it
russellfeeed at 2012/03/23 10:58am
This extension was based on PHPJasperXML ?

Does this extension depend on PHPJasperXML, or is it merely inspired by PHPJasperXML ?

#7458 report it
russellfeeed at 2012/03/23 10:07am
Is this compatible with iReport v4.5.1?

Like @kokoadi (http://www.yiiframework.com/extension/ireport/#c7390) I too had the error with

switch ($data[scaleImage])

which was easily fixed by replacing it with

switch ($data['scaleImage'])

but now I'me getting all sorts of errors trying to render a iReport 4.5.1 generated .jrxml


2012/03/23 13:49:36 [error] [php] Undefined variable: imagetype
2012/03/23 13:52:32 [error] [php] Undefined index: hidden_type
2012/03/23 13:55:34 [error] [php] Undefined index: rotation
2012/03/23 13:57:06 [error] [php] Undefined index: type

Any ideas what I'm doing wrong?

Thanks in advance Russell

#7390 report it
kokoadi at 2012/03/19 07:58pm
PHP notice

Use of undefined constant scaleImage - assumed 'scaleImage' how to solve this?

private function ParserElementImage($data) {
327         $imagepath = $data->imageExpression;
328         switch ($data[scaleImage]) {
329             case "FillFrame":
330                 $this->pointer[] = array(
331                     "type" => "Image",
332                     "path" => $imagepath,
333                     "x" => $data->reportElement["x"] + 0,
334                     "y" => $data->reportElement["y"] + 0,
335                     "width" => $data->reportElement["width"] + 0,
336                     "height" => $data->reportElement["height"] + 0,
337                     "imgtype" => $imagetype,
338                     "link" => substr($data->hyperlinkReferenceExpression, 1, -1),
339                     "hidden_type" => "image");
340                 break;
#6351 report it
catataw at 2012/01/02 06:01am
usando oracle

Ola Renata, para conectar e pegar os dados uso o proprio yii tenta fazer uma aplicacao e usar o seguinte codigo

private function buildsql($IReportParserXML) {
        $sql = $IReportParserXML->sql;
        if (isset($IReportParserXML->parameters)) {
            foreach ($IReportParserXML->parameters as $v => $a) {
                $sql = str_replace('$P{' . $v . '}', $a, $sql);
        return $sql;
    public function execute($IReportParserXML) {
        $this->m = 0;
        $command = $this->connection->createCommand($this->buildsql($IReportParserXML));
        $reader = $command->query();
        foreach ($reader as $row) {
            foreach ($IReportParserXML->fields as $out) {
                $this->data[$this->m]["$out"] = $row["$out"];


#6323 report it
renata at 2011/12/29 10:23am
Usando com o Oracle

Olá catataw,

Criei um relatório no IReport conectado com o oracle e fiz um simples select para exibir uns campos da tabela. Quando chamo o relatório no Yii ocorre o erro abaixo :

"General error: 24337 OCIStmtExecute: ORA-24337: handle de instrução não preparado"

O código da chamada:

$AReport = new IReport('report1.jrxml'); $AReport->execute();

Alguma idéia do que pode ser?


Leave a comment

Please to leave your comment.

Create extension
  • Yii Version: 1.1
  • License: New BSD License
  • Developed by: catataw
  • Category: Others
  • Votes: +9 / -1
  • Downloaded: 3,912 times
  • Created on: Oct 17, 2011
  • Last updated: Jan 14, 2013
  • Tags: IReport, PDF