jasphp

A new extension to integrate jasper reports with PHP
17 followers

This extension is an alpha version. We need to tested more! ΒΆ

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 12 comments

#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