Yii 1.1: jasphp

A new extension to integrate jasper reports with PHP
20 followers

DEPRECATED! ΒΆ

Since this extension took too much of my time, i stopped the development, so i'm sorry to say that i almost didn't do anything more to improve it.


IMPORTANT Info: I've developed this extension in my work to help me to generate PDF Reports, if you want to help me, i appreciate!

Requirements

Yii 1.1.5 is required
Jasper Reports

What have in this extension

FDPF lib (http://www.fpdf.org/)
Xml2Pdf lib (http://www.geelweb.org)

Setup

In your protected/config/main.php config file, add the following to the file:
'import' => array(
        ...
        'ext.JasPHP.*',
    ),
    'components' => array(
        ...
        'jasPHP' => array(
            'class' => 'JasPHP',
        ),
    ),

That's all you have to do for setup. You can use like this. Example:

Yii::app()->jasPHP->create(getcwd() . '/reports/', 'reportName.jrxml', array('parameter1' => $parameter1,), array('property1' => $property1,));
  • $reportDir: the report directory
  • $reportName: the report file name
  • $parameters: all the parameters that you need
  • $config: all the configs that you need

Embedded documents

There isn't yet...=/

Total 18 comments

#16415 report it
Eric M at 2014/02/20 02:10pm
PHP Reporting

Wow...that's strange Emil Fedorciuc. I use Mac OS...and that's a unix based system..

I'll follow ur advice...thanks

#16414 report it
Emil Fedorciuc at 2014/02/20 02:01pm
Php reporting

https://github.com/BBFMedia/PHPJasperXML - this is what I am testing atm, so far many of the features in the jasper report are rendered correctly with php without having to install jasper server.

I already have a few projects and I need to implement a php based reporting tool without the need to install/configure another server, this is the closest to a php reporting tool I could find, I just wanted to test your extension.

I didn't get to test your extension, I am sorry, developing under linux and linux is case sensitive, so for the sake of portability if you name your extension folder "jasphp" use 'ext.jasphp.' instead of 'ext.JasPHP.'. you call fpdf.php in your script with upper case FPDF and I will get file not found errors and so on...

Always call your files using the same casing as they are named. You might want do deploy your project on a linux based hosting at some point and you will get all those errors. Windows ignores the case so there's no problem there.

#16413 report it
Eric M at 2014/02/20 01:38pm
This is so wrong answer

Sorry to hear that Emil Fedorciuc. It should be one of the most greatest PHP extension. It's so hard to see a decent report tool for PHP, and when i started this extension, i was certain that i was doing great, but it's expend too much time to migrate. In that circumstance i needed to stop the development to finish another things in the company project, so i couldn't spent more time and i stopped the development. Perhaps in the future i can go on with this one.

https://github.com/ericmaicon/jasperToPHP

#16412 report it
Emil Fedorciuc at 2014/02/20 12:45pm
This is so wrong

Developed under windows and it doesn't respect the case. I guess I have to find my own way to port phpjasperxml into my projoects, so far it's the best way to use jrxml files into php I found

#15797 report it
Selim at 2013/12/18 05:41am
usage of jasPHP

Hi all, I just installed jasPHP extension for my application to generate reports in pdf.

I can generate pdf for a string. I need some example for showing table data using controller.

Could you please help me out ? thanks in advanced ...

#14148 report it
rajithastig at 2013/07/23 02:51am
passing parameters !!!

hey i have successfully created static reports with the help of jasphp extension

i have created the necessary reports and stored them inside the project

now i want to pass the parameters to generate some reports

this is my actionReport in the Controller (for static reports)

public function actionReport()
        {
            $reportfiledir =getcwd() . '/reports/';
            $filename = $_GET['file'] . '.jrxml';
                    $title = 'Hello World!';
                    Yii::app()->jasPHP->create(
                    $reportfiledir ,
                    $filename,
                    array(
                    'SUBREPORT_DIR'=>'./',
                    'title' => $title,'parameter1'=>$_GET['p']
                    ));
 
 
 
        }

this is the code in the view to get the report (for static reports)

<?php echo CHtml::link('Generate PDF report', array('report','type'=>'jasphp', 'file' => 'report4dasad','p'=>'1')) ?>

can somebody tell me how to pass parameters ??

thank you in advance

#11422 report it
le_top at 2013/01/13 11:36am
jasphp vs ireport

After fixing the 'ireport' extension, I decided to looking 'jasphp'. I merged the demos, you can download the ireport+jasphp demo and try it online.

I had to make a change in TextUtils to remove extra spaces around '+':

private function gerenalTreatment($finalVar) {
        //Tratando os valores irrelevantes:
 
        $finalVar = preg_replace('/\s+\+\s+/',"",$finalVar);
        $finalVar = str_replace($this->replacement, "", $finalVar);

Both extension has their + and -: ireport seems to render lines, tables, etc. better, and jasphp seems better structured and seems to render the text better. Both can read from the database.

#10256 report it
lvsan at 2012/10/15 04:17am
Incorrect orientation

i have copy the same code and run the php, but below message is prompt.

Xml2Pdf error : Incorrect orientation:

can someone assist me?

thanks.

#10189 report it
CedSha at 2012/10/10 02:05am
Temporary solving of >>> error Orientation Page

I notice the .jrxml generated by iReport (V4.7.1) does not have any orientation instruction inside (only keep track of pageWidth and pageHeight) so I modify the second line of the .jrxml and add orientation="portrait" inside. Some reports works well without it Quite strange behaviour !

  • However I am still having issues with char encoding (UTF-8) This one is solved here
  • and multiple page documents. This one also solved should not used the title band of IReport.
#8827 report it
Nacesprin at 2012/07/01 02:45pm
Error: "There isnt`t tag specified in the class: Jasper"

There isnt`t tag specified in the class: Jasper

/home/iproc/public_html/protected/extensions/jasPHP/utils/BeanUtils.php(50)

38

39 if (is_numeric($val) && $attritubeName != 'size') {

40 $instance->{$attritubeName} = PixelUtils::pixeltoMm($val);

41 } else {

42 $instance->{$attritubeName} = $val;

43 }

44 }

45 }

46

47 array_push($returnArray, $instance);

48 }

49 } else {

50 throw new JasperReaderException("There isnt`t tag specified in the class: " . $class);

51 }

52

53 if (count($returnArray) > 1) {

54 return $returnArray;

55 } else {

56 if (count($returnArray) == 0) {

57 return null;

58 }

59

60 return $returnArray[0];

61 }

62 }


What means that error?

#7974 report it
Eric M at 2012/04/30 10:48am
Reply

Hello peter! Thanks!

Im trying to copy the original lib in java and making in php...but itll take some time!!

#7956 report it
xNicox at 2012/04/28 04:22pm
Parameters

Hi, peterjkambey, Yes inside iReport you can access an retrieve al data. But in another application I saw that iReport receive arrays of objects, so I think I could repeat that technique. Obviusly your solution is one possibility !!! Regards.

#7955 report it
Peter JK at 2012/04/28 11:32am
wonderfull

hi ericmaicon,

I want to update my 2 hours experience. i can solve it finally after several experience with iReport. just create connection to existing database with JDBC, write SQL statement needed, drag dan drop design, add several parameter (it values send by Yii later), save and put in the proper folder. tadaa.. it work directly...

I really amazing what you have done with this extension, it really simplified all report designation.. so, thank you.

I will use this technique to create report on my open source ERP-Accounting Application...

One More: Jasper support to export into several format, including excel, html. is it not available yet in this extension?

#7945 report it
Eric M at 2012/04/27 02:42pm
Parameters ...

can u send me the jrxml plz? can i see the example? or just a pastebin.com thx!

#7944 report it
Peter JK at 2012/04/27 02:36pm
same problem with Nikolas400

I think, I really have same problem with Nikolas400. still don't find a way to pass serial data from current Db into report...

#7775 report it
xNicox at 2012/04/17 05:25pm
Parameters ...

Hi, do you have an example with real data ? I mean, I need to pass a list of objets or an array of Data. Best Regards.

#7606 report it
Eric M at 2012/04/02 08:59pm
error Orientation Page

U can resolve setting the orientation page on the ireport, but if u want u can send me the .jrxml, can u plz? eric@ericmaicon.com.br!

thx

#7605 report it
kokoadi at 2012/04/02 08:30pm
error Orientation Page

I have error xml2pdf: orientation page how to solve this?

Leave a comment

Please to leave your comment.

Create extension
Downloads